Skip to content

Commit 9811d1e

Browse files
committed
Merge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 10GbE Intel Wired LAN Driver Updates 2016-11-04 This series contains updates to ixgbe and ixgbevf only. Don does cleanup and configuration for our X553 devices, related to LED, auto-negotiation, flow control and SFP+ setup and config. Adds the (not secret) sauce for B0 hardware for X553 hardware. Emil provides several fixes, first replaces the driver specific MDIO defines for the more preferred equivalent kernel ones. Provides a fix for auto-negotiaion status, by reading a PHY register twice. Introduces ixgbe_link_operations structure to allow X550EM_a to override the methods for MDIO access while X550EM_x provides methods to use I2C combined access. Mark fixes an issue where the driver was crashing when msix_entires were not there because they were freed by a previous suspend or remove. Sowmini Varadhan fixes an issue where an incorrect check for IPPROTO_UDP in ixgbe_atr(). Then makes sure that the network and transport headers in the paged data are available in the headlen bytes to calculate the l4_proto. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b6e4179 + eeffcee commit 9811d1e

File tree

13 files changed

+819
-374
lines changed

13 files changed

+819
-374
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,4 +1027,6 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
10271027
struct ixgbe_ring *tx_ring);
10281028
u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter);
10291029
void ixgbe_store_reta(struct ixgbe_adapter *adapter);
1030+
s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
1031+
u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);
10301032
#endif /* _IXGBE_H_ */

drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
367367
}
368368

369369
/* Negotiate the fc mode to use */
370-
ixgbe_fc_autoneg(hw);
370+
hw->mac.ops.fc_autoneg(hw);
371371

372372
/* Disable any previous flow control settings */
373373
fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
@@ -1179,6 +1179,7 @@ static const struct ixgbe_mac_operations mac_ops_82598 = {
11791179
.get_link_capabilities = &ixgbe_get_link_capabilities_82598,
11801180
.led_on = &ixgbe_led_on_generic,
11811181
.led_off = &ixgbe_led_off_generic,
1182+
.init_led_link_act = ixgbe_init_led_link_act_generic,
11821183
.blink_led_start = &ixgbe_blink_led_start_generic,
11831184
.blink_led_stop = &ixgbe_blink_led_stop_generic,
11841185
.set_rar = &ixgbe_set_rar_generic,
@@ -1193,6 +1194,7 @@ static const struct ixgbe_mac_operations mac_ops_82598 = {
11931194
.set_vfta = &ixgbe_set_vfta_82598,
11941195
.fc_enable = &ixgbe_fc_enable_82598,
11951196
.setup_fc = ixgbe_setup_fc_generic,
1197+
.fc_autoneg = ixgbe_fc_autoneg,
11961198
.set_fw_drv_ver = NULL,
11971199
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
11981200
.release_swfw_sync = &ixgbe_release_swfw_sync,

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,7 @@ static const struct ixgbe_mac_operations mac_ops_82599 = {
22042204
.get_link_capabilities = &ixgbe_get_link_capabilities_82599,
22052205
.led_on = &ixgbe_led_on_generic,
22062206
.led_off = &ixgbe_led_off_generic,
2207+
.init_led_link_act = ixgbe_init_led_link_act_generic,
22072208
.blink_led_start = &ixgbe_blink_led_start_generic,
22082209
.blink_led_stop = &ixgbe_blink_led_stop_generic,
22092210
.set_rar = &ixgbe_set_rar_generic,
@@ -2219,6 +2220,7 @@ static const struct ixgbe_mac_operations mac_ops_82599 = {
22192220
.set_vfta = &ixgbe_set_vfta_generic,
22202221
.fc_enable = &ixgbe_fc_enable_generic,
22212222
.setup_fc = ixgbe_setup_fc_generic,
2223+
.fc_autoneg = ixgbe_fc_autoneg,
22222224
.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
22232225
.init_uta_tables = &ixgbe_init_uta_tables_generic,
22242226
.setup_sfp = &ixgbe_setup_sfp_modules_82599,

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,12 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
298298
IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
299299
IXGBE_WRITE_FLUSH(hw);
300300

301-
/* Setup flow control */
302-
ret_val = hw->mac.ops.setup_fc(hw);
303-
if (ret_val)
304-
return ret_val;
301+
/* Setup flow control if method for doing so */
302+
if (hw->mac.ops.setup_fc) {
303+
ret_val = hw->mac.ops.setup_fc(hw);
304+
if (ret_val)
305+
return ret_val;
306+
}
305307

306308
/* Cashe bit indicating need for crosstalk fix */
307309
switch (hw->mac.type) {
@@ -390,6 +392,9 @@ s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw)
390392
status = hw->mac.ops.start_hw(hw);
391393
}
392394

395+
/* Initialize the LED link active for LED blink support */
396+
hw->mac.ops.init_led_link_act(hw);
397+
393398
return status;
394399
}
395400

@@ -772,6 +777,49 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw)
772777
return ixgbe_disable_pcie_master(hw);
773778
}
774779

780+
/**
781+
* ixgbe_init_led_link_act_generic - Store the LED index link/activity.
782+
* @hw: pointer to hardware structure
783+
*
784+
* Store the index for the link active LED. This will be used to support
785+
* blinking the LED.
786+
**/
787+
s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw)
788+
{
789+
struct ixgbe_mac_info *mac = &hw->mac;
790+
u32 led_reg, led_mode;
791+
u16 i;
792+
793+
led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
794+
795+
/* Get LED link active from the LEDCTL register */
796+
for (i = 0; i < 4; i++) {
797+
led_mode = led_reg >> IXGBE_LED_MODE_SHIFT(i);
798+
799+
if ((led_mode & IXGBE_LED_MODE_MASK_BASE) ==
800+
IXGBE_LED_LINK_ACTIVE) {
801+
mac->led_link_act = i;
802+
return 0;
803+
}
804+
}
805+
806+
/* If LEDCTL register does not have the LED link active set, then use
807+
* known MAC defaults.
808+
*/
809+
switch (hw->mac.type) {
810+
case ixgbe_mac_x550em_a:
811+
mac->led_link_act = 0;
812+
break;
813+
case ixgbe_mac_X550EM_x:
814+
mac->led_link_act = 1;
815+
break;
816+
default:
817+
mac->led_link_act = 2;
818+
}
819+
820+
return 0;
821+
}
822+
775823
/**
776824
* ixgbe_led_on_generic - Turns on the software controllable LEDs.
777825
* @hw: pointer to hardware structure
@@ -2127,7 +2175,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw)
21272175
}
21282176

21292177
/* Negotiate the fc mode to use */
2130-
ixgbe_fc_autoneg(hw);
2178+
hw->mac.ops.fc_autoneg(hw);
21312179

21322180
/* Disable any previous flow control settings */
21332181
mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN);
@@ -2231,8 +2279,8 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw)
22312279
* Find the intersection between advertised settings and link partner's
22322280
* advertised settings
22332281
**/
2234-
static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
2235-
u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
2282+
s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
2283+
u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
22362284
{
22372285
if ((!(adv_reg)) || (!(lp_reg)))
22382286
return IXGBE_ERR_FC_NOT_NEGOTIATED;

drivers/net/ethernet/intel/ixgbe/ixgbe_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
4949

5050
s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index);
5151
s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
52+
s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw);
5253

5354
s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
5455
s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data);

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,11 +2225,11 @@ static int ixgbe_set_phys_id(struct net_device *netdev,
22252225
return 2;
22262226

22272227
case ETHTOOL_ID_ON:
2228-
hw->mac.ops.led_on(hw, hw->bus.func);
2228+
hw->mac.ops.led_on(hw, hw->mac.led_link_act);
22292229
break;
22302230

22312231
case ETHTOOL_ID_OFF:
2232-
hw->mac.ops.led_off(hw, hw->bus.func);
2232+
hw->mac.ops.led_off(hw, hw->mac.led_link_act);
22332233
break;
22342234

22352235
case ETHTOOL_ID_INACTIVE:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <net/pkt_cls.h>
5555
#include <net/tc_act/tc_gact.h>
5656
#include <net/tc_act/tc_mirred.h>
57+
#include <net/vxlan.h>
5758

5859
#include "ixgbe.h"
5960
#include "ixgbe_common.h"
@@ -3070,6 +3071,9 @@ static void ixgbe_free_irq(struct ixgbe_adapter *adapter)
30703071
return;
30713072
}
30723073

3074+
if (!adapter->msix_entries)
3075+
return;
3076+
30733077
for (vector = 0; vector < adapter->num_q_vectors; vector++) {
30743078
struct ixgbe_q_vector *q_vector = adapter->q_vector[vector];
30753079
struct msix_entry *entry = &adapter->msix_entries[vector];
@@ -5621,7 +5625,8 @@ static void ixgbe_init_dcb(struct ixgbe_adapter *adapter)
56215625
* Fields are initialized based on PCI device information and
56225626
* OS network device settings (MTU size).
56235627
**/
5624-
static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
5628+
static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
5629+
const struct ixgbe_info *ii)
56255630
{
56265631
struct ixgbe_hw *hw = &adapter->hw;
56275632
struct pci_dev *pdev = adapter->pdev;
@@ -5637,6 +5642,9 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
56375642
hw->subsystem_vendor_id = pdev->subsystem_vendor;
56385643
hw->subsystem_device_id = pdev->subsystem_device;
56395644

5645+
/* get_invariants needs the device IDs */
5646+
ii->get_invariants(hw);
5647+
56405648
/* Set common capability flags and settings */
56415649
rss = min_t(int, ixgbe_max_rss_indices(adapter), num_online_cpus());
56425650
adapter->ring_feature[RING_F_RSS].limit = rss;
@@ -7653,11 +7661,17 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
76537661
/* snag network header to get L4 type and address */
76547662
skb = first->skb;
76557663
hdr.network = skb_network_header(skb);
7664+
if (unlikely(hdr.network <= skb->data))
7665+
return;
76567666
if (skb->encapsulation &&
76577667
first->protocol == htons(ETH_P_IP) &&
7658-
hdr.ipv4->protocol != IPPROTO_UDP) {
7668+
hdr.ipv4->protocol == IPPROTO_UDP) {
76597669
struct ixgbe_adapter *adapter = q_vector->adapter;
76607670

7671+
if (unlikely(skb_tail_pointer(skb) < hdr.network +
7672+
VXLAN_HEADROOM))
7673+
return;
7674+
76617675
/* verify the port is recognized as VXLAN */
76627676
if (adapter->vxlan_port &&
76637677
udp_hdr(skb)->dest == adapter->vxlan_port)
@@ -7668,6 +7682,12 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
76687682
hdr.network = skb_inner_network_header(skb);
76697683
}
76707684

7685+
/* Make sure we have at least [minimum IPv4 header + TCP]
7686+
* or [IPv6 header] bytes
7687+
*/
7688+
if (unlikely(skb_tail_pointer(skb) < hdr.network + 40))
7689+
return;
7690+
76717691
/* Currently only IPv4/IPv6 with TCP is supported */
76727692
switch (hdr.ipv4->version) {
76737693
case IPVERSION:
@@ -7687,6 +7707,10 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
76877707
if (l4_proto != IPPROTO_TCP)
76887708
return;
76897709

7710+
if (unlikely(skb_tail_pointer(skb) < hdr.network +
7711+
hlen + sizeof(struct tcphdr)))
7712+
return;
7713+
76907714
th = (struct tcphdr *)(hdr.network + hlen);
76917715

76927716
/* skip this packet since the socket is closing */
@@ -9504,6 +9528,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
95049528
hw->mac.ops = *ii->mac_ops;
95059529
hw->mac.type = ii->mac;
95069530
hw->mvals = ii->mvals;
9531+
if (ii->link_ops)
9532+
hw->link.ops = *ii->link_ops;
95079533

95089534
/* EEPROM */
95099535
hw->eeprom.ops = *ii->eeprom_ops;
@@ -9527,10 +9553,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
95279553
hw->phy.mdio.mdio_read = ixgbe_mdio_read;
95289554
hw->phy.mdio.mdio_write = ixgbe_mdio_write;
95299555

9530-
ii->get_invariants(hw);
9531-
95329556
/* setup the private structure */
9533-
err = ixgbe_sw_init(adapter);
9557+
err = ixgbe_sw_init(adapter, ii);
95349558
if (err)
95359559
goto err_sw_init;
95369560

0 commit comments

Comments
 (0)