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.sto...@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

Reply via email to