From patchwork Mon Aug 7 15:19:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 798729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xR1XF3pMZz9s1h for ; Tue, 8 Aug 2017 01:23:57 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 97F5DB08; Mon, 7 Aug 2017 15:20:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 78742AE0 for ; Mon, 7 Aug 2017 15:20:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 5AE041C0 for ; Mon, 7 Aug 2017 15:19:37 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 7 Aug 2017 18:19:15 +0300 Received: from dev-r-vrt-189.mtr.labs.mlnx (dev-r-vrt-189.mtr.labs.mlnx [10.212.189.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v77FJEFt002778; Mon, 7 Aug 2017 18:19:15 +0300 From: Roi Dayan To: dev@openvswitch.org Date: Mon, 7 Aug 2017 18:19:10 +0300 Message-Id: <1502119151-49792-7-git-send-email-roid@mellanox.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1502119151-49792-1-git-send-email-roid@mellanox.com> References: <1502119151-49792-1-git-send-email-roid@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Simon Horman Subject: [ovs-dev] [PATCH 6/7] tc: Add matching on tcp flags X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Paul Blakey To be used later for offloading rules matching on tcp_flags. Signed-off-by: Paul Blakey Reviewed-by: Roi Dayan --- lib/tc.c | 11 +++++++++++ lib/tc.h | 1 + 2 files changed, 12 insertions(+) diff --git a/lib/tc.c b/lib/tc.c index ce3e070..bf12a5b 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -200,6 +200,10 @@ static const struct nl_policy tca_flower_policy[] = { .optional = true, }, [TCA_FLOWER_KEY_IP_TTL_MASK] = { .type = NL_A_U8, .optional = true, }, + [TCA_FLOWER_KEY_TCP_FLAGS] = { .type = NL_A_U16, + .optional = true, }, + [TCA_FLOWER_KEY_TCP_FLAGS_MASK] = { .type = NL_A_U16, + .optional = true, }, }; static void @@ -325,6 +329,12 @@ nl_parse_flower_ip(struct nlattr **attrs, struct tc_flower *flower) { mask->tcp_dst = nl_attr_get_be16(attrs[TCA_FLOWER_KEY_TCP_DST_MASK]); } + if (attrs[TCA_FLOWER_KEY_TCP_FLAGS_MASK]) { + key->tcp_flags = + nl_attr_get_be16(attrs[TCA_FLOWER_KEY_TCP_FLAGS]); + mask->tcp_flags = + nl_attr_get_be16(attrs[TCA_FLOWER_KEY_TCP_FLAGS_MASK]); + } } else if (ip_proto == IPPROTO_UDP) { if (attrs[TCA_FLOWER_KEY_UDP_SRC_MASK]) { key->udp_src = nl_attr_get_be16(attrs[TCA_FLOWER_KEY_UDP_SRC]); @@ -1037,6 +1047,7 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower) } else if (flower->key.ip_proto == IPPROTO_TCP) { FLOWER_PUT_MASKED_VALUE(tcp_src, TCA_FLOWER_KEY_TCP_SRC); FLOWER_PUT_MASKED_VALUE(tcp_dst, TCA_FLOWER_KEY_TCP_DST); + FLOWER_PUT_MASKED_VALUE(tcp_flags, TCA_FLOWER_KEY_TCP_FLAGS); } else if (flower->key.ip_proto == IPPROTO_SCTP) { FLOWER_PUT_MASKED_VALUE(sctp_src, TCA_FLOWER_KEY_SCTP_SRC); FLOWER_PUT_MASKED_VALUE(sctp_dst, TCA_FLOWER_KEY_SCTP_DST); diff --git a/lib/tc.h b/lib/tc.h index 362e751..6c69b79 100644 --- a/lib/tc.h +++ b/lib/tc.h @@ -78,6 +78,7 @@ struct tc_flower_key { ovs_be16 tcp_src; ovs_be16 tcp_dst; + ovs_be16 tcp_flags; ovs_be16 udp_src; ovs_be16 udp_dst;