Skip to content

Commit 83f7e38

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-12 This series contains updates to ixgbe and ixgbevf only. Shannon Nelson provides three fixes to the ipsec portion of ixgbe. Make sure we are using 128-bit authentication, since it is the only size supported for hardware offload. Fixed the transmit trailer length calculation for ipsec by finding the padding value and adding it to the authentication length, then save it off so that we can put it in the transmit descriptor to tell the device where to stop the checksum calculation. Lastly, cleaned up useless and dead code. Tonghao Zhang adds a ethtool stat for receive length errors, since the driver was already collecting this counter. Arnd Bergmann fixed a warning about an used variable by "rephrasing" the code so that the compiler can see the use of the variable in question. Paul fixes an issue where "HIDE_VLAN" was being cleared on VF reset, so ensure to set "HIDE_VLAN" when port VLAN is enabled after a VF reset. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b2c9272 + b03254d commit 83f7e38

File tree

5 files changed

+46
-25
lines changed

5 files changed

+46
-25
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ static const struct ixgbe_stats ixgbe_gstrings_stats[] = {
9797
{"tx_heartbeat_errors", IXGBE_NETDEV_STAT(tx_heartbeat_errors)},
9898
{"tx_timeout_count", IXGBE_STAT(tx_timeout_count)},
9999
{"tx_restart_queue", IXGBE_STAT(restart_queue)},
100+
{"rx_length_errors", IXGBE_STAT(stats.rlec)},
100101
{"rx_long_length_errors", IXGBE_STAT(stats.roc)},
101102
{"rx_short_length_errors", IXGBE_STAT(stats.ruc)},
102103
{"tx_flow_control_xon", IXGBE_STAT(stats.lxontxc)},

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

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,21 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
423423
const char aes_gcm_name[] = "rfc4106(gcm(aes))";
424424
int key_len;
425425

426-
if (xs->aead) {
427-
key_data = &xs->aead->alg_key[0];
428-
key_len = xs->aead->alg_key_len;
429-
alg_name = xs->aead->alg_name;
430-
} else {
426+
if (!xs->aead) {
431427
netdev_err(dev, "Unsupported IPsec algorithm\n");
432428
return -EINVAL;
433429
}
434430

431+
if (xs->aead->alg_icv_len != IXGBE_IPSEC_AUTH_BITS) {
432+
netdev_err(dev, "IPsec offload requires %d bit authentication\n",
433+
IXGBE_IPSEC_AUTH_BITS);
434+
return -EINVAL;
435+
}
436+
437+
key_data = &xs->aead->alg_key[0];
438+
key_len = xs->aead->alg_key_len;
439+
alg_name = xs->aead->alg_name;
440+
435441
if (strcmp(alg_name, aes_gcm_name)) {
436442
netdev_err(dev, "Unsupported IPsec algorithm - please use %s\n",
437443
aes_gcm_name);
@@ -718,23 +724,10 @@ static bool ixgbe_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
718724
return true;
719725
}
720726

721-
/**
722-
* ixgbe_ipsec_free - called by xfrm garbage collections
723-
* @xs: pointer to transformer state struct
724-
*
725-
* We don't have any garbage to collect, so we shouldn't bother
726-
* implementing this function, but the XFRM code doesn't check for
727-
* existence before calling the API callback.
728-
**/
729-
static void ixgbe_ipsec_free(struct xfrm_state *xs)
730-
{
731-
}
732-
733727
static const struct xfrmdev_ops ixgbe_xfrmdev_ops = {
734728
.xdo_dev_state_add = ixgbe_ipsec_add_sa,
735729
.xdo_dev_state_delete = ixgbe_ipsec_del_sa,
736730
.xdo_dev_offload_ok = ixgbe_ipsec_offload_ok,
737-
.xdo_dev_state_free = ixgbe_ipsec_free,
738731
};
739732

740733
/**
@@ -783,11 +776,33 @@ int ixgbe_ipsec_tx(struct ixgbe_ring *tx_ring,
783776

784777
itd->flags = 0;
785778
if (xs->id.proto == IPPROTO_ESP) {
779+
struct sk_buff *skb = first->skb;
780+
int ret, authlen, trailerlen;
781+
u8 padlen;
782+
786783
itd->flags |= IXGBE_ADVTXD_TUCMD_IPSEC_TYPE_ESP |
787784
IXGBE_ADVTXD_TUCMD_L4T_TCP;
788785
if (first->protocol == htons(ETH_P_IP))
789786
itd->flags |= IXGBE_ADVTXD_TUCMD_IPV4;
790-
itd->trailer_len = xs->props.trailer_len;
787+
788+
/* The actual trailer length is authlen (16 bytes) plus
789+
* 2 bytes for the proto and the padlen values, plus
790+
* padlen bytes of padding. This ends up not the same
791+
* as the static value found in xs->props.trailer_len (21).
792+
*
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.
798+
*/
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;
791806
}
792807
if (tsa->encrypt)
793808
itd->flags |= IXGBE_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define IXGBE_IPSEC_MAX_RX_IP_COUNT 128
3333
#define IXGBE_IPSEC_BASE_RX_INDEX 0
3434
#define IXGBE_IPSEC_BASE_TX_INDEX IXGBE_IPSEC_MAX_SA_COUNT
35+
#define IXGBE_IPSEC_AUTH_BITS 128
3536

3637
#define IXGBE_RXTXIDX_IPS_EN 0x00000001
3738
#define IXGBE_RXIDX_TBL_SHIFT 1

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,11 @@ static int ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf)
831831
IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), reg);
832832

833833
/* force drop enable for all VF Rx queues */
834-
ixgbe_write_qde(adapter, vf, IXGBE_QDE_ENABLE);
834+
reg = IXGBE_QDE_ENABLE;
835+
if (adapter->vfinfo[vf].pf_vlan)
836+
reg |= IXGBE_QDE_HIDE_VLAN;
837+
838+
ixgbe_write_qde(adapter, vf, reg);
835839

836840
/* enable receive for vf */
837841
reg = IXGBE_READ_REG(hw, IXGBE_VFRE(reg_offset));

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,12 +1766,12 @@ static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter,
17661766

17671767
set_ring_build_skb_enabled(rx_ring);
17681768

1769-
#if (PAGE_SIZE < 8192)
1770-
if (max_frame <= IXGBEVF_MAX_FRAME_BUILD_SKB)
1771-
return;
1769+
if (PAGE_SIZE < 8192) {
1770+
if (max_frame <= IXGBEVF_MAX_FRAME_BUILD_SKB)
1771+
return;
17721772

1773-
set_ring_uses_large_buffer(rx_ring);
1774-
#endif
1773+
set_ring_uses_large_buffer(rx_ring);
1774+
}
17751775
}
17761776

17771777
/**

0 commit comments

Comments
 (0)