]> git.droids-corp.org - dpdk.git/commitdiff
net/ice: support DCF promiscuous configuration
authorAlvin Zhang <alvinx.zhang@intel.com>
Fri, 29 Apr 2022 09:19:52 +0000 (09:19 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Mon, 9 May 2022 01:54:24 +0000 (03:54 +0200)
Support configuration of unicast and multicast promisc on dcf.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
doc/guides/nics/features/ice_dcf.ini
doc/guides/rel_notes/release_22_07.rst
drivers/net/ice/ice_dcf_ethdev.c
drivers/net/ice/ice_dcf_ethdev.h

index be34ab4692c9f902b7d3353fb23e3ee6b1cb0b70..fe3ada8733880820e2e6b6859dd0c0b05259152b 100644 (file)
@@ -18,6 +18,8 @@ Inner L4 checksum    = P
 RSS reta update      = Y
 RSS key update       = Y
 MTU update           = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
 Basic stats          = Y
 Linux                = Y
 x86-32               = Y
index c29f3d57d0318624e0a0e046e682508bed21637a..285e3796968edfaad72330ae78e475ce0a3b60be 100644 (file)
@@ -71,6 +71,7 @@ New Features
  * Added support for RSS RETA configure in DCF mode.
  * Added support for RSS HASH configure in DCF mode.
  * Added support for MTU configure in DCF mode.
+ * Added support for promisc configuration in DCF mode.
 
 * **Updated Mellanox mlx5 driver.**
 
index 6a577a65829611200a19d57d92972a3d1647064e..87d281ee93fdda53046673a4bf3bfd5b2a488bc3 100644 (file)
@@ -727,27 +727,95 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev,
 }
 
 static int
-ice_dcf_dev_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+dcf_config_promisc(struct ice_dcf_adapter *adapter,
+                  bool enable_unicast,
+                  bool enable_multicast)
 {
+       struct ice_dcf_hw *hw = &adapter->real_hw;
+       struct virtchnl_promisc_info promisc;
+       struct dcf_virtchnl_cmd args;
+       int err;
+
+       promisc.flags = 0;
+       promisc.vsi_id = hw->vsi_res->vsi_id;
+
+       if (enable_unicast)
+               promisc.flags |= FLAG_VF_UNICAST_PROMISC;
+
+       if (enable_multicast)
+               promisc.flags |= FLAG_VF_MULTICAST_PROMISC;
+
+       memset(&args, 0, sizeof(args));
+       args.v_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
+       args.req_msg = (uint8_t *)&promisc;
+       args.req_msglen = sizeof(promisc);
+
+       err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+       if (err) {
+               PMD_DRV_LOG(ERR,
+                           "fail to execute command VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE");
+               return err;
+       }
+
+       adapter->promisc_unicast_enabled = enable_unicast;
+       adapter->promisc_multicast_enabled = enable_multicast;
        return 0;
 }
 
+static int
+ice_dcf_dev_promiscuous_enable(__rte_unused struct rte_eth_dev *dev)
+{
+       struct ice_dcf_adapter *adapter = dev->data->dev_private;
+
+       if (adapter->promisc_unicast_enabled) {
+               PMD_DRV_LOG(INFO, "promiscuous has been enabled");
+               return 0;
+       }
+
+       return dcf_config_promisc(adapter, true,
+                                 adapter->promisc_multicast_enabled);
+}
+
 static int
 ice_dcf_dev_promiscuous_disable(__rte_unused struct rte_eth_dev *dev)
 {
-       return 0;
+       struct ice_dcf_adapter *adapter = dev->data->dev_private;
+
+       if (!adapter->promisc_unicast_enabled) {
+               PMD_DRV_LOG(INFO, "promiscuous has been disabled");
+               return 0;
+       }
+
+       return dcf_config_promisc(adapter, false,
+                                 adapter->promisc_multicast_enabled);
 }
 
 static int
 ice_dcf_dev_allmulticast_enable(__rte_unused struct rte_eth_dev *dev)
 {
-       return 0;
+       struct ice_dcf_adapter *adapter = dev->data->dev_private;
+
+       if (adapter->promisc_multicast_enabled) {
+               PMD_DRV_LOG(INFO, "allmulticast has been enabled");
+               return 0;
+       }
+
+       return dcf_config_promisc(adapter, adapter->promisc_unicast_enabled,
+                                 true);
 }
 
 static int
 ice_dcf_dev_allmulticast_disable(__rte_unused struct rte_eth_dev *dev)
 {
-       return 0;
+       struct ice_dcf_adapter *adapter = dev->data->dev_private;
+
+       if (!adapter->promisc_multicast_enabled) {
+               PMD_DRV_LOG(INFO, "allmulticast has been disabled");
+               return 0;
+       }
+
+       return dcf_config_promisc(adapter, adapter->promisc_unicast_enabled,
+                                 false);
 }
 
 static int
@@ -1299,6 +1367,7 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev)
                return -1;
        }
 
+       dcf_config_promisc(adapter, false, false);
        return 0;
 }
 
index f2faf26f58e58fb678dec2d67422eec52e625b77..22e450527bc5c5ce8b5764bee6680e23653bc051 100644 (file)
@@ -33,6 +33,9 @@ struct ice_dcf_adapter {
        struct ice_adapter parent; /* Must be first */
        struct ice_dcf_hw real_hw;
 
+       bool promisc_unicast_enabled;
+       bool promisc_multicast_enabled;
+
        int num_reprs;
        struct ice_dcf_repr_info *repr_infos;
 };