From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 7636A1B202 for ; Thu, 19 Oct 2017 14:51:55 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id k4so16203917wmc.1 for ; Thu, 19 Oct 2017 05:51:55 -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 :in-reply-to:references; bh=BDyVKTaoYPfMcvpb71yHRYRzALYmNxJuGN6VxmuioB8=; b=ah+4LHCfBZM9z3MXDTeIwHh8Ggfqxm64ohJ5qxY3Z8UJeNkHq9a8TJHDAqO819YOYN Oue8E9kQzJpeMDLT9dvoijrr6Otl+yD8HwRiKqQ75d2XTkxYLhm+UcAXG6VAIk7GtcMt PHaI68HCeZKWwHSpstkwMq21S6Uak44ALopgZOWSvbAvbMHnvZhG7GJ97v3WK5vpIQMh RWFD3Ib0vnsy0MHycfN2ZZHY63WNilf+g9EaWozuIJSDf7OCxU6e0gzCSUAx+WrOOZXW 2ebqw4QrdRUcUohRTnKAks1G+DDGNMUhGEQyEW/+FbQvtgdEiST+nVkuxvLeb6VwWXK4 D+yQ== 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:in-reply-to:references; bh=BDyVKTaoYPfMcvpb71yHRYRzALYmNxJuGN6VxmuioB8=; b=HY5Q+E3CqlobHStxE+j+iLprp+iWlaz2wnm5jBduf6zyivP1U2UH83omCZ/Nq7KKtM biJv3fZVQnojrXcRwB5cPwi0NP/mvZagbgya2IHpcQfv3gJEDOn7UIfW4WLpOQkvmfNR 9ANla2fTshzlaMyrCU8V7NCu4pPtIjhimevsicWDvCP0vLrwnkhs1SWkitOI884iim+K MK9jIiD8EpyDnQKsw/gP/9bCPKjL7F5/HVT8lCMvfDfyjY70CcAJ/7xcsne0mmhKERy1 6agKpE3AhgeziFIkece+bRLUaX25//SeAQVr0KRb24hv0lUD/W9MgsCtRkT4c6vf89vD bI3A== X-Gm-Message-State: AMCzsaUOI0Ue6O6QGp0tVWyuVRTc/zHf54vSFiCGAT3m9viuL3AWydyr KPzx9UC4DeLXyDmxgJ6jYYlTYDQ5Sg== X-Google-Smtp-Source: ABhQp+QUGTNadewy9jwY8OpAB3OxNOu5EkemeS+mcUasEKSUbVaVARoK1qmKp0VpKTBhLz9M0MbgKA== X-Received: by 10.28.66.215 with SMTP id k84mr1729871wmi.143.1508417514913; Thu, 19 Oct 2017 05:51:54 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 69sm1024189wmp.11.2017.10.19.05.51.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 05:51:54 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Yongseok Koh , Adrien Mazarguil Date: Thu, 19 Oct 2017 14:51:34 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 6/6] net/mlx5: fix allmulti mode 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: , X-List-Received-Date: Thu, 19 Oct 2017 12:51:55 -0000 All multi is not adding unicast flows which cause unicast packets to be dropped by the NIC. Fixes: 6a6b6828fe6a ("net/mlx5: use flow to enable all multi mode") Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_trigger.c | 131 ++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 29167badd..edbed2f99 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -251,6 +251,30 @@ mlx5_dev_stop(struct rte_eth_dev *dev) int priv_dev_traffic_enable(struct priv *priv, struct rte_eth_dev *dev) { + struct rte_flow_item_eth bcast = { + .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", + }; + struct rte_flow_item_eth ipv6_multi_spec = { + .dst.addr_bytes = "\x33\x33\x00\x00\x00\x00", + }; + struct rte_flow_item_eth ipv6_multi_mask = { + .dst.addr_bytes = "\xff\xff\x00\x00\x00\x00", + }; + struct rte_flow_item_eth unicast = { + .src.addr_bytes = "\x00\x00\x00\x00\x00\x00", + }; + struct rte_flow_item_eth unicast_mask = { + .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", + }; + const unsigned int vlan_filter_n = priv->vlan_filter_n; + const struct ether_addr cmp = { + .addr_bytes = "\x00\x00\x00\x00\x00\x00", + }; + unsigned int i; + unsigned int j; + unsigned int unicast_flow = 0; + int ret; + if (priv->isolated) return 0; if (dev->data->promiscuous) { @@ -261,82 +285,59 @@ priv_dev_traffic_enable(struct priv *priv, struct rte_eth_dev *dev) }; claim_zero(mlx5_ctrl_flow(dev, &promisc, &promisc)); - } else if (dev->data->all_multicast) { + return 0; + } + if (dev->data->all_multicast) { struct rte_flow_item_eth multicast = { .dst.addr_bytes = "\x01\x00\x00\x00\x00\x00", - .src.addr_bytes = "\x01\x00\x00\x00\x00\x00", + .src.addr_bytes = "\x00\x00\x00\x00\x00\x00", .type = 0, }; claim_zero(mlx5_ctrl_flow(dev, &multicast, &multicast)); - } else { - struct rte_flow_item_eth bcast = { - .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", - }; - struct rte_flow_item_eth ipv6_multi_spec = { - .dst.addr_bytes = "\x33\x33\x00\x00\x00\x00", - }; - struct rte_flow_item_eth ipv6_multi_mask = { - .dst.addr_bytes = "\xff\xff\x00\x00\x00\x00", - }; - struct rte_flow_item_eth unicast = { - .src.addr_bytes = "\x00\x00\x00\x00\x00\x00", - }; - struct rte_flow_item_eth unicast_mask = { - .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", - }; - const unsigned int vlan_filter_n = priv->vlan_filter_n; - const struct ether_addr cmp = { - .addr_bytes = "\x00\x00\x00\x00\x00\x00", - }; - unsigned int i; - unsigned int j; - unsigned int unicast_flow = 0; - int ret; - - for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { - struct ether_addr *mac = &dev->data->mac_addrs[i]; + } + for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { + struct ether_addr *mac = &dev->data->mac_addrs[i]; - if (!memcmp(mac, &cmp, sizeof(*mac))) - continue; - memcpy(&unicast.dst.addr_bytes, - mac->addr_bytes, - ETHER_ADDR_LEN); - for (j = 0; j != vlan_filter_n; ++j) { - uint16_t vlan = priv->vlan_filter[j]; + if (!memcmp(mac, &cmp, sizeof(*mac))) + continue; + memcpy(&unicast.dst.addr_bytes, + mac->addr_bytes, + ETHER_ADDR_LEN); + for (j = 0; j != vlan_filter_n; ++j) { + uint16_t vlan = priv->vlan_filter[j]; - struct rte_flow_item_vlan vlan_spec = { - .tci = rte_cpu_to_be_16(vlan), - }; - struct rte_flow_item_vlan vlan_mask = { - .tci = 0xffff, - }; + struct rte_flow_item_vlan vlan_spec = { + .tci = rte_cpu_to_be_16(vlan), + }; + struct rte_flow_item_vlan vlan_mask = { + .tci = 0xffff, + }; - ret = mlx5_ctrl_flow_vlan(dev, &unicast, - &unicast_mask, - &vlan_spec, - &vlan_mask); - if (ret) - goto error; - unicast_flow = 1; - } - if (!vlan_filter_n) { - ret = mlx5_ctrl_flow(dev, &unicast, - &unicast_mask); - if (ret) - goto error; - unicast_flow = 1; - } + ret = mlx5_ctrl_flow_vlan(dev, &unicast, + &unicast_mask, + &vlan_spec, + &vlan_mask); + if (ret) + goto error; + unicast_flow = 1; + } + if (!vlan_filter_n) { + ret = mlx5_ctrl_flow(dev, &unicast, + &unicast_mask); + if (ret) + goto error; + unicast_flow = 1; } - if (!unicast_flow) - return 0; - ret = mlx5_ctrl_flow(dev, &bcast, &bcast); - if (ret) - goto error; - ret = mlx5_ctrl_flow(dev, &ipv6_multi_spec, &ipv6_multi_mask); - if (ret) - goto error; } + if (!unicast_flow) + return 0; + ret = mlx5_ctrl_flow(dev, &bcast, &bcast); + if (ret) + goto error; + ret = mlx5_ctrl_flow(dev, &ipv6_multi_spec, &ipv6_multi_mask); + if (ret) + goto error; return 0; error: return rte_errno; -- 2.11.0