ethdev: better typing of RSS constants
[dpdk.git] / lib / librte_pmd_e1000 / e1000 / e1000_vf.c
index b3a6b01..778561e 100644 (file)
@@ -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
@@ -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;
 }
@@ -218,7 +221,7 @@ STATIC s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw)
  *  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)
+                                    u16 *duplex)
 {
        s32 status;
 
@@ -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;
@@ -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);
@@ -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);
 }
 
 /**