ixgbevf: Use mac_ops instead of trying to identify NIC type
Subsystems (2)
PATCH 1/1 ixgbevf: Use mac_ops instead of trying to identify NIC type
This change makes it so that we can just use function pointers instead of having to identify if a given VF is running on a Linux or Windows PF. By doing this we can avoid having to pull too much information out of the lower layers and can instead just make use of the mac_ops pointers since they should differ between the two types of VFs anyway.
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 1 - drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 15 +++------------ drivers/net/ethernet/intel/ixgbevf/vf.c | 20 +++++++++----------- drivers/net/ethernet/intel/ixgbevf/vf.h | 4 +--- 4 files changed, 13 insertions(+), 27 deletions(-)
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +0 -1
@@ -495,7 +495,6 @@ void ixgbevf_free_rx_resources(struct ixgbevf_ring *);void ixgbevf_free_tx_resources (struct ixgbevf_ring *);void ixgbevf_update_stats (struct ixgbevf_adapter *adapter);int ethtool_ioctl (struct ifreq *ifr); -bool ixgbevf_on_hyperv (struct ixgbe_hw *hw);extern void ixgbevf_write_eitr (struct ixgbevf_q_vector *q_vector);
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +3 -12
@@ -1809,10 +1809,7 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)ixgbevf_setup_vfmrqc (adapter);/* notify the PF of our intent to use this size of frame */ -if (!ixgbevf_on_hyperv (hw)) -ixgbevf_rlpml_set_vf (hw, netdev->mtu +ETH_HLEN +ETH_FCS_LEN ); -else -ixgbevf_hv_rlpml_set_vf (hw, netdev->mtu +ETH_HLEN +ETH_FCS_LEN ); + hw->mac.ops.set_rlpml (hw, netdev->mtu +ETH_HLEN +ETH_FCS_LEN );/* Setup the HW Rx Head and Tail Descriptor Pointers and * the Base and Length of the Rx Descriptor Ring
@@ -2073,10 +2070,7 @@ static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)spin_lock_bh (&adapter->mbx_lock);while (api[idx] != ixgbe_mbox_api_unknown) { -if (!ixgbevf_on_hyperv (hw)) - err = hw->mac.ops.negotiate_api_version (hw, api[idx]); -else - err =ixgbevf_hv_negotiate_api_version (hw, api[idx]); + err = hw->mac.ops.negotiate_api_version (hw, api[idx]);if (!err)break ; idx++;
@@ -3760,10 +3754,7 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu) netdev->mtu = new_mtu;/* notify the PF of our intent to use this size of frame */ -if (!ixgbevf_on_hyperv (hw)) -ixgbevf_rlpml_set_vf (hw, max_frame); -else -ixgbevf_hv_rlpml_set_vf (hw, max_frame); + hw->mac.ops.set_rlpml (hw, max_frame);return 0 ; }
drivers/net/ethernet/intel/ixgbevf/vf.c +9 -11
@@ -797,11 +797,11 @@ out: }/** -* ixgbevf_rlpml_set_vf - Set the maximum receive packet length +* ixgbevf_set_rlpml_vf - Set the maximum receive packet length * @hw: pointer to the HW structure * @max_size: value to assign to max frame size **/ -void ixgbevf_rlpml_set_vf (struct ixgbe_hw *hw,u16 max_size) +static void ixgbevf_set_rlpml_vf (struct ixgbe_hw *hw,u16 max_size) {u32 msgbuf[2 ];
@@ -811,12 +811,12 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size) }/** -* ixgbevf_hv_rlpml_set_vf - Set the maximum receive packet length +* ixgbevf_hv_set_rlpml_vf - Set the maximum receive packet length * @hw: pointer to the HW structure * @max_size: value to assign to max frame size * Hyper-V variant. **/ -void ixgbevf_hv_rlpml_set_vf (struct ixgbe_hw *hw,u16 max_size) +static void ixgbevf_hv_set_rlpml_vf (struct ixgbe_hw *hw,u16 max_size) {u32 reg;
@@ -864,12 +864,12 @@ static int ixgbevf_negotiate_api_version_vf(struct ixgbe_hw *hw, int api) }/** -* ixgbevf_hv_negotiate_api_version - Negotiate supported API version +* ixgbevf_hv_negotiate_api_version_vf - Negotiate supported API version * @hw: pointer to the HW structure * @api: integer containing requested API version * Hyper-V version - only ixgbe_mbox_api_10 supported. **/ -int ixgbevf_hv_negotiate_api_version (struct ixgbe_hw *hw,int api) +static int ixgbevf_hv_negotiate_api_version_vf (struct ixgbe_hw *hw,int api) {/* Hyper-V only supports api version ixgbe_mbox_api_10 */
@@ -951,6 +951,7 @@ static const struct ixgbe_mac_operations ixgbevf_mac_ops = { .update_xcast_mode = ixgbevf_update_xcast_mode, .set_uc_addr = ixgbevf_set_uc_addr_vf, .set_vfta = ixgbevf_set_vfta_vf, + .set_rlpml = ixgbevf_set_rlpml_vf, };static const struct ixgbe_mac_operations ixgbevf_hv_mac_ops = {
@@ -961,11 +962,13 @@ static const struct ixgbe_mac_operations ixgbevf_hv_mac_ops = { .stop_adapter = ixgbevf_stop_hw_vf, .setup_link = ixgbevf_setup_mac_link_vf, .check_link = ixgbevf_hv_check_mac_link_vf, + .negotiate_api_version = ixgbevf_hv_negotiate_api_version_vf, .set_rar = ixgbevf_hv_set_rar_vf, .update_mc_addr_list = ixgbevf_hv_update_mc_addr_list_vf, .update_xcast_mode = ixgbevf_hv_update_xcast_mode, .set_uc_addr = ixgbevf_hv_set_uc_addr_vf, .set_vfta = ixgbevf_hv_set_vfta_vf, + .set_rlpml = ixgbevf_hv_set_rlpml_vf, };const struct ixgbevf_info ixgbevf_82599_vf_info = {
@@ -1007,8 +1010,3 @@ const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info = { .mac = ixgbe_mac_X550EM_x_vf, .mac_ops = &ixgbevf_hv_mac_ops, }; - -bool ixgbevf_on_hyperv (struct ixgbe_hw *hw) -{ -return hw->mbx.ops.check_for_msg ==NULL ; -}
drivers/net/ethernet/intel/ixgbevf/vf.h +1 -3
@@ -69,6 +69,7 @@ struct ixgbe_mac_operations {s32 (*disable_mc)(struct ixgbe_hw *);s32 (*clear_vfta)(struct ixgbe_hw *);s32 (*set_vfta)(struct ixgbe_hw *,u32 ,u32 ,bool ); +void (*set_rlpml)(struct ixgbe_hw *,u16 ); };enum ixgbe_mac_type {
@@ -208,9 +209,6 @@ static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg,#define IXGBE_READ_REG_ARRAY (h, r, o) ixgbe_read_reg_array(h, r, o) -void ixgbevf_rlpml_set_vf (struct ixgbe_hw *hw,u16 max_size); -void ixgbevf_hv_rlpml_set_vf (struct ixgbe_hw *hw,u16 max_size); -int ixgbevf_hv_negotiate_api_version (struct ixgbe_hw *hw,int api);int ixgbevf_get_queues (struct ixgbe_hw *hw,unsigned int *num_tcs,unsigned int *default_tc);int ixgbevf_get_reta_locked (struct ixgbe_hw *hw,u32 *reta,int num_rx_queues);
Bowers
PATCH 1/1 ixgbevf: Use mac_ops instead of trying to identify NIC type
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Alexander Duyck
Sent: Friday, April 22, 2016 10:18 AM
To: kys at microsoft.com; intel-wired-lan at lists.osuosl.org; Kirsher, Jeffrey T <[email protected]>
Subject: [Intel-wired-lan] [PATCH] ixgbevf: Usemac_opsinstead of trying to identify NIC typeThis change makes it so that we can just use function pointers instead of having to identify if a given VF is running on a Linux or Windows PF. By doing this we can avoid having to pull too much information out of the lower layers and can instead just make use of the
mac_opspointers since they should differ between the two types of VFs anyway.
Quoted 7 lines
Signed-off-by Alexander Duyck <[email protected]>--- drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 1 - drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 15 +++------------ drivers/net/ethernet/intel/ixgbevf/vf.c | 20 +++++++++----------- drivers/net/ethernet/intel/ixgbevf/vf.h | 4 +--- 4 files changed, 13 insertions(+), 27 deletions(-)
Jumbo frames/MTU can still be set on VF