From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9427FA04DC; Mon, 19 Oct 2020 11:11:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0EA56E2AA; Mon, 19 Oct 2020 10:54:08 +0200 (CEST) Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) by dpdk.org (Postfix) with ESMTP id A7C3DCA08 for ; Mon, 19 Oct 2020 10:53:32 +0200 (CEST) X-QQ-mid: bizesmtp6t1603097608t5egjfn1v Received: from localhost.localdomain.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Mon, 19 Oct 2020 16:53:28 +0800 (CST) X-QQ-SSF: 01400000002000C0C000B00A0000000 X-QQ-FEAT: 1WyLoCoLasgIFXSnG/OUNKUz3p5vbN2yKYQsr8AOhqzp+BCr1CM6zsuT3HxZp YDx+HRZiNq1xwM+1/0hlG1xHoNk2IhaZwEGXkxL15SUWYQ7WUtSQJQU5ZdnTJkyeKva6noM Lxw17Sip2t0JvmHYFcfhXbY+XklIsU3+AxbpRI1wnmNj6Chvv4nioz6pC/gB2Gpc8FohBRe 0ODrXKgs5AjJZ1idCO6eLdTHwLyLvhgvb7NPnijDTJOfYt5OTUL57962ofBxfNIHk7wtxJ6 vD0Wc+nZbLqeFCCuGxceLB5OSK9dNYOAiV4LtW3IqaGB8E1b3J3EUQZ4bOSqIoFLn/A6lmr 4rp/Kvi2lPwIMG/Sdw76Ce+X2tq4w== X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Date: Mon, 19 Oct 2020 16:54:04 +0800 Message-Id: <20201019085415.82207-48-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20201019085415.82207-1-jiawenwu@trustnetic.com> References: <20201019085415.82207-1-jiawenwu@trustnetic.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign6 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v4 47/58] net/txgbe: add device promiscuous and allmulticast 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add device promiscuous and allmulticast mode. Signed-off-by: Jiawen Wu --- doc/guides/nics/features/txgbe.ini | 2 + doc/guides/nics/txgbe.rst | 2 + drivers/net/txgbe/txgbe_ethdev.c | 63 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/doc/guides/nics/features/txgbe.ini b/doc/guides/nics/features/txgbe.ini index f69785787..34f8985d5 100644 --- a/doc/guides/nics/features/txgbe.ini +++ b/doc/guides/nics/features/txgbe.ini @@ -13,6 +13,8 @@ Jumbo frame = Y Scattered Rx = Y LRO = Y TSO = Y +Promiscuous mode = Y +Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y RSS hash = Y diff --git a/doc/guides/nics/txgbe.rst b/doc/guides/nics/txgbe.rst index 95919478b..16f786cc4 100644 --- a/doc/guides/nics/txgbe.rst +++ b/doc/guides/nics/txgbe.rst @@ -17,6 +17,8 @@ Features - Checksum offload - VLAN/QinQ stripping and inserting - TSO offload +- Promiscuous mode +- Multicast mode - Port hardware statistics - Jumbo frames - Link state information diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index d0238e5bc..9547938d0 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -2403,6 +2403,65 @@ txgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) return txgbe_dev_link_update_share(dev, wait_to_complete); } +static int +txgbe_dev_promiscuous_enable(struct rte_eth_dev *dev) +{ + struct txgbe_hw *hw = TXGBE_DEV_HW(dev); + uint32_t fctrl; + + fctrl = rd32(hw, TXGBE_PSRCTL); + fctrl |= (TXGBE_PSRCTL_UCP | TXGBE_PSRCTL_MCP); + wr32(hw, TXGBE_PSRCTL, fctrl); + + return 0; +} + +static int +txgbe_dev_promiscuous_disable(struct rte_eth_dev *dev) +{ + struct txgbe_hw *hw = TXGBE_DEV_HW(dev); + uint32_t fctrl; + + fctrl = rd32(hw, TXGBE_PSRCTL); + fctrl &= (~TXGBE_PSRCTL_UCP); + if (dev->data->all_multicast == 1) + fctrl |= TXGBE_PSRCTL_MCP; + else + fctrl &= (~TXGBE_PSRCTL_MCP); + wr32(hw, TXGBE_PSRCTL, fctrl); + + return 0; +} + +static int +txgbe_dev_allmulticast_enable(struct rte_eth_dev *dev) +{ + struct txgbe_hw *hw = TXGBE_DEV_HW(dev); + uint32_t fctrl; + + fctrl = rd32(hw, TXGBE_PSRCTL); + fctrl |= TXGBE_PSRCTL_MCP; + wr32(hw, TXGBE_PSRCTL, fctrl); + + return 0; +} + +static int +txgbe_dev_allmulticast_disable(struct rte_eth_dev *dev) +{ + struct txgbe_hw *hw = TXGBE_DEV_HW(dev); + uint32_t fctrl; + + if (dev->data->promiscuous == 1) + return 0; /* must remain in all_multicast mode */ + + fctrl = rd32(hw, TXGBE_PSRCTL); + fctrl &= (~TXGBE_PSRCTL_MCP); + wr32(hw, TXGBE_PSRCTL, fctrl); + + return 0; +} + /** * It clears the interrupt causes and enables the interrupt. * It will be called once only during nic initialized. @@ -3314,6 +3373,10 @@ static const struct eth_dev_ops txgbe_eth_dev_ops = { .dev_set_link_down = txgbe_dev_set_link_down, .dev_close = txgbe_dev_close, .dev_reset = txgbe_dev_reset, + .promiscuous_enable = txgbe_dev_promiscuous_enable, + .promiscuous_disable = txgbe_dev_promiscuous_disable, + .allmulticast_enable = txgbe_dev_allmulticast_enable, + .allmulticast_disable = txgbe_dev_allmulticast_disable, .link_update = txgbe_dev_link_update, .stats_get = txgbe_dev_stats_get, .xstats_get = txgbe_dev_xstats_get, -- 2.18.4