/* RAR, Multicast, VLAN */
mac->set_rar = txgbe_set_rar_vf;
mac->set_uc_addr = txgbevf_set_uc_addr_vf;
+ mac->update_xcast_mode = txgbevf_update_xcast_mode;
mac->set_vfta = txgbe_set_vfta_vf;
mac->set_rlpml = txgbevf_rlpml_set_vf;
return ret_val;
}
+/**
+ * txgbevf_update_xcast_mode - Update Multicast mode
+ * @hw: pointer to the HW structure
+ * @xcast_mode: new multicast mode
+ *
+ * Updates the Multicast Mode of VF.
+ **/
+s32 txgbevf_update_xcast_mode(struct txgbe_hw *hw, int xcast_mode)
+{
+ u32 msgbuf[2];
+ s32 err;
+
+ switch (hw->api_version) {
+ case txgbe_mbox_api_12:
+ /* New modes were introduced in 1.3 version */
+ if (xcast_mode > TXGBEVF_XCAST_MODE_ALLMULTI)
+ return TXGBE_ERR_FEATURE_NOT_SUPPORTED;
+ /* Fall through */
+ case txgbe_mbox_api_13:
+ break;
+ default:
+ return TXGBE_ERR_FEATURE_NOT_SUPPORTED;
+ }
+
+ msgbuf[0] = TXGBE_VF_UPDATE_XCAST_MODE;
+ msgbuf[1] = xcast_mode;
+
+ err = txgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+ if (err)
+ return err;
+
+ msgbuf[0] &= ~TXGBE_VT_MSGTYPE_CTS;
+ if (msgbuf[0] == (TXGBE_VF_UPDATE_XCAST_MODE | TXGBE_VT_MSGTYPE_NACK))
+ return TXGBE_ERR_FEATURE_NOT_SUPPORTED;
+ return 0;
+}
+
/**
* txgbe_set_vfta_vf - Set/Unset vlan filter table address
* @hw: pointer to the HW structure
s32 txgbe_set_rar_vf(struct txgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
u32 enable_addr);
s32 txgbevf_set_uc_addr_vf(struct txgbe_hw *hw, u32 index, u8 *addr);
+s32 txgbevf_update_xcast_mode(struct txgbe_hw *hw, int xcast_mode);
s32 txgbe_set_vfta_vf(struct txgbe_hw *hw, u32 vlan, u32 vind,
bool vlan_on, bool vlvf_bypass);
s32 txgbevf_rlpml_set_vf(struct txgbe_hw *hw, u16 max_size);
static int txgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask);
static void txgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on);
static void txgbevf_configure_msix(struct rte_eth_dev *dev);
+static int txgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int txgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
static void txgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
static void txgbevf_dev_interrupt_handler(void *param);
return -EIO;
}
+ /* enter promiscuous mode */
+ txgbevf_dev_promiscuous_enable(eth_dev);
+
rte_intr_callback_register(intr_handle,
txgbevf_dev_interrupt_handler, eth_dev);
rte_intr_enable(intr_handle);
return 0;
}
+static int
+txgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+ struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
+ int ret;
+
+ switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_PROMISC)) {
+ case 0:
+ ret = 0;
+ break;
+ case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
+ ret = -ENOTSUP;
+ break;
+ default:
+ ret = -EAGAIN;
+ break;
+ }
+
+ return ret;
+}
+
+static int
+txgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+ struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
+ int ret;
+
+ switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_NONE)) {
+ case 0:
+ ret = 0;
+ break;
+ case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
+ ret = -ENOTSUP;
+ break;
+ default:
+ ret = -EAGAIN;
+ break;
+ }
+
+ return ret;
+}
+
+static int
+txgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
+{
+ struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
+ int ret;
+
+ switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_ALLMULTI)) {
+ case 0:
+ ret = 0;
+ break;
+ case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
+ ret = -ENOTSUP;
+ break;
+ default:
+ ret = -EAGAIN;
+ break;
+ }
+
+ return ret;
+}
+
+static int
+txgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
+{
+ struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
+ int ret;
+
+ switch (hw->mac.update_xcast_mode(hw, TXGBEVF_XCAST_MODE_MULTI)) {
+ case 0:
+ ret = 0;
+ break;
+ case TXGBE_ERR_FEATURE_NOT_SUPPORTED:
+ ret = -ENOTSUP;
+ break;
+ default:
+ ret = -EAGAIN;
+ break;
+ }
+
+ return ret;
+}
+
static void txgbevf_mbx_process(struct rte_eth_dev *dev)
{
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
.stats_reset = txgbevf_dev_stats_reset,
.xstats_reset = txgbevf_dev_stats_reset,
.xstats_get_names = txgbevf_dev_xstats_get_names,
+ .promiscuous_enable = txgbevf_dev_promiscuous_enable,
+ .promiscuous_disable = txgbevf_dev_promiscuous_disable,
+ .allmulticast_enable = txgbevf_dev_allmulticast_enable,
+ .allmulticast_disable = txgbevf_dev_allmulticast_disable,
.dev_infos_get = txgbevf_dev_info_get,
.vlan_filter_set = txgbevf_vlan_filter_set,
.vlan_strip_queue_set = txgbevf_vlan_strip_queue_set,