From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 93707936C for ; Fri, 30 Oct 2015 19:56:03 +0100 (CET) Received: by wmeg8 with SMTP id g8so18566097wme.0 for ; Fri, 30 Oct 2015 11:56:03 -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=nR3IUDS+QxKsuKS6ri3nuWtlJ7baChHyoFjLUEhM7no=; b=EjeiVdOZvHOh9u+qAPyHEvb4WjHwmxfbm4/pi+kGbkmK/jWZcZtfi/f+D+yb8tYcCC nbX9iAtJzmR2dpjb3NbOs3MsflyW7ht3qxDVBQJJei0rEvi0OhiT4acKg2l/SMCQszVK ADcaamu2Q8XKvIjsMamc8iTqBFDOooTNUj5qFRfvb4IoJL7BAaqDqfisv5iqBoLWNpYD 9Fax4q/HQDEumMRuYNXnQZoQEtWpxzMHr74WW6/3pTXrfmcy3wMWLbWO2CQ/p7S1z7ko aJlLfc2819xGpEQS/LpO3+aXD1aCQJ8rS0DXLTOG92E7yoiudp+sK6TSSHvkMQ53rRu/ zMcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nR3IUDS+QxKsuKS6ri3nuWtlJ7baChHyoFjLUEhM7no=; b=iEQLrDFDxrYnNpTpcRidvWe1izUM5J1vEBN5njdm2d3di8aOERedACoaSgEcxllNi9 OUUJwrhEh3qklYH24dGVIx0bUI8Kl6+1ZnGFaIBCmZBxj7wMBuOY3YwLirkmbmOv1RGJ VgwqOGHwNcJxWAZjg96i00N6o1Fk/XeaiifItSncFIIwaOgl2P89WYU+e42Yc//qQVLv V+9WupZbizPwkEEx+oCueyNYlrye1IUqWVCJe3HVVQ5B27mrouunOHnghdBXDjlgwvx8 WIhAsJF5n2yJAJay2yMKAkgpni5byvtuAlIkE3z03BRIdq0NPppxTcU26uCGMlp8mX3V +08Q== X-Gm-Message-State: ALoCoQm0Ayj7g2UNJiKZV+uWYYi/QSxgZnwQCKQ6LdJ7oxqSN+1gcg8R/lAnmiGiG/yYK9Se+/G6 X-Received: by 10.28.218.70 with SMTP id r67mr5134205wmg.74.1446231363475; Fri, 30 Oct 2015 11:56:03 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id gd10sm8351772wjb.47.2015.10.30.11.56.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 30 Oct 2015 11:56:02 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Fri, 30 Oct 2015 19:55:10 +0100 Message-Id: <1446231319-8185-8-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446231319-8185-1-git-send-email-adrien.mazarguil@6wind.com> References: <1444067692-29645-1-git-send-email-adrien.mazarguil@6wind.com> <1446231319-8185-1-git-send-email-adrien.mazarguil@6wind.com> Cc: Yaacov Hazan Subject: [dpdk-dev] [PATCH v2 07/16] mlx5: use alternate method to configure promisc and allmulti modes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Oct 2015 18:56:04 -0000 From: Olga Shern Promiscuous and allmulticast modes were historically enabled by adding specific flows with types IBV_FLOW_ATTR_ALL_DEFAULT or IBV_EXP_FLOW_ATTR_MC_DEFAULT to each hash RX queue, but this method is deprecated. - Promiscuous mode is now enabled by omitting destination MAC addresses from basic flow specifications. - Allmulticast mode is now enabled by using flow specifications that match the broadcast bit in destination MAC addresses. Signed-off-by: Olga Shern Signed-off-by: Adrien Mazarguil Signed-off-by: Nelio Laranjeiro Signed-off-by: Yaacov Hazan --- drivers/net/mlx5/mlx5_rxmode.c | 44 +++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index 79e31fb..7794608 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -74,20 +74,17 @@ static int hash_rxq_promiscuous_enable(struct hash_rxq *hash_rxq) { struct ibv_flow *flow; - struct ibv_flow_attr attr = { - .type = IBV_FLOW_ATTR_ALL_DEFAULT, - .num_of_specs = 0, - .port = hash_rxq->priv->port, - .flags = 0 - }; + FLOW_ATTR_SPEC_ETH(data, hash_rxq_flow_attr(hash_rxq, NULL, 0)); + struct ibv_flow_attr *attr = &data->attr; - if (hash_rxq->priv->vf) - return 0; if (hash_rxq->promisc_flow != NULL) return 0; DEBUG("%p: enabling promiscuous mode", (void *)hash_rxq); + /* Promiscuous flows only differ from normal flows by not filtering + * on specific MAC addresses. */ + hash_rxq_flow_attr(hash_rxq, attr, sizeof(data)); errno = 0; - flow = ibv_create_flow(hash_rxq->qp, &attr); + flow = ibv_create_flow(hash_rxq->qp, attr); if (flow == NULL) { /* It's not clear whether errno is always set in this case. */ ERROR("%p: flow configuration failed, errno=%d: %s", @@ -162,8 +159,6 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev) static void hash_rxq_promiscuous_disable(struct hash_rxq *hash_rxq) { - if (hash_rxq->priv->vf) - return; if (hash_rxq->promisc_flow == NULL) return; DEBUG("%p: disabling promiscuous mode", (void *)hash_rxq); @@ -217,18 +212,31 @@ static int hash_rxq_allmulticast_enable(struct hash_rxq *hash_rxq) { struct ibv_flow *flow; - struct ibv_flow_attr attr = { - .type = IBV_FLOW_ATTR_MC_DEFAULT, - .num_of_specs = 0, - .port = hash_rxq->priv->port, - .flags = 0 - }; + FLOW_ATTR_SPEC_ETH(data, hash_rxq_flow_attr(hash_rxq, NULL, 0)); + struct ibv_flow_attr *attr = &data->attr; + struct ibv_flow_spec_eth *spec = &data->spec; if (hash_rxq->allmulti_flow != NULL) return 0; DEBUG("%p: enabling allmulticast mode", (void *)hash_rxq); + /* + * No padding must be inserted by the compiler between attr and spec. + * This layout is expected by libibverbs. + */ + assert(((uint8_t *)attr + sizeof(*attr)) == (uint8_t *)spec); + hash_rxq_flow_attr(hash_rxq, attr, sizeof(data)); + *spec = (struct ibv_flow_spec_eth){ + .type = IBV_FLOW_SPEC_ETH, + .size = sizeof(*spec), + .val = { + .dst_mac = "\x01\x00\x00\x00\x00\x00", + }, + .mask = { + .dst_mac = "\x01\x00\x00\x00\x00\x00", + }, + }; errno = 0; - flow = ibv_create_flow(hash_rxq->qp, &attr); + flow = ibv_create_flow(hash_rxq->qp, attr); if (flow == NULL) { /* It's not clear whether errno is always set in this case. */ ERROR("%p: flow configuration failed, errno=%d: %s", -- 2.1.0