X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_pmd_e1000%2Fe1000%2Fe1000_vf.c;h=778561e73ed7768e7abc00a4e0090106bf6f05de;hb=80edfef4a83664ed0c96b13a8c1917a2575d768d;hp=3984c1a7eaaaf06e08c01a60a9acdc7216ca8737;hpb=98cd57841bedf1b1da0a365284ecad586a770a5d;p=dpdk.git diff --git a/lib/librte_pmd_e1000/e1000/e1000_vf.c b/lib/librte_pmd_e1000/e1000/e1000_vf.c index 3984c1a7ea..778561e73e 100644 --- a/lib/librte_pmd_e1000/e1000/e1000_vf.c +++ b/lib/librte_pmd_e1000/e1000/e1000_vf.c @@ -1,6 +1,6 @@ /******************************************************************************* -Copyright (c) 2001-2012, Intel Corporation +Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,21 +35,21 @@ POSSIBILITY OF SUCH DAMAGE. #include "e1000_api.h" -static s32 e1000_init_phy_params_vf(struct e1000_hw *hw); -static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw); -static void e1000_release_vf(struct e1000_hw *hw); -static s32 e1000_acquire_vf(struct e1000_hw *hw); -static s32 e1000_setup_link_vf(struct e1000_hw *hw); -static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw); -static s32 e1000_init_mac_params_vf(struct e1000_hw *hw); -static s32 e1000_check_for_link_vf(struct e1000_hw *hw); -static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, - u16 *duplex); -static s32 e1000_init_hw_vf(struct e1000_hw *hw); -static s32 e1000_reset_hw_vf(struct e1000_hw *hw); -static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32); -static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32); -static s32 e1000_read_mac_addr_vf(struct e1000_hw *); +STATIC s32 e1000_init_phy_params_vf(struct e1000_hw *hw); +STATIC s32 e1000_init_nvm_params_vf(struct e1000_hw *hw); +STATIC void e1000_release_vf(struct e1000_hw *hw); +STATIC s32 e1000_acquire_vf(struct e1000_hw *hw); +STATIC s32 e1000_setup_link_vf(struct e1000_hw *hw); +STATIC s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw); +STATIC s32 e1000_init_mac_params_vf(struct e1000_hw *hw); +STATIC s32 e1000_check_for_link_vf(struct e1000_hw *hw); +STATIC s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, + u16 *duplex); +STATIC s32 e1000_init_hw_vf(struct e1000_hw *hw); +STATIC s32 e1000_reset_hw_vf(struct e1000_hw *hw); +STATIC void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32); +STATIC void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32); +STATIC s32 e1000_read_mac_addr_vf(struct e1000_hw *); /** * e1000_init_phy_params_vf - Inits PHY params @@ -57,7 +57,7 @@ static s32 e1000_read_mac_addr_vf(struct e1000_hw *); * * Doesn't do much - there's no PHY available to the VF. **/ -static s32 e1000_init_phy_params_vf(struct e1000_hw *hw) +STATIC s32 e1000_init_phy_params_vf(struct e1000_hw *hw) { DEBUGFUNC("e1000_init_phy_params_vf"); hw->phy.type = e1000_phy_vf; @@ -73,7 +73,7 @@ static s32 e1000_init_phy_params_vf(struct e1000_hw *hw) * * Doesn't do much - there's no NVM available to the VF. **/ -static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw) +STATIC s32 e1000_init_nvm_params_vf(struct e1000_hw *hw) { DEBUGFUNC("e1000_init_nvm_params_vf"); hw->nvm.type = e1000_nvm_none; @@ -87,7 +87,7 @@ static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw) * e1000_init_mac_params_vf - Inits MAC params * @hw: pointer to the HW structure **/ -static s32 e1000_init_mac_params_vf(struct e1000_hw *hw) +STATIC s32 e1000_init_mac_params_vf(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; @@ -102,11 +102,11 @@ static s32 e1000_init_mac_params_vf(struct e1000_hw *hw) hw->phy.media_type = e1000_media_type_unknown; /* No ASF features for the VF driver */ - mac->asf_firmware_present = FALSE; + mac->asf_firmware_present = false; /* ARC subsystem not supported */ - mac->arc_subsystem_valid = FALSE; + mac->arc_subsystem_valid = false; /* Disable adaptive IFS mode so the generic funcs don't do anything */ - mac->adaptive_ifs = FALSE; + mac->adaptive_ifs = false; /* VF's have no MTA Registers - PF feature only */ mac->mta_reg_count = 128; /* VF's have no access to RAR entries */ @@ -158,8 +158,9 @@ void e1000_init_function_pointers_vf(struct e1000_hw *hw) * In addition, the MAC registers to access PHY/NVM don't exist so we don't * even want any SW to attempt to use them. **/ -static s32 e1000_acquire_vf(struct e1000_hw *hw) +STATIC s32 e1000_acquire_vf(struct e1000_hw E1000_UNUSEDARG *hw) { + UNREFERENCED_1PARAMETER(hw); return -E1000_ERR_PHY; } @@ -171,8 +172,9 @@ static s32 e1000_acquire_vf(struct e1000_hw *hw) * In addition, the MAC registers to access PHY/NVM don't exist so we don't * even want any SW to attempt to use them. **/ -static void e1000_release_vf(struct e1000_hw *hw) +STATIC void e1000_release_vf(struct e1000_hw E1000_UNUSEDARG *hw) { + UNREFERENCED_1PARAMETER(hw); return; } @@ -182,9 +184,10 @@ static void e1000_release_vf(struct e1000_hw *hw) * * Virtual functions cannot change link. **/ -static s32 e1000_setup_link_vf(struct e1000_hw *hw) +STATIC s32 e1000_setup_link_vf(struct e1000_hw E1000_UNUSEDARG *hw) { DEBUGFUNC("e1000_setup_link_vf"); + UNREFERENCED_1PARAMETER(hw); return E1000_SUCCESS; } @@ -195,7 +198,7 @@ static s32 e1000_setup_link_vf(struct e1000_hw *hw) * * Virtual functions are not really on their own bus. **/ -static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw) +STATIC s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw) { struct e1000_bus_info *bus = &hw->bus; @@ -217,8 +220,8 @@ static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw) * Since we cannot read the PHY and get accurate link info, we must rely upon * the status register's data which is often stale and inaccurate. **/ -static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, - u16 *duplex) +STATIC s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, + u16 *duplex) { s32 status; @@ -254,7 +257,7 @@ static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, * VF's provide a function level reset. This is done using bit 26 of ctrl_reg. * This is all the reset we can perform on a VF. **/ -static s32 e1000_reset_hw_vf(struct e1000_hw *hw) +STATIC s32 e1000_reset_hw_vf(struct e1000_hw *hw) { struct e1000_mbx_info *mbx = &hw->mbx; u32 timeout = E1000_VF_INIT_TIMEOUT; @@ -287,7 +290,7 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw) ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0); if (!ret_val) { if (msgbuf[0] == (E1000_VF_RESET | - E1000_VT_MSGTYPE_ACK)) + E1000_VT_MSGTYPE_ACK)) memcpy(hw->mac.perm_addr, addr, 6); else ret_val = -E1000_ERR_MAC_INIT; @@ -303,7 +306,7 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw) * * Not much to do here except clear the PF Reset indication if there is one. **/ -static s32 e1000_init_hw_vf(struct e1000_hw *hw) +STATIC s32 e1000_init_hw_vf(struct e1000_hw *hw) { DEBUGFUNC("e1000_init_hw_vf"); @@ -319,13 +322,15 @@ static s32 e1000_init_hw_vf(struct e1000_hw *hw) * @addr: pointer to the receive address * @index receive address array register **/ -static void e1000_rar_set_vf(struct e1000_hw *hw, u8 * addr, u32 index) +STATIC void e1000_rar_set_vf(struct e1000_hw *hw, u8 *addr, + u32 E1000_UNUSEDARG index) { struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[3]; u8 *msg_addr = (u8 *)(&msgbuf[1]); s32 ret_val; + UNREFERENCED_1PARAMETER(index); memset(msgbuf, 0, 12); msgbuf[0] = E1000_VF_SET_MAC_ADDR; memcpy(msg_addr, addr, 6); @@ -350,7 +355,7 @@ static void e1000_rar_set_vf(struct e1000_hw *hw, u8 * addr, u32 index) * Generates a multicast address hash value which is used to determine * the multicast filter table array address and new table value. **/ -static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) +STATIC u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) { u32 hash_value, hash_mask; u8 bit_shift = 0; @@ -368,11 +373,22 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) bit_shift++; hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | - (((u16) mc_addr[5]) << bit_shift))); + (((u16) mc_addr[5]) << bit_shift))); return hash_value; } +STATIC void e1000_write_msg_read_ack(struct e1000_hw *hw, + u32 *msg, u16 size) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + u32 retmsg[E1000_VFMAILBOX_SIZE]; + s32 retval = mbx->ops.write_posted(hw, msg, size, 0); + + if (!retval) + mbx->ops.read_posted(hw, retmsg, E1000_VFMAILBOX_SIZE, 0); +} + /** * e1000_update_mc_addr_list_vf - Update Multicast addresses * @hw: pointer to the HW structure @@ -383,9 +399,8 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) * The caller must have a packed mc_addr_list of multicast addresses. **/ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, - u8 *mc_addr_list, u32 mc_addr_count) + u8 *mc_addr_list, u32 mc_addr_count) { - struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[E1000_VFMAILBOX_SIZE]; u16 *hash_list = (u16 *)&msgbuf[1]; u32 hash_value; @@ -419,18 +434,17 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, mc_addr_list += ETH_ADDR_LEN; } - mbx->ops.write_posted(hw, msgbuf, E1000_VFMAILBOX_SIZE, 0); + e1000_write_msg_read_ack(hw, msgbuf, E1000_VFMAILBOX_SIZE); } /** * e1000_vfta_set_vf - Set/Unset vlan filter table address * @hw: pointer to the HW structure * @vid: determines the vfta register and bit to set/unset - * @set: if TRUE then set bit, else clear bit + * @set: if true then set bit, else clear bit **/ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) { - struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[2]; msgbuf[0] = E1000_VF_SET_VLAN; @@ -439,7 +453,7 @@ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) if (set) msgbuf[0] |= E1000_VF_SET_VLAN_ADD; - mbx->ops.write_posted(hw, msgbuf, 2, 0); + e1000_write_msg_read_ack(hw, msgbuf, 2); } /** e1000_rlpml_set_vf - Set the maximum receive packet length @@ -448,13 +462,12 @@ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set) **/ void e1000_rlpml_set_vf(struct e1000_hw *hw, u16 max_size) { - struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[2]; msgbuf[0] = E1000_VF_SET_LPE; msgbuf[1] = max_size; - mbx->ops.write_posted(hw, msgbuf, 2, 0); + e1000_write_msg_read_ack(hw, msgbuf, 2); } /** @@ -498,7 +511,7 @@ s32 e1000_promisc_set_vf(struct e1000_hw *hw, enum e1000_promisc_type type) * e1000_read_mac_addr_vf - Read device MAC address * @hw: pointer to the HW structure **/ -static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw) +STATIC s32 e1000_read_mac_addr_vf(struct e1000_hw *hw) { int i; @@ -516,7 +529,7 @@ static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw) * if it is then it reports the link state to the hardware, otherwise * it reports link down and returns an error. **/ -static s32 e1000_check_for_link_vf(struct e1000_hw *hw) +STATIC s32 e1000_check_for_link_vf(struct e1000_hw *hw) { struct e1000_mbx_info *mbx = &hw->mbx; struct e1000_mac_info *mac = &hw->mac; @@ -533,7 +546,7 @@ static s32 e1000_check_for_link_vf(struct e1000_hw *hw) /* If we were hit with a reset or timeout drop the link */ if (!mbx->ops.check_for_rst(hw, 0) || !mbx->timeout) - mac->get_link_status = TRUE; + mac->get_link_status = true; if (!mac->get_link_status) goto out; @@ -565,7 +578,7 @@ static s32 e1000_check_for_link_vf(struct e1000_hw *hw) /* if we passed all the tests above then the link is up and we no * longer need to check for link */ - mac->get_link_status = FALSE; + mac->get_link_status = false; out: return ret_val;