ixgbe/base: minor changes
[dpdk.git] / lib / librte_pmd_ixgbe / ixgbe / ixgbe_82598.c
index c4ab304..d85673c 100644 (file)
@@ -39,27 +39,27 @@ POSSIBILITY OF SUCH DAMAGE.
 #ident "$Id: ixgbe_82598.c,v 1.194 2012/03/28 00:54:08 jtkirshe Exp $"
 
 STATIC s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
-                                             ixgbe_link_speed *speed,
-                                             bool *autoneg);
+                                            ixgbe_link_speed *speed,
+                                            bool *autoneg);
 STATIC enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw);
 STATIC s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
-                                       bool autoneg_wait_to_complete);
+                                     bool autoneg_wait_to_complete);
 STATIC s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
-                                      ixgbe_link_speed *speed, bool *link_up,
-                                      bool link_up_wait_to_complete);
+                                     ixgbe_link_speed *speed, bool *link_up,
+                                     bool link_up_wait_to_complete);
 STATIC s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
-                                            ixgbe_link_speed speed,
-                                            bool autoneg,
-                                            bool autoneg_wait_to_complete);
+                                     ixgbe_link_speed speed,
+                                     bool autoneg,
+                                     bool autoneg_wait_to_complete);
 STATIC s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
-                                               ixgbe_link_speed speed,
-                                               bool autoneg,
-                                               bool autoneg_wait_to_complete);
+                                        ixgbe_link_speed speed,
+                                        bool autoneg,
+                                        bool autoneg_wait_to_complete);
 STATIC s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw);
 STATIC s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
 STATIC s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw);
-static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
-                                  u32 headroom, int strategy);
+STATIC void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
+                                 u32 headroom, int strategy);
 
 /**
  *  ixgbe_set_pcie_completion_timeout - set pci-e completion timeout
@@ -130,7 +130,7 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw)
        mac->ops.reset_hw = &ixgbe_reset_hw_82598;
        mac->ops.get_media_type = &ixgbe_get_media_type_82598;
        mac->ops.get_supported_physical_layer =
-                                   &ixgbe_get_supported_physical_layer_82598;
+                               &ixgbe_get_supported_physical_layer_82598;
        mac->ops.read_analog_reg8 = &ixgbe_read_analog_reg8_82598;
        mac->ops.write_analog_reg8 = &ixgbe_write_analog_reg8_82598;
        mac->ops.set_lan_id = &ixgbe_set_lan_id_multi_port_pcie_82598;
@@ -145,12 +145,12 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw)
        /* Flow Control */
        mac->ops.fc_enable = &ixgbe_fc_enable_82598;
 
-       mac->mcft_size       = 128;
-       mac->vft_size        = 128;
-       mac->num_rar_entries = 16;
-       mac->rx_pb_size      = 512;
-       mac->max_tx_queues   = 32;
-       mac->max_rx_queues   = 64;
+       mac->mcft_size          = 128;
+       mac->vft_size           = 128;
+       mac->num_rar_entries    = 16;
+       mac->rx_pb_size         = 512;
+       mac->max_tx_queues      = 32;
+       mac->max_rx_queues      = 64;
        mac->max_msix_vectors   = ixgbe_get_pcie_msix_count_generic(hw);
 
        /* SFP+ Module */
@@ -194,7 +194,7 @@ s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
        if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
                mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
                mac->ops.get_link_capabilities =
-                                 &ixgbe_get_copper_link_capabilities_generic;
+                               &ixgbe_get_copper_link_capabilities_generic;
        }
 
        switch (hw->phy.type) {
@@ -202,7 +202,7 @@ s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
                phy->ops.setup_link = &ixgbe_setup_phy_link_tnx;
                phy->ops.check_link = &ixgbe_check_phy_link_tnx;
                phy->ops.get_firmware_version =
-                            &ixgbe_get_phy_firmware_version_tnx;
+                                       &ixgbe_get_phy_firmware_version_tnx;
                break;
        case ixgbe_phy_nl:
                phy->ops.reset = &ixgbe_reset_phy_nl;
@@ -218,8 +218,8 @@ s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
 
                /* Check to see if SFP+ module is supported */
                ret_val = ixgbe_get_sfp_init_sequence_offsets(hw,
-                                                           &list_offset,
-                                                           &data_offset);
+                                                             &list_offset,
+                                                             &data_offset);
                if (ret_val != IXGBE_SUCCESS) {
                        ret_val = IXGBE_ERR_SFP_NOT_SUPPORTED;
                        goto out;
@@ -283,8 +283,8 @@ s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)
  *  Determines the link capabilities by reading the AUTOC register.
  **/
 STATIC s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
-                                             ixgbe_link_speed *speed,
-                                             bool *autoneg)
+                                            ixgbe_link_speed *speed,
+                                            bool *autoneg)
 {
        s32 status = IXGBE_SUCCESS;
        u32 autoc = 0;
@@ -543,7 +543,7 @@ out:
  *  Restarts the link.  Performs autonegotiation if needed.
  **/
 STATIC s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
-                                      bool autoneg_wait_to_complete)
+                                     bool autoneg_wait_to_complete)
 {
        u32 autoc_reg;
        u32 links_reg;
@@ -601,7 +601,7 @@ STATIC s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)
        for (timeout = 0;
             timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) {
                hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
-                                    IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &an_reg);
+                                    IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &an_reg);
 
                if ((an_reg & IXGBE_MII_AUTONEG_COMPLETE) &&
                    (an_reg & IXGBE_MII_AUTONEG_LINK_UP))
@@ -628,8 +628,8 @@ STATIC s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)
  *  Reads the links register to determine if link is up and the current speed
  **/
 STATIC s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
-                                      ixgbe_link_speed *speed, bool *link_up,
-                                      bool link_up_wait_to_complete)
+                                     ixgbe_link_speed *speed, bool *link_up,
+                                     bool link_up_wait_to_complete)
 {
        u32 links_reg;
        u32 i;
@@ -647,7 +647,7 @@ STATIC s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
                hw->phy.ops.read_reg(hw, 0xC79F, IXGBE_TWINAX_DEV, &link_reg);
                hw->phy.ops.read_reg(hw, 0xC79F, IXGBE_TWINAX_DEV, &link_reg);
                hw->phy.ops.read_reg(hw, 0xC00C, IXGBE_TWINAX_DEV,
-                                    &adapt_comp_reg);
+                                    &adapt_comp_reg);
                if (link_up_wait_to_complete) {
                        for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
                                if ((link_reg & 1) &&
@@ -659,11 +659,11 @@ STATIC s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
                                }
                                msec_delay(100);
                                hw->phy.ops.read_reg(hw, 0xC79F,
-                                                    IXGBE_TWINAX_DEV,
-                                                    &link_reg);
+                                                    IXGBE_TWINAX_DEV,
+                                                    &link_reg);
                                hw->phy.ops.read_reg(hw, 0xC00C,
-                                                    IXGBE_TWINAX_DEV,
-                                                    &adapt_comp_reg);
+                                                    IXGBE_TWINAX_DEV,
+                                                    &adapt_comp_reg);
                        }
                } else {
                        if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0))
@@ -718,14 +718,14 @@ out:
  *  Set the link speed in the AUTOC register and restarts link.
  **/
 STATIC s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
-                                           ixgbe_link_speed speed, bool autoneg,
-                                           bool autoneg_wait_to_complete)
+                                     ixgbe_link_speed speed, bool autoneg,
+                                     bool autoneg_wait_to_complete)
 {
-       s32              status            = IXGBE_SUCCESS;
+       s32 status = IXGBE_SUCCESS;
        ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
-       u32              curr_autoc        = IXGBE_READ_REG(hw, IXGBE_AUTOC);
-       u32              autoc             = curr_autoc;
-       u32              link_mode         = autoc & IXGBE_AUTOC_LMS_MASK;
+       u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
+       u32 autoc = curr_autoc;
+       u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
 
        DEBUGFUNC("ixgbe_setup_mac_link_82598");
 
@@ -738,7 +738,7 @@ STATIC s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
 
        /* Set KX4/KX support according to speed requested */
        else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
-                link_mode == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
+                link_mode == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
                autoc &= ~IXGBE_AUTOC_KX4_KX_SUPP_MASK;
                if (speed & IXGBE_LINK_SPEED_10GB_FULL)
                        autoc |= IXGBE_AUTOC_KX4_SUPP;
@@ -755,7 +755,7 @@ STATIC s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
                 * stored values
                 */
                status = ixgbe_start_mac_link_82598(hw,
-                                                   autoneg_wait_to_complete);
+                                                   autoneg_wait_to_complete);
        }
 
        return status;
@@ -772,9 +772,9 @@ STATIC s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
  *  Sets the link speed in the AUTOC register in the MAC and restarts link.
  **/
 STATIC s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
-                                               ixgbe_link_speed speed,
-                                               bool autoneg,
-                                               bool autoneg_wait_to_complete)
+                                        ixgbe_link_speed speed,
+                                        bool autoneg,
+                                        bool autoneg_wait_to_complete)
 {
        s32 status;
 
@@ -782,7 +782,7 @@ STATIC s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
 
        /* Setup the PHY according to input speed */
        status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
-                                             autoneg_wait_to_complete);
+                                             autoneg_wait_to_complete);
        /* Set up MAC */
        ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
 
@@ -823,28 +823,28 @@ STATIC s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
        if (analog_val & IXGBE_ATLAS_PDN_TX_REG_EN) {
                /* Enable Tx Atlas so packets can be transmitted again */
                hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
-                                            &analog_val);
+                                            &analog_val);
                analog_val &= ~IXGBE_ATLAS_PDN_TX_REG_EN;
                hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
-                                             analog_val);
+                                             analog_val);
 
                hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
-                                            &analog_val);
+                                            &analog_val);
                analog_val &= ~IXGBE_ATLAS_PDN_TX_10G_QL_ALL;
                hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
-                                             analog_val);
+                                             analog_val);
 
                hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
-                                            &analog_val);
+                                            &analog_val);
                analog_val &= ~IXGBE_ATLAS_PDN_TX_1G_QL_ALL;
                hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
-                                             analog_val);
+                                             analog_val);
 
                hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
-                                            &analog_val);
+                                            &analog_val);
                analog_val &= ~IXGBE_ATLAS_PDN_TX_AN_QL_ALL;
                hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
-                                             analog_val);
+                                             analog_val);
        }
 
        /* Reset PHY */
@@ -964,6 +964,7 @@ STATIC s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
        u32 rar_high;
        u32 rar_entries = hw->mac.num_rar_entries;
 
+       UNREFERENCED_1PARAMETER(vmdq);
 
        /* Make sure we are using a valid rar index range */
        if (rar >= rar_entries) {
@@ -990,7 +991,7 @@ STATIC s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  *  Turn on/off specified VLAN in the VLAN filter table.
  **/
 s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
-                                                     bool vlan_on)
+                        bool vlan_on)
 {
        u32 regindex;
        u32 bitindex;
@@ -1049,7 +1050,7 @@ STATIC s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
        for (vlanbyte = 0; vlanbyte < 4; vlanbyte++)
                for (offset = 0; offset < hw->mac.vft_size; offset++)
                        IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vlanbyte, offset),
-                                       0);
+                                       0);
 
        return IXGBE_SUCCESS;
 }
@@ -1069,7 +1070,7 @@ s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val)
        DEBUGFUNC("ixgbe_read_analog_reg8_82598");
 
        IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL,
-                       IXGBE_ATLASCTL_WRITE_CMD | (reg << 8));
+                       IXGBE_ATLASCTL_WRITE_CMD | (reg << 8));
        IXGBE_WRITE_FLUSH(hw);
        usec_delay(10);
        atlas_ctl = IXGBE_READ_REG(hw, IXGBE_ATLASCTL);
@@ -1109,7 +1110,7 @@ s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val)
  *  Performs 8 byte read operation to SFP module's EEPROM over I2C interface.
  **/
 s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
-                                u8 *eeprom_data)
+                               u8 *eeprom_data)
 {
        s32 status = IXGBE_SUCCESS;
        u16 sfp_addr = 0;
@@ -1128,16 +1129,16 @@ s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
                sfp_addr = (IXGBE_I2C_EEPROM_DEV_ADDR << 8) + byte_offset;
                sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
                hw->phy.ops.write_reg(hw,
-                                     IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
-                                     IXGBE_MDIO_PMA_PMD_DEV_TYPE,
-                                     sfp_addr);
+                                     IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
+                                     IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                     sfp_addr);
 
                /* Poll status */
                for (i = 0; i < 100; i++) {
                        hw->phy.ops.read_reg(hw,
-                                            IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
-                                            IXGBE_MDIO_PMA_PMD_DEV_TYPE,
-                                            &sfp_stat);
+                                            IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
+                                            IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+                                            &sfp_stat);
                        sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK;
                        if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS)
                                break;
@@ -1152,7 +1153,7 @@ s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
 
                /* Read data */
                hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA,
-                                    IXGBE_MDIO_PMA_PMD_DEV_TYPE, &sfp_data);
+                                    IXGBE_MDIO_PMA_PMD_DEV_TYPE, &sfp_data);
 
                *eeprom_data = (u8)(sfp_data >> 8);
        } else {
@@ -1337,11 +1338,12 @@ void ixgbe_enable_relaxed_ordering_82598(struct ixgbe_hw *hw)
  * @headroom: reserve n KB of headroom
  * @strategy: packet buffer allocation strategy
  **/
-static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
-                                  u32 headroom, int strategy)
+STATIC void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
+                                 u32 headroom, int strategy)
 {
        u32 rxpktsize = IXGBE_RXPBSIZE_64KB;
        u8 i = 0;
+       UNREFERENCED_1PARAMETER(headroom);
 
        if (!num_pb)
                return;