Skip to content

Commit 0374016

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 2018-03-23 This series contains updates to ixgbe and ixgbevf only. Paul adds status register reads to reduce a potential race condition where registers can read 0xFFFFFFFF during a PCI reset, which in turn causes the driver to remove the adapter. Then fixes an assignment operation with an "OR" operation. Shannon Nelson provides several IPsec offload cleanups to ixgbe, as well as a patch to enable TSO with IPsec offload. Tony provides the much anticipated XDP support for ixgbevf. Currently, pass, drop and XDP_TX actions are supported, as well as meta data and stats reporting. Björn Töpel tweaks the page counting for XDP_REDIRECT, since a page can have its reference count decreased via the xdp_do_redirect() call. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents ee7a60c + ed93a39 commit 0374016

File tree

7 files changed

+596
-121
lines changed

7 files changed

+596
-121
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
154154
void ixgbe_set_soft_rate_select_speed(struct ixgbe_hw *hw,
155155
ixgbe_link_speed speed);
156156

157+
#define IXGBE_FAILED_READ_RETRIES 5
157158
#define IXGBE_FAILED_READ_REG 0xffffffffU
158159
#define IXGBE_FAILED_READ_CFG_DWORD 0xffffffffU
159160
#define IXGBE_FAILED_READ_CFG_WORD 0xffffU

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

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -774,11 +774,7 @@ int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
774774

775775
first->tx_flags |= IXGBE_TX_FLAGS_IPSEC | IXGBE_TX_FLAGS_CC;
776776

777-
itd->flags = 0;
778777
if (xs->id.proto == IPPROTO_ESP) {
779-
struct sk_buff *skb = first->skb;
780-
int ret, authlen, trailerlen;
781-
u8 padlen;
782778

783779
itd->flags |= IXGBE_ADVTXD_TUCMD_IPSEC_TYPE_ESP |
784780
IXGBE_ADVTXD_TUCMD_L4T_TCP;
@@ -790,19 +786,28 @@ int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
790786
* padlen bytes of padding. This ends up not the same
791787
* as the static value found in xs->props.trailer_len (21).
792788
*
793-
* The "correct" way to get the auth length would be to use
794-
* authlen = crypto_aead_authsize(xs->data);
795-
* but since we know we only have one size to worry about
796-
* we can let the compiler use the constant and save us a
797-
* few CPU cycles.
789+
* ... but if we're doing GSO, don't bother as the stack
790+
* doesn't add a trailer for those.
798791
*/
799-
authlen = IXGBE_IPSEC_AUTH_BITS / 8;
800-
801-
ret = skb_copy_bits(skb, skb->len - (authlen + 2), &padlen, 1);
802-
if (unlikely(ret))
803-
return 0;
804-
trailerlen = authlen + 2 + padlen;
805-
itd->trailer_len = trailerlen;
792+
if (!skb_is_gso(first->skb)) {
793+
/* The "correct" way to get the auth length would be
794+
* to use
795+
* authlen = crypto_aead_authsize(xs->data);
796+
* but since we know we only have one size to worry
797+
* about * we can let the compiler use the constant
798+
* and save us a few CPU cycles.
799+
*/
800+
const int authlen = IXGBE_IPSEC_AUTH_BITS / 8;
801+
struct sk_buff *skb = first->skb;
802+
u8 padlen;
803+
int ret;
804+
805+
ret = skb_copy_bits(skb, skb->len - (authlen + 2),
806+
&padlen, 1);
807+
if (unlikely(ret))
808+
return 0;
809+
itd->trailer_len = authlen + 2 + padlen;
810+
}
806811
}
807812
if (tsa->encrypt)
808813
itd->flags |= IXGBE_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN;
@@ -924,8 +929,13 @@ void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter)
924929
ixgbe_ipsec_clear_hw_tables(adapter);
925930

926931
adapter->netdev->xfrmdev_ops = &ixgbe_xfrmdev_ops;
927-
adapter->netdev->features |= NETIF_F_HW_ESP;
928-
adapter->netdev->hw_enc_features |= NETIF_F_HW_ESP;
932+
933+
#define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \
934+
NETIF_F_HW_ESP_TX_CSUM | \
935+
NETIF_F_GSO_ESP)
936+
937+
adapter->netdev->features |= IXGBE_ESP_FEATURES;
938+
adapter->netdev->hw_enc_features |= IXGBE_ESP_FEATURES;
929939

930940
return;
931941

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

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -353,23 +353,32 @@ static void ixgbe_remove_adapter(struct ixgbe_hw *hw)
353353
ixgbe_service_event_schedule(adapter);
354354
}
355355

356-
static void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg)
356+
static u32 ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg)
357357
{
358+
u8 __iomem *reg_addr;
358359
u32 value;
360+
int i;
361+
362+
reg_addr = READ_ONCE(hw->hw_addr);
363+
if (ixgbe_removed(reg_addr))
364+
return IXGBE_FAILED_READ_REG;
359365

360-
/* The following check not only optimizes a bit by not
361-
* performing a read on the status register when the
362-
* register just read was a status register read that
363-
* returned IXGBE_FAILED_READ_REG. It also blocks any
364-
* potential recursion.
366+
/* Register read of 0xFFFFFFF can indicate the adapter has been removed,
367+
* so perform several status register reads to determine if the adapter
368+
* has been removed.
365369
*/
366-
if (reg == IXGBE_STATUS) {
367-
ixgbe_remove_adapter(hw);
368-
return;
370+
for (i = 0; i < IXGBE_FAILED_READ_RETRIES; i++) {
371+
value = readl(reg_addr + IXGBE_STATUS);
372+
if (value != IXGBE_FAILED_READ_REG)
373+
break;
374+
mdelay(3);
369375
}
370-
value = ixgbe_read_reg(hw, IXGBE_STATUS);
376+
371377
if (value == IXGBE_FAILED_READ_REG)
372378
ixgbe_remove_adapter(hw);
379+
else
380+
value = readl(reg_addr + reg);
381+
return value;
373382
}
374383

375384
/**
@@ -415,7 +424,7 @@ u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
415424
writes_completed:
416425
value = readl(reg_addr + reg);
417426
if (unlikely(value == IXGBE_FAILED_READ_REG))
418-
ixgbe_check_remove(hw, reg);
427+
value = ixgbe_check_remove(hw, reg);
419428
return value;
420429
}
421430

@@ -1620,7 +1629,8 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring,
16201629
bi->dma = dma;
16211630
bi->page = page;
16221631
bi->page_offset = ixgbe_rx_offset(rx_ring);
1623-
bi->pagecnt_bias = 1;
1632+
page_ref_add(page, USHRT_MAX - 1);
1633+
bi->pagecnt_bias = USHRT_MAX;
16241634
rx_ring->rx_stats.alloc_rx_page++;
16251635

16261636
return true;
@@ -2030,8 +2040,8 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer)
20302040
* the pagecnt_bias and page count so that we fully restock the
20312041
* number of references the driver holds.
20322042
*/
2033-
if (unlikely(!pagecnt_bias)) {
2034-
page_ref_add(page, USHRT_MAX);
2043+
if (unlikely(pagecnt_bias == 1)) {
2044+
page_ref_add(page, USHRT_MAX - 1);
20352045
rx_buffer->pagecnt_bias = USHRT_MAX;
20362046
}
20372047

@@ -7721,7 +7731,8 @@ static void ixgbe_service_task(struct work_struct *work)
77217731

77227732
static int ixgbe_tso(struct ixgbe_ring *tx_ring,
77237733
struct ixgbe_tx_buffer *first,
7724-
u8 *hdr_len)
7734+
u8 *hdr_len,
7735+
struct ixgbe_ipsec_tx_data *itd)
77257736
{
77267737
u32 vlan_macip_lens, type_tucmd, mss_l4len_idx;
77277738
struct sk_buff *skb = first->skb;
@@ -7735,6 +7746,7 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
77357746
unsigned char *hdr;
77367747
} l4;
77377748
u32 paylen, l4_offset;
7749+
u32 fceof_saidx = 0;
77387750
int err;
77397751

77407752
if (skb->ip_summed != CHECKSUM_PARTIAL)
@@ -7760,13 +7772,15 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
77607772
if (ip.v4->version == 4) {
77617773
unsigned char *csum_start = skb_checksum_start(skb);
77627774
unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4);
7775+
int len = csum_start - trans_start;
77637776

77647777
/* IP header will have to cancel out any data that
7765-
* is not a part of the outer IP header
7778+
* is not a part of the outer IP header, so set to
7779+
* a reverse csum if needed, else init check to 0.
77667780
*/
7767-
ip.v4->check = csum_fold(csum_partial(trans_start,
7768-
csum_start - trans_start,
7769-
0));
7781+
ip.v4->check = (skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) ?
7782+
csum_fold(csum_partial(trans_start,
7783+
len, 0)) : 0;
77707784
type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
77717785

77727786
ip.v4->tot_len = 0;
@@ -7797,12 +7811,15 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
77977811
mss_l4len_idx = (*hdr_len - l4_offset) << IXGBE_ADVTXD_L4LEN_SHIFT;
77987812
mss_l4len_idx |= skb_shinfo(skb)->gso_size << IXGBE_ADVTXD_MSS_SHIFT;
77997813

7814+
fceof_saidx |= itd->sa_idx;
7815+
type_tucmd |= itd->flags | itd->trailer_len;
7816+
78007817
/* vlan_macip_lens: HEADLEN, MACLEN, VLAN tag */
78017818
vlan_macip_lens = l4.hdr - ip.hdr;
78027819
vlan_macip_lens |= (ip.hdr - skb->data) << IXGBE_ADVTXD_MACLEN_SHIFT;
78037820
vlan_macip_lens |= first->tx_flags & IXGBE_TX_FLAGS_VLAN_MASK;
78047821

7805-
ixgbe_tx_ctxtdesc(tx_ring, vlan_macip_lens, 0, type_tucmd,
7822+
ixgbe_tx_ctxtdesc(tx_ring, vlan_macip_lens, fceof_saidx, type_tucmd,
78067823
mss_l4len_idx);
78077824

78087825
return 1;
@@ -7864,10 +7881,8 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,
78647881
vlan_macip_lens |= skb_network_offset(skb) << IXGBE_ADVTXD_MACLEN_SHIFT;
78657882
vlan_macip_lens |= first->tx_flags & IXGBE_TX_FLAGS_VLAN_MASK;
78667883

7867-
if (first->tx_flags & IXGBE_TX_FLAGS_IPSEC) {
7868-
fceof_saidx |= itd->sa_idx;
7869-
type_tucmd |= itd->flags | itd->trailer_len;
7870-
}
7884+
fceof_saidx |= itd->sa_idx;
7885+
type_tucmd |= itd->flags | itd->trailer_len;
78717886

78727887
ixgbe_tx_ctxtdesc(tx_ring, vlan_macip_lens, fceof_saidx, type_tucmd, 0);
78737888
}
@@ -8495,7 +8510,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
84958510
if (skb->sp && !ixgbe_ipsec_tx(tx_ring, first, &ipsec_tx))
84968511
goto out_drop;
84978512
#endif
8498-
tso = ixgbe_tso(tx_ring, first, &hdr_len);
8513+
tso = ixgbe_tso(tx_ring, first, &hdr_len, &ipsec_tx);
84998514
if (tso < 0)
85008515
goto out_drop;
85018516
else if (!tso)
@@ -9904,15 +9919,15 @@ ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
99049919

99059920
/* We can only support IPV4 TSO in tunnels if we can mangle the
99069921
* inner IP ID field, so strip TSO if MANGLEID is not supported.
9922+
* IPsec offoad sets skb->encapsulation but still can handle
9923+
* the TSO, so it's the exception.
99079924
*/
9908-
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID))
9909-
features &= ~NETIF_F_TSO;
9910-
9911-
#ifdef CONFIG_XFRM_OFFLOAD
9912-
/* IPsec offload doesn't get along well with others *yet* */
9913-
if (skb->sp)
9914-
features &= ~(NETIF_F_TSO | NETIF_F_HW_CSUM);
9925+
if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) {
9926+
#ifdef CONFIG_XFRM
9927+
if (!skb->sp)
99159928
#endif
9929+
features &= ~NETIF_F_TSO;
9930+
}
99169931

99179932
return features;
99189933
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,9 +1847,9 @@ ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw, ixgbe_link_speed speed,
18471847
(IXGBE_CS4227_EDC_MODE_SR << 1));
18481848

18491849
if (setup_linear)
1850-
reg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
1850+
reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
18511851
else
1852-
reg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
1852+
reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
18531853

18541854
ret_val = hw->phy.ops.write_reg(hw, reg_slice,
18551855
IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);

0 commit comments

Comments
 (0)