From 6a6b6828fe6a08a9ab3cd91c2d21e23312095554 Mon Sep 17 00:00:00 2001 From: =?utf8?q?N=C3=A9lio=20Laranjeiro?= Date: Mon, 9 Oct 2017 16:44:54 +0200 Subject: [PATCH] net/mlx5: use flow to enable all multi mode RSS hash configuration is currently ignored by the PMD, this commits removes the RSS feature on promiscuous mode. This functionality will be added in a later commit. Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5.h | 1 - drivers/net/mlx5/mlx5_rxmode.c | 52 ++++++++++++--------------------- drivers/net/mlx5/mlx5_rxq.c | 7 ++--- drivers/net/mlx5/mlx5_rxtx.h | 3 -- drivers/net/mlx5/mlx5_trigger.c | 2 ++ 5 files changed, 22 insertions(+), 43 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 2699917643..45673b1d9a 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -108,7 +108,6 @@ struct priv { /* Device properties. */ uint16_t mtu; /* Configured MTU. */ uint8_t port; /* Physical port number. */ - unsigned int allmulti_req:1; /* All multicast mode requested. */ unsigned int hw_csum:1; /* Checksum offload is supported. */ unsigned int hw_csum_l2tun:1; /* Same for L2 tunnels. */ unsigned int hw_vlan_strip:1; /* VLAN stripping is supported. */ diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index f469f41089..0c75889064 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -53,18 +53,6 @@ /* Initialization data for special flows. */ static const struct special_flow_init special_flow_init[] = { - [HASH_RXQ_FLOW_TYPE_ALLMULTI] = { - .dst_mac_val = "\x01\x00\x00\x00\x00\x00", - .dst_mac_mask = "\x01\x00\x00\x00\x00\x00", - .hash_types = - 1 << HASH_RXQ_UDPV4 | - 1 << HASH_RXQ_IPV4 | - 1 << HASH_RXQ_UDPV6 | - 1 << HASH_RXQ_IPV6 | - 1 << HASH_RXQ_ETH | - 0, - .per_vlan = 0, - }, [HASH_RXQ_FLOW_TYPE_BROADCAST] = { .dst_mac_val = "\xff\xff\xff\xff\xff\xff", .dst_mac_mask = "\xff\xff\xff\xff\xff\xff", @@ -332,7 +320,7 @@ priv_special_flow_enable_all(struct priv *priv) if (priv->isolated) return 0; - for (flow_type = HASH_RXQ_FLOW_TYPE_ALLMULTI; + for (flow_type = HASH_RXQ_FLOW_TYPE_BROADCAST; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) { int ret; @@ -359,7 +347,7 @@ priv_special_flow_disable_all(struct priv *priv) { enum hash_rxq_flow_type flow_type; - for (flow_type = HASH_RXQ_FLOW_TYPE_ALLMULTI; + for (flow_type = HASH_RXQ_FLOW_TYPE_BROADCAST; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) priv_special_flow_disable(priv, flow_type); @@ -416,19 +404,17 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev) void mlx5_allmulticast_enable(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; - int ret; + struct rte_flow_item_eth eth = { + .dst.addr_bytes = "\x01\x00\x00\x00\x00\x00", + .src.addr_bytes = "\x01\x00\x00\x00\x00\x00", + .type = 0, + }; if (mlx5_is_secondary()) return; - - priv_lock(priv); - priv->allmulti_req = 1; - ret = priv_rehash_flows(priv); - if (ret) - ERROR("error while enabling allmulticast mode: %s", - strerror(ret)); - priv_unlock(priv); + dev->data->all_multicast = 1; + if (dev->data->dev_started) + claim_zero(mlx5_ctrl_flow(dev, ð, ð, 1)); } /** @@ -440,17 +426,15 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev) void mlx5_allmulticast_disable(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; - int ret; + struct rte_flow_item_eth eth = { + .dst.addr_bytes = "\x01\x00\x00\x00\x00\x00", + .src.addr_bytes = "\x01\x00\x00\x00\x00\x00", + .type = 0, + }; if (mlx5_is_secondary()) return; - - priv_lock(priv); - priv->allmulti_req = 0; - ret = priv_rehash_flows(priv); - if (ret) - ERROR("error while disabling allmulticast mode: %s", - strerror(ret)); - priv_unlock(priv); + dev->data->all_multicast = 0; + if (dev->data->dev_started) + claim_zero(mlx5_ctrl_flow(dev, ð, ð, 0)); } diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index d3d13555b1..d3cd58e3bb 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -571,16 +571,13 @@ priv_destroy_hash_rxqs(struct priv *priv) int priv_allow_flow_type(struct priv *priv, enum hash_rxq_flow_type type) { + (void)priv; switch (type) { - case HASH_RXQ_FLOW_TYPE_ALLMULTI: - return !!priv->allmulti_req; case HASH_RXQ_FLOW_TYPE_BROADCAST: case HASH_RXQ_FLOW_TYPE_IPV6MULTI: - /* If allmulti is enabled, broadcast and ipv6multi - * are unnecessary. */ - return !priv->allmulti_req; case HASH_RXQ_FLOW_TYPE_MAC: return 1; + return 1; default: /* Unsupported flow type is not allowed. */ return 0; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index ffba64e81c..6f474d2bfc 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -237,7 +237,6 @@ struct special_flow_init { }; enum hash_rxq_flow_type { - HASH_RXQ_FLOW_TYPE_ALLMULTI, HASH_RXQ_FLOW_TYPE_BROADCAST, HASH_RXQ_FLOW_TYPE_IPV6MULTI, HASH_RXQ_FLOW_TYPE_MAC, @@ -248,8 +247,6 @@ static inline const char * hash_rxq_flow_type_str(enum hash_rxq_flow_type flow_type) { switch (flow_type) { - case HASH_RXQ_FLOW_TYPE_ALLMULTI: - return "allmulticast"; case HASH_RXQ_FLOW_TYPE_BROADCAST: return "broadcast"; case HASH_RXQ_FLOW_TYPE_IPV6MULTI: diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 085abccb4e..27e789099a 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -165,6 +165,8 @@ mlx5_dev_start(struct rte_eth_dev *dev) } if (dev->data->promiscuous) mlx5_promiscuous_enable(dev); + else if (dev->data->all_multicast) + mlx5_allmulticast_enable(dev); err = priv_flow_start(priv, &priv->ctrl_flows); if (err) { ERROR("%p: an error occurred while configuring control flows:" -- 2.20.1