From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 24F822BBF for ; Thu, 3 Mar 2016 15:27:10 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id l68so37385259wml.0 for ; Thu, 03 Mar 2016 06:27:10 -0800 (PST) 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=dW9ZzcqFxyqPb3RIPQ6PabTTivGkTPn1PCA0ptToFco=; b=WsvHAIS5io4Pc88EbBZU25dhhqBp9/FmmC2qMBBxYtYOm+wZ7O/oSzuWrpLmJGaRtp nCL1SUYLF12HAdSNfMdsPCeTskSBaa6D3bVVMCDBdhuBcdT8j0BiqjHT5JELZR2ooFl9 94ERL8xeTInk5xndA5Hz9NTZ+uYce67GQNIMUEcmCReTcBv/1uKV3/b8xRUkqxDTdpuZ iIYSxHn71O7ycmpc99dZlrgilG/rPYjIXLtVb8hag4ktUnNE3nbw84LIaW9WGnr0BWkR 2VRKzSlSvKVjfXEQqQO5SGO+WgyYWNRGuG9il7TLnxCMtqwwPzyogBByle6hMvqtwrJb /R7A== 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=dW9ZzcqFxyqPb3RIPQ6PabTTivGkTPn1PCA0ptToFco=; b=lshOnm5DCrXNPUuahY2GtVGYa1x4Ulrkg19TyPBwn5tHNJC7xyVqGZJErBocNw5vao dsef3CSpf23ZJqiNI9gfXHKO8ffoP7y0M6UWsoP7mcxiOSqRKvlpSK9wrZb5KIXz1I1B 3KL0UVXd8aW4vtUzQ769UaAsMNNxT+eM6n8GI5mORqoywJfm+sYHPqoWeEAQdjqNM2Fp Hx/OmOSavYo4KPu2JNQUi/9Vr041nQFS5eX7biO9qpoYVS8AY7QPgsSr7rz7rSS1j9/m usE3UcogFL9eWmrfFZijLKnb+mUYN0nVWFt+OQ4TGmDf9kTUizZz5KJ4CVcxP1eoQcik tg1w== X-Gm-Message-State: AD7BkJKYL7X3UhrQ1Zw3QP7MAIRTz46l8TuqzeE2rH5Nc9wg07EYufG6WpfdjCTXt/d8tqG0 X-Received: by 10.28.125.86 with SMTP id y83mr2031063wmc.27.1457015229574; Thu, 03 Mar 2016 06:27:09 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id b1sm40815820wjy.0.2016.03.03.06.27.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2016 06:27:08 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 3 Mar 2016 15:26:41 +0100 Message-Id: <1457015204-2941-3-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457015204-2941-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456164127-28072-1-git-send-email-adrien.mazarguil@6wind.com> <1457015204-2941-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH v3 2/5] mlx5: add special flows (broadcast and IPv6 multicast) 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: Thu, 03 Mar 2016 14:27:10 -0000 From: Yaacov Hazan Until now, broadcast frames were handled like unicast. Moving the related flow to the special flows table frees up the related unicast MAC entry. The same method is used to handle IPv6 multicast frames. Signed-off-by: Yaacov Hazan Signed-off-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5.c | 7 +++---- drivers/net/mlx5/mlx5_defs.h | 2 +- drivers/net/mlx5/mlx5_ethdev.c | 3 +-- drivers/net/mlx5/mlx5_mac.c | 6 ++---- drivers/net/mlx5/mlx5_rxmode.c | 24 ++++++++++++++++++++++++ drivers/net/mlx5/mlx5_rxq.c | 10 ++++++++++ drivers/net/mlx5/mlx5_rxtx.h | 6 ++++++ drivers/net/mlx5/mlx5_trigger.c | 4 ++++ 8 files changed, 51 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 52bf4b2..cf7c4a5 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -90,6 +90,8 @@ mlx5_dev_close(struct rte_eth_dev *dev) priv_dev_interrupt_handler_uninstall(priv, dev); priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI); priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC); + priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST); + priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI); priv_mac_addrs_disable(priv); priv_destroy_hash_rxqs(priv); /* Prevent crashes when queues are still in use. */ @@ -416,13 +418,10 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2], mac.addr_bytes[3], mac.addr_bytes[4], mac.addr_bytes[5]); - /* Register MAC and broadcast addresses. */ + /* Register MAC address. */ claim_zero(priv_mac_addr_add(priv, 0, (const uint8_t (*)[ETHER_ADDR_LEN]) mac.addr_bytes)); - claim_zero(priv_mac_addr_add(priv, (RTE_DIM(priv->mac) - 1), - &(const uint8_t [ETHER_ADDR_LEN]) - { "\xff\xff\xff\xff\xff\xff" })); #ifndef NDEBUG { char ifname[IF_NAMESIZE]; diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h index 1ec14ef..67c3948 100644 --- a/drivers/net/mlx5/mlx5_defs.h +++ b/drivers/net/mlx5/mlx5_defs.h @@ -44,7 +44,7 @@ #define MLX5_MAX_VLAN_IDS 128 /* Maximum number of special flows. */ -#define MLX5_MAX_SPECIAL_FLOWS 2 +#define MLX5_MAX_SPECIAL_FLOWS 4 /* Request send completion once in every 64 sends, might be less. */ #define MLX5_PMD_TX_PER_COMP_REQ 64 diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 1159fa3..6704382 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -501,8 +501,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) max = 65535; info->max_rx_queues = max; info->max_tx_queues = max; - /* Last array entry is reserved for broadcast. */ - info->max_mac_addrs = (RTE_DIM(priv->mac) - 1); + info->max_mac_addrs = RTE_DIM(priv->mac); info->rx_offload_capa = (priv->hw_csum ? (DEV_RX_OFFLOAD_IPV4_CKSUM | diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index b1f34d9..a1a7ff5 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -212,8 +212,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) priv_lock(priv); DEBUG("%p: removing MAC address from index %" PRIu32, (void *)dev, index); - /* Last array entry is reserved for broadcast. */ - if (index >= (RTE_DIM(priv->mac) - 1)) + if (index >= RTE_DIM(priv->mac)) goto end; priv_mac_addr_del(priv, index); end: @@ -479,8 +478,7 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, priv_lock(priv); DEBUG("%p: adding MAC address at index %" PRIu32, (void *)dev, index); - /* Last array entry is reserved for broadcast. */ - if (index >= (RTE_DIM(priv->mac) - 1)) + if (index >= RTE_DIM(priv->mac)) goto end; priv_mac_addr_add(priv, index, (const uint8_t (*)[ETHER_ADDR_LEN]) diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index b2ed17e..6ee7ce3 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -88,6 +88,30 @@ static const struct special_flow_init special_flow_init[] = { 1 << HASH_RXQ_ETH | 0, }, + [HASH_RXQ_FLOW_TYPE_BROADCAST] = { + .dst_mac_val = "\xff\xff\xff\xff\xff\xff", + .dst_mac_mask = "\xff\xff\xff\xff\xff\xff", + .hash_types = + 1 << HASH_RXQ_UDPV4 | + 1 << HASH_RXQ_IPV4 | +#ifdef HAVE_FLOW_SPEC_IPV6 + 1 << HASH_RXQ_UDPV6 | + 1 << HASH_RXQ_IPV6 | +#endif /* HAVE_FLOW_SPEC_IPV6 */ + 1 << HASH_RXQ_ETH | + 0, + }, +#ifdef HAVE_FLOW_SPEC_IPV6 + [HASH_RXQ_FLOW_TYPE_IPV6MULTI] = { + .dst_mac_val = "\x33\x33\x00\x00\x00\x00", + .dst_mac_mask = "\xff\xff\x00\x00\x00\x00", + .hash_types = + 1 << HASH_RXQ_UDPV6 | + 1 << HASH_RXQ_IPV6 | + 1 << HASH_RXQ_ETH | + 0, + }, +#endif /* HAVE_FLOW_SPEC_IPV6 */ }; /** diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 166516a..fcf192a 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -579,8 +579,18 @@ priv_allow_flow_type(struct priv *priv, enum hash_rxq_flow_type type) return !!priv->promisc_req; case HASH_RXQ_FLOW_TYPE_ALLMULTI: return !!priv->allmulti_req; + case HASH_RXQ_FLOW_TYPE_BROADCAST: +#ifdef HAVE_FLOW_SPEC_IPV6 + case HASH_RXQ_FLOW_TYPE_IPV6MULTI: +#endif /* HAVE_FLOW_SPEC_IPV6 */ + /* If allmulti is enabled, broadcast and ipv6multi + * are unnecessary. */ + return !priv->allmulti_req; case HASH_RXQ_FLOW_TYPE_MAC: return 1; + default: + /* Unsupported flow type is not allowed. */ + return 0; } return 0; } diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 983e6a4..d5a5019 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -186,6 +186,8 @@ struct special_flow_init { enum hash_rxq_flow_type { HASH_RXQ_FLOW_TYPE_PROMISC, HASH_RXQ_FLOW_TYPE_ALLMULTI, + HASH_RXQ_FLOW_TYPE_BROADCAST, + HASH_RXQ_FLOW_TYPE_IPV6MULTI, HASH_RXQ_FLOW_TYPE_MAC, }; @@ -198,6 +200,10 @@ hash_rxq_flow_type_str(enum hash_rxq_flow_type flow_type) return "promiscuous"; case HASH_RXQ_FLOW_TYPE_ALLMULTI: return "allmulticast"; + case HASH_RXQ_FLOW_TYPE_BROADCAST: + return "broadcast"; + case HASH_RXQ_FLOW_TYPE_IPV6MULTI: + return "IPv6 multicast"; case HASH_RXQ_FLOW_TYPE_MAC: return "MAC"; } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index d9f7d00..90b8068 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -80,6 +80,8 @@ mlx5_dev_start(struct rte_eth_dev *dev) " %s", (void *)priv, strerror(err)); /* Rollback. */ + priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI); + priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST); priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI); priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC); priv_mac_addrs_disable(priv); @@ -109,6 +111,8 @@ mlx5_dev_stop(struct rte_eth_dev *dev) return; } DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev); + priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI); + priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST); priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI); priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC); priv_mac_addrs_disable(priv); -- 2.1.4