From: Ian Stokes <ian.stokes@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, Ian Stokes <ian.stokes@intel.com>
Subject: [PATCH] net/ice: fix use of ice_bitmap_t in promisc functions
Date: Tue, 2 Jul 2024 13:21:27 +0100 [thread overview]
Message-ID: <20240702122127.22401-1-ian.stokes@intel.com> (raw)
Promisc functions were modified to use ice_bitmap_t.
However use of ice_bitmap_t requires specific helper
functions to ensure correctness.
Fix this by adding correct calls to declare, zero and set
ice_bitmap_t within the promisc functions.
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
drivers/net/ice/ice_ethdev.c | 59 +++++++++++++++++++++++-------------
1 file changed, 38 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index f7189b2dfe..23f14d7c42 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3807,7 +3807,8 @@ ice_dev_start(struct rte_eth_dev *dev)
uint8_t timer = hw->func_caps.ts_func_info.tmr_index_owned;
uint32_t pin_idx = ad->devargs.pin_idx;
struct rte_tm_error tm_err;
- ice_bitmap_t pmask;
+ ice_declare_bitmap(pmask, ICE_PROMISC_MAX);
+ ice_zero_bitmap(pmask, ICE_PROMISC_MAX);
/* program Tx queues' context in hardware */
for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) {
@@ -3864,9 +3865,12 @@ ice_dev_start(struct rte_eth_dev *dev)
return -EIO;
/* Enable receiving broadcast packets and transmitting packets */
- pmask = ICE_PROMISC_BCAST_RX | ICE_PROMISC_BCAST_TX |
- ICE_PROMISC_UCAST_TX | ICE_PROMISC_MCAST_TX;
- ret = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0);
+ ice_set_bit(ICE_PROMISC_BCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_BCAST_TX, pmask);
+ ice_set_bit(ICE_PROMISC_UCAST_TX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_TX, pmask);
+
+ ret = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
if (ret != ICE_SUCCESS)
PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
@@ -5211,12 +5215,15 @@ ice_promisc_enable(struct rte_eth_dev *dev)
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_vsi *vsi = pf->main_vsi;
int status, ret = 0;
- ice_bitmap_t pmask;
+ ice_declare_bitmap(pmask, ICE_PROMISC_MAX);
+ ice_zero_bitmap(pmask, ICE_PROMISC_MAX);
- pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
- ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+ ice_set_bit(ICE_PROMISC_UCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_UCAST_TX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_TX, pmask);
- status = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0);
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
switch (status) {
case ICE_ERR_ALREADY_EXISTS:
PMD_DRV_LOG(DEBUG, "Promisc mode has already been enabled");
@@ -5237,15 +5244,21 @@ ice_promisc_disable(struct rte_eth_dev *dev)
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_vsi *vsi = pf->main_vsi;
int status, ret = 0;
- ice_bitmap_t pmask;
+ ice_declare_bitmap(pmask, ICE_PROMISC_MAX);
+ ice_zero_bitmap(pmask, ICE_PROMISC_MAX);
- if (dev->data->all_multicast == 1)
- pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX;
- else
- pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
- ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+ if (dev->data->all_multicast == 1) {
+ ice_set_bit(ICE_PROMISC_UCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_UCAST_TX, pmask);
+ }
+ else {
+ ice_set_bit(ICE_PROMISC_UCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_UCAST_TX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_TX, pmask);
+ }
- status = ice_clear_vsi_promisc(hw, vsi->idx, &pmask, 0);
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
if (status != ICE_SUCCESS) {
PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
ret = -EAGAIN;
@@ -5261,11 +5274,13 @@ ice_allmulti_enable(struct rte_eth_dev *dev)
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_vsi *vsi = pf->main_vsi;
int status, ret = 0;
- ice_bitmap_t pmask;
+ ice_declare_bitmap(pmask, ICE_PROMISC_MAX);
+ ice_zero_bitmap(pmask, ICE_PROMISC_MAX);
- pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+ ice_set_bit(ICE_PROMISC_MCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_TX, pmask);
- status = ice_set_vsi_promisc(hw, vsi->idx, &pmask, 0);
+ status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
switch (status) {
case ICE_ERR_ALREADY_EXISTS:
@@ -5287,14 +5302,16 @@ ice_allmulti_disable(struct rte_eth_dev *dev)
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_vsi *vsi = pf->main_vsi;
int status, ret = 0;
- ice_bitmap_t pmask;
+ ice_declare_bitmap(pmask, ICE_PROMISC_MAX);
+ ice_zero_bitmap(pmask, ICE_PROMISC_MAX);
if (dev->data->promiscuous == 1)
return 0; /* must remain in all_multicast mode */
- pmask = ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
+ ice_set_bit(ICE_PROMISC_MCAST_RX, pmask);
+ ice_set_bit(ICE_PROMISC_MCAST_TX, pmask);
- status = ice_clear_vsi_promisc(hw, vsi->idx, &pmask, 0);
+ status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
if (status != ICE_SUCCESS) {
PMD_DRV_LOG(ERR, "Failed to clear allmulti, err=%d", status);
ret = -EAGAIN;
--
2.34.1
next reply other threads:[~2024-07-02 12:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 12:21 Ian Stokes [this message]
2024-07-02 12:24 ` [PATCH] net/ice: fix use of ice_bitmap_t in promisc functions Stokes, Ian
2024-07-02 12:27 ` Bruce Richardson
2024-07-02 13:46 ` Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240702122127.22401-1-ian.stokes@intel.com \
--to=ian.stokes@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.