net/ixgbe/base: move multicast mode update
This patch adds update_xcast_mode callback in mac ops, and moves ixgbevf_update_xcast_mode function into base code. Signed-off-by: Xiao Wang <xiao.w.wang@intel.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
This commit is contained in:
parent
c3fb605491
commit
260e2e22e2
@ -111,7 +111,7 @@ enum ixgbe_pfvf_api_rev {
|
||||
/* mailbox API, version 1.2 VF requests */
|
||||
#define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */
|
||||
#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS key */
|
||||
#define IXGBE_VF_UPDATE_XCAST_MODE 0x0C
|
||||
#define IXGBE_VF_UPDATE_XCAST_MODE 0x0c
|
||||
|
||||
/* GET_QUEUES return data indices within the mailbox */
|
||||
#define IXGBE_VF_TX_QUEUES 1 /* number of Tx queues supported */
|
||||
|
@ -3883,6 +3883,7 @@ struct ixgbe_mac_operations {
|
||||
s32 (*init_uta_tables)(struct ixgbe_hw *);
|
||||
void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
|
||||
void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
|
||||
s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
|
||||
|
||||
/* Flow Control */
|
||||
s32 (*fc_enable)(struct ixgbe_hw *);
|
||||
|
@ -75,6 +75,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
|
||||
hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf;
|
||||
hw->mac.ops.init_rx_addrs = NULL;
|
||||
hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
|
||||
hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode;
|
||||
hw->mac.ops.enable_mc = NULL;
|
||||
hw->mac.ops.disable_mc = NULL;
|
||||
hw->mac.ops.clear_vfta = NULL;
|
||||
@ -418,6 +419,43 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
|
||||
return mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbevf_update_xcast_mode - Update Multicast mode
|
||||
* @hw: pointer to the HW structure
|
||||
* @xcast_mode: new multicast mode
|
||||
*
|
||||
* Updates the Multicast Mode of VF.
|
||||
**/
|
||||
s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[2];
|
||||
s32 err;
|
||||
|
||||
switch (hw->api_version) {
|
||||
case ixgbe_mbox_api_12:
|
||||
break;
|
||||
default:
|
||||
return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
|
||||
msgbuf[1] = xcast_mode;
|
||||
|
||||
err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
|
||||
if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
|
||||
return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_set_vfta_vf - Set/Unset vlan filter table address
|
||||
* @hw: pointer to the HW structure
|
||||
|
@ -131,6 +131,7 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr);
|
||||
s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
|
||||
u32 mc_addr_count, ixgbe_mc_addr_itr,
|
||||
bool clear);
|
||||
s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
|
||||
s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
|
||||
bool vlan_on, bool vlvf_bypass);
|
||||
void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
|
||||
|
@ -7271,51 +7271,12 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ixgbevf_update_xcast_mode - Update Multicast mode
|
||||
* @hw: pointer to the HW structure
|
||||
* @netdev: pointer to net device structure
|
||||
* @xcast_mode: new multicast mode
|
||||
*
|
||||
* Updates the Multicast Mode of VF.
|
||||
*/
|
||||
static int ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,
|
||||
int xcast_mode)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[2];
|
||||
s32 err;
|
||||
|
||||
switch (hw->api_version) {
|
||||
case ixgbe_mbox_api_12:
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
|
||||
msgbuf[1] = xcast_mode;
|
||||
|
||||
err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
|
||||
if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
|
||||
return -EPERM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
|
||||
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
|
||||
hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7323,7 +7284,7 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
|
||||
|
||||
ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
|
||||
hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
|
||||
}
|
||||
|
||||
static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
|
||||
|
Loading…
x
Reference in New Issue
Block a user