net/ixgbe/base: move X550 MAC ops init into functions

This patch introduces new init_ops functions for X550EM_a and X550EM_x.
This makes it easier to assign function pointers with specific
dependencies (like media type) for each MAC.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
This commit is contained in:
Xiao Wang 2016-09-25 16:59:43 +08:00 committed by Bruce Richardson
parent 260e2e22e2
commit b080425751
3 changed files with 64 additions and 25 deletions

View File

@ -106,8 +106,10 @@ s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
status = ixgbe_init_ops_X550(hw);
break;
case ixgbe_mac_X550EM_x:
status = ixgbe_init_ops_X550EM_x(hw);
break;
case ixgbe_mac_X550EM_a:
status = ixgbe_init_ops_X550EM(hw);
status = ixgbe_init_ops_X550EM_a(hw);
break;
case ixgbe_mac_82599_vf:
case ixgbe_mac_X540_vf:

View File

@ -45,6 +45,8 @@ extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
s32 ixgbe_set_mac_type(struct ixgbe_hw *hw);

View File

@ -604,7 +604,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
struct ixgbe_mac_info *mac = &hw->mac;
struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
struct ixgbe_phy_info *phy = &hw->phy;
struct ixgbe_link_info *link = &hw->link;
s32 ret_val;
DEBUGFUNC("ixgbe_init_ops_X550EM");
@ -640,25 +639,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
hw->bus.type = ixgbe_bus_type_internal;
mac->ops.get_bus_info = ixgbe_get_bus_info_X550em;
if (hw->mac.type == ixgbe_mac_X550EM_x) {
mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
link->ops.read_link = ixgbe_read_i2c_combined_generic;
link->ops.read_link_unlocked =
ixgbe_read_i2c_combined_generic_unlocked;
link->ops.write_link = ixgbe_write_i2c_combined_generic;
link->ops.write_link_unlocked =
ixgbe_write_i2c_combined_generic_unlocked;
link->addr = IXGBE_CS4227;
}
if (hw->mac.type == ixgbe_mac_X550EM_a) {
mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
}
mac->ops.get_media_type = ixgbe_get_media_type_X550em;
mac->ops.setup_sfp = ixgbe_setup_sfp_modules_X550em;
@ -669,10 +649,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper)
mac->ops.setup_fc = ixgbe_setup_fc_generic;
else if (hw->mac.type == ixgbe_mac_X550EM_a) {
mac->ops.setup_fc = ixgbe_setup_fc_x550a;
mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
}
else
mac->ops.setup_fc = ixgbe_setup_fc_X550em;
@ -705,6 +681,65 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
return ret_val;
}
/**
* ixgbe_init_ops_X550EM_a - Inits func ptrs and MAC type
* @hw: pointer to hardware structure
*
* Initialize the function pointers and for MAC type X550EM_a.
* Does not touch the hardware.
**/
s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
{
struct ixgbe_mac_info *mac = &hw->mac;
s32 ret_val;
DEBUGFUNC("ixgbe_init_ops_X550EM_a");
/* Start with generic X550EM init */
ret_val = ixgbe_init_ops_X550EM(hw);
mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
mac->ops.setup_fc = ixgbe_setup_fc_x550a;
mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
return ret_val;
}
/**
* ixgbe_init_ops_X550EM_x - Inits func ptrs and MAC type
* @hw: pointer to hardware structure
*
* Initialize the function pointers and for MAC type X550EM_x.
* Does not touch the hardware.
**/
s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw)
{
struct ixgbe_mac_info *mac = &hw->mac;
struct ixgbe_link_info *link = &hw->link;
s32 ret_val;
DEBUGFUNC("ixgbe_init_ops_X550EM_x");
/* Start with generic X550EM init */
ret_val = ixgbe_init_ops_X550EM(hw);
mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
link->ops.read_link = ixgbe_read_i2c_combined_generic;
link->ops.read_link_unlocked = ixgbe_read_i2c_combined_generic_unlocked;
link->ops.write_link = ixgbe_write_i2c_combined_generic;
link->ops.write_link_unlocked =
ixgbe_write_i2c_combined_generic_unlocked;
link->addr = IXGBE_CS4227;
return ret_val;
}
/**
* ixgbe_dmac_config_X550
* @hw: pointer to hardware structure