From patchwork Thu Oct 12 12:19:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 30270 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C62B01B319; Thu, 12 Oct 2017 14:20:43 +0200 (CEST) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 13F6D1B2ED for ; Thu, 12 Oct 2017 14:20:32 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id q132so12824458wmd.2 for ; Thu, 12 Oct 2017 05:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1y5UrwrK813Vb1qw+EG8g/R7x4WlsetWff59P6xoYFE=; b=ZGbtsDhTTjT0J6PjZVcjyfGok0Ddm6Mt/VrqvQdS4K8KWXP6UJ4DiXHmdCtDJrN5eF YMbvNjmWUVL03ei08VnVDV2MoYE84V5RuojwOjMtVyQ0dz/wIvRhfGPvvqAha30HjRpi Ax3Fjq8RkQCGWeoFecaCqhqULUFPM2vgrYppshHyyfDqcL04YUxdglKHCR5DHeywc0ct WdQhOKU8aHtR2pHbfXQigzYkfiomzwPqzFnIyqM9Bos7RtdHTEmjl71Ji4x5wahiBXRq uV+fgheUUlqNleo6+vgOTmYM2JY6dGCyZ7UANM3SDAJKkj+kvbrJbavbnj14Qe2s4/Ax ed6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1y5UrwrK813Vb1qw+EG8g/R7x4WlsetWff59P6xoYFE=; b=p9QsMU3Isl9cgF6JcJxpLCn6qXxq1JntppFlPX3Zuj1spYWdJq9h9jEbvkRbaCY9b6 cz84DtlSevn2zGxTTw89cESQxe46lRlmayq8vPiD9VjM43sluR4Twnm0TwpUGuX7XZAT kTx1oen8YGbfYgwB6FKIhFielc48j7rHeYQgdJBosUp9R/Ek7rWUKZunyMwzLDITtRJw n+j2Oxq2Y33yG2ByjrvvpSDJoYc0Xkq86WVZ0v5ccu2MRJtrek45KwFCVD0RA045Drzw BBBzPQ4I3x6BidZ5sf9Sucg8pWesn1Ql/XH3ldZPFgjhN/OGmA6oxJkrw9L5bVePftbI g0YA== X-Gm-Message-State: AMCzsaX07X6NiixoYh3axs+2ho2OQ1/oQXziw0dgkz8ix3HTfhiTnVG/ UqFz3fIxHUVkSOq3U3zeEE53WQ== X-Google-Smtp-Source: AOwi7QBZz9I2TZ0GpcHkrw+plfRuJYpA93EliMQEr+YG2Br8fGQmSiTWIx+s9/qeyT4lNbajktOHfQ== X-Received: by 10.223.131.166 with SMTP id 35mr1914802wre.84.1507810831774; Thu, 12 Oct 2017 05:20:31 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id w79sm12148231wrb.86.2017.10.12.05.20.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 05:20:31 -0700 (PDT) From: Adrien Mazarguil To: Ferruh Yigit Cc: Nelio Laranjeiro , dev@dpdk.org Date: Thu, 12 Oct 2017 14:19:33 +0200 Message-Id: <7e81744cb1645fc08c65438acad0714a71d72647.1507809961.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 19/29] net/mlx4: add flow support for multicast traffic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Give users the ability to create flow rules that match all multicast traffic. Like promiscuous flow rules, they come with restrictions such as not allowing additional matching criteria. Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- doc/guides/nics/features/mlx4.ini | 1 + drivers/net/mlx4/mlx4_flow.c | 17 +++++++++++++++-- drivers/net/mlx4/mlx4_flow.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/mlx4.ini b/doc/guides/nics/features/mlx4.ini index bfe0eb1..9e3ba34 100644 --- a/doc/guides/nics/features/mlx4.ini +++ b/doc/guides/nics/features/mlx4.ini @@ -13,6 +13,7 @@ Queue start/stop = Y MTU update = Y Jumbo frame = Y Unicast MAC filter = Y +Multicast MAC filter = Y SR-IOV = Y VLAN filter = Y Basic stats = Y diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 377b48b..15526af 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -107,7 +107,9 @@ struct mlx4_drop { * * Additional mlx4-specific constraints on supported fields: * - * - No support for partial masks. + * - No support for partial masks, except in the specific case of matching + * all multicast traffic (@p spec->dst and @p mask->dst equal to + * 01:00:00:00:00:00). * - Not providing @p item->spec or providing an empty @p mask->dst is * *only* supported if the rule doesn't specify additional matching * criteria (i.e. rule is promiscuous-like). @@ -152,6 +154,13 @@ mlx4_flow_merge_eth(struct rte_flow *flow, goto error; } else if (!sum_dst) { flow->promisc = 1; + } else if (sum_dst == 1 && mask->dst.addr_bytes[0] == 1) { + if (!(spec->dst.addr_bytes[0] & 1)) { + msg = "mlx4 does not support the explicit" + " exclusion of all multicast traffic"; + goto error; + } + flow->allmulti = 1; } else if (sum_dst != (UINT8_C(0xff) * ETHER_ADDR_LEN)) { msg = "mlx4 does not support matching partial" " Ethernet fields"; @@ -164,6 +173,10 @@ mlx4_flow_merge_eth(struct rte_flow *flow, flow->ibv_attr->type = IBV_FLOW_ATTR_ALL_DEFAULT; return 0; } + if (flow->allmulti) { + flow->ibv_attr->type = IBV_FLOW_ATTR_MC_DEFAULT; + return 0; + } ++flow->ibv_attr->num_of_specs; eth = (void *)((uintptr_t)flow->ibv_attr + flow->ibv_attr_size); *eth = (struct ibv_flow_spec_eth) { @@ -615,7 +628,7 @@ mlx4_flow_prepare(struct priv *priv, flow->internal = 1; continue; } - if (flow->promisc) { + if (flow->promisc || flow->allmulti) { msg = "mlx4 does not support additional matching" " criteria combined with indiscriminate" " matching on Ethernet headers"; diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h index fcdf461..134e14d 100644 --- a/drivers/net/mlx4/mlx4_flow.h +++ b/drivers/net/mlx4/mlx4_flow.h @@ -68,6 +68,7 @@ struct rte_flow { uint32_t internal:1; /**< Internal flow rule outside isolated mode. */ uint32_t mac:1; /**< Rule associated with a configured MAC address. */ uint32_t promisc:1; /**< This rule matches everything. */ + uint32_t allmulti:1; /**< This rule matches all multicast traffic. */ uint32_t drop:1; /**< This rule drops packets. */ uint32_t queue:1; /**< Target is a receive queue. */ uint16_t queue_id; /**< Target queue. */