From c1889bfe687c22f74d1333913ffe8f8da173d601 Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 6 Feb 2009 23:16:45 +0000 Subject: igb: make dev_spec a union and remove dynamic allocation This patch makes dev_spec a union and simplifies it so that it does not require dynamic allocation and freeing in the driver. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index 97f0049a5d6..16fa0833368 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -37,19 +37,6 @@ static s32 igb_set_default_fc(struct e1000_hw *hw); static s32 igb_set_fc_watermarks(struct e1000_hw *hw); -/** - * igb_remove_device - Free device specific structure - * @hw: pointer to the HW structure - * - * If a device specific structure was allocated, this function will - * free it. - **/ -void igb_remove_device(struct e1000_hw *hw) -{ - /* Freeing the dev_spec member of e1000_hw structure */ - kfree(hw->dev_spec); -} - static s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) { struct igb_adapter *adapter = hw->back; -- cgit v1.2.3 From a8d2a0c27f84bdbf54b7e1c1a52ef7b8b7196dbc Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 6 Feb 2009 23:17:26 +0000 Subject: igb: rename phy ops This patch renames write_phy_reg to write_reg and read_phy_reg to read_reg. It seems redundant to call out phy in an operation that is part of the phy_ops struct. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index 16fa0833368..d0b695cf956 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -707,11 +707,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) * has completed. We read this twice because this reg has * some "sticky" (latched) bits. */ - ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, + ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); if (ret_val) goto out; - ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, + ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg); if (ret_val) goto out; @@ -729,11 +729,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw) * Page Ability Register (Address 5) to determine how * flow control was negotiated. */ - ret_val = hw->phy.ops.read_phy_reg(hw, PHY_AUTONEG_ADV, + ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_nway_adv_reg); if (ret_val) goto out; - ret_val = hw->phy.ops.read_phy_reg(hw, PHY_LP_ABILITY, + ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY, &mii_nway_lp_ability_reg); if (ret_val) goto out; -- cgit v1.2.3 From 312c75aee7606e886d91c810bc491c9f40ff5837 Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 6 Feb 2009 23:17:47 +0000 Subject: igb: rename nvm ops All of the nvm ops have the tag _nvm added to the end which is redundant since all of the calls to the ops have to go through the nvm ops struct anyway. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index d0b695cf956..6682206750d 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -135,7 +135,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) u16 offset, nvm_alt_mac_addr_offset, nvm_data; u8 alt_mac_addr[ETH_ALEN]; - ret_val = hw->nvm.ops.read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, + ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, &nvm_alt_mac_addr_offset); if (ret_val) { hw_dbg("NVM Read Error\n"); @@ -152,7 +152,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) for (i = 0; i < ETH_ALEN; i += 2) { offset = nvm_alt_mac_addr_offset + (i >> 1); - ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data); + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { hw_dbg("NVM Read Error\n"); goto out; @@ -575,8 +575,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw) * control setting, then the variable hw->fc will * be initialized based on a value in the EEPROM. */ - ret_val = hw->nvm.ops.read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, - &nvm_data); + ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data); if (ret_val) { hw_dbg("NVM Read Error\n"); @@ -1028,7 +1027,7 @@ static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data) { s32 ret_val; - ret_val = hw->nvm.ops.read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); + ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data); if (ret_val) { hw_dbg("NVM Read Error\n"); goto out; -- cgit v1.2.3 From 8675737a9c1bf6c295461efc64898359398e1c82 Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 6 Feb 2009 23:21:51 +0000 Subject: igb: remove disable_av variable from mac_info struct The disable_av variable is never used by the driver and provides no value as it is likely a leftover debugging variable. I have removed it and replaced the one spot that checked for it with a check for a valid address. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index 6682206750d..e5d23e08650 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -200,7 +200,8 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); - if (!hw->mac.disable_av) + /* If MAC address zero, no need to set the AV bit */ + if (rar_low || rar_high) rar_high |= E1000_RAH_AV; wr32(E1000_RAL(index), rar_low); -- cgit v1.2.3 From 86d5d38fa1afe2c96f184482d6c6d1a59ee7e2dc Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 6 Feb 2009 23:23:12 +0000 Subject: igb: update version number and copyright dates Update the version number to 1.3.16 and update copyright dates for 2009. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index e5d23e08650..5c249e2ce93 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -1,7 +1,7 @@ /******************************************************************************* Intel(R) Gigabit Ethernet Linux driver - Copyright(c) 2007 Intel Corporation. + Copyright(c) 2007-2009 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, -- cgit v1.2.3 From 4ae196dfd61d06b061c069edcdd7c73121e60a21 Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Thu, 19 Feb 2009 20:40:07 -0800 Subject: igb: Add support for enabling VFs to PF driver. This patch adds the support to handle requests from the VF to perform operations such as completing resets, setting/reading mac address, adding vlans, adding multicast addresses, setting rlpml, and general communications between the PF and all VFs. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index 5c249e2ce93..2804db03e9d 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -117,6 +117,30 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) wrfl(); } +/** + * igb_vfta_set - enable or disable vlan in VLAN filter table + * @hw: pointer to the HW structure + * @vid: VLAN id to add or remove + * @add: if true add filter, if false remove + * + * Sets or clears a bit in the VLAN filter table array based on VLAN id + * and if we are adding or removing the filter + **/ +void igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) +{ + u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; + u32 mask = 1 < (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); + u32 vfta; + + vfta = array_rd32(E1000_VFTA, index); + if (add) + vfta |= mask; + else + vfta &= ~mask; + + igb_write_vfta(hw, index, vfta); +} + /** * igb_check_alt_mac_addr - Check for alternate MAC addr * @hw: pointer to the HW structure -- cgit v1.2.3 From cad6d05f5676d879bb2a48154aea26cd81ebf1bb Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 13 Mar 2009 20:41:37 +0000 Subject: igb: add PF to pool Add Pf to pool if adding a VLVF register value and the VFTA bit is already set. This patch addresses the unlikely situation that the PF adds a vlan entry when the vlvf is full, and a vf later adds the vlan to the vlvf. Signed-off-by: Alexander Duyck Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index 2804db03e9d..f11592fe137 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -126,19 +126,26 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) * Sets or clears a bit in the VLAN filter table array based on VLAN id * and if we are adding or removing the filter **/ -void igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) +s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) { u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; u32 mask = 1 < (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); - u32 vfta; + u32 vfta = array_rd32(E1000_VFTA, index); + s32 ret_val = 0; - vfta = array_rd32(E1000_VFTA, index); - if (add) - vfta |= mask; - else - vfta &= ~mask; + /* bit was set/cleared before we started */ + if ((!!(vfta & mask)) == add) { + ret_val = -E1000_ERR_CONFIG; + } else { + if (add) + vfta |= mask; + else + vfta &= ~mask; + } igb_write_vfta(hw, index, vfta); + + return ret_val; } /** -- cgit v1.2.3 From 75f4f382e3f92d1d2fcb77fe6ed7beda19185f0f Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 13 Mar 2009 20:41:55 +0000 Subject: igb: correct typo that was setting vfta mask to 1 This patch corrects a typo that was doing a less than comparison instead of a left shift due to the fact that I didn't get enough <'s in there. This resolves an issue in which vlans were not functioning correctly. Signed-off-by: Alexander Duyck Acked-by: Jesse Brandeburg Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/e1000_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/igb/e1000_mac.c') diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index f11592fe137..f4c315b5a90 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c @@ -129,7 +129,7 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) { u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; - u32 mask = 1 < (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); + u32 mask = 1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); u32 vfta = array_rd32(E1000_VFTA, index); s32 ret_val = 0; -- cgit v1.2.3