Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Documentation/networking/xfrm_device.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ the stack in xfrm_input().

hand the packet to napi_gro_receive() as usual

In ESN mode, xdo_dev_state_advance_esn() is called from xfrm_replay_advance_esn().
In ESN mode, xdo_dev_state_advance_esn() is called from
xfrm_replay_advance_esn() for RX, and xfrm_replay_overflow_offload_esn for TX.
Driver will check packet seq number and update HW ESN state machine if needed.

When the SA is removed by the user, the driver's xdo_dev_state_delete()
Expand Down
12 changes: 11 additions & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,14 +1398,18 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
NETIF_F_HIGHDMA | NETIF_F_LRO)

#define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE | \
NETIF_F_GSO_PARTIAL)

#define BOND_MPLS_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
NETIF_F_GSO_SOFTWARE)

#define BOND_GSO_PARTIAL_FEATURES (NETIF_F_GSO_ESP)


static void bond_compute_features(struct bonding *bond)
{
netdev_features_t gso_partial_features = BOND_GSO_PARTIAL_FEATURES;
unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
IFF_XMIT_DST_RELEASE_PERM;
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
Expand Down Expand Up @@ -1440,6 +1444,10 @@ static void bond_compute_features(struct bonding *bond)
BOND_XFRM_FEATURES);
#endif /* CONFIG_XFRM_OFFLOAD */

gso_partial_features = netdev_increment_features(gso_partial_features,
slave->dev->gso_partial_features,
BOND_GSO_PARTIAL_FEATURES);

mpls_features = netdev_increment_features(mpls_features,
slave->dev->mpls_features,
BOND_MPLS_FEATURES);
Expand All @@ -1454,6 +1462,7 @@ static void bond_compute_features(struct bonding *bond)
bond_dev->hard_header_len = max_hard_header_len;

done:
bond_dev->gso_partial_features = gso_partial_features;
bond_dev->vlan_features = vlan_features;
bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
NETIF_F_HW_VLAN_CTAG_TX |
Expand Down Expand Up @@ -5789,6 +5798,7 @@ void bond_setup(struct net_device *bond_dev)
bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
bond_dev->features |= bond_dev->hw_features;
bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
bond_dev->features |= NETIF_F_GSO_PARTIAL;
#ifdef CONFIG_XFRM_OFFLOAD
bond_dev->hw_features |= BOND_XFRM_FEATURES;
/* Only enable XFRM features if this is an active-backup config */
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6572,6 +6572,9 @@ static void cxgb4_advance_esn_state(struct xfrm_state *x)
{
struct adapter *adap = netdev2adap(x->xso.dev);

if (x->xso.dir != XFRM_DEV_OFFLOAD_IN)
return;

if (!mutex_trylock(&uld_mutex)) {
dev_dbg(adap->pdev_dev,
"crypto uld critical resource is under use\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ static void mlx5e_xfrm_advance_esn_state(struct xfrm_state *x)
&sa_entry->modify_work;
bool need_update;

if (x->xso.dir != XFRM_DEV_OFFLOAD_IN)
return;

need_update = mlx5e_ipsec_update_esn_state(sa_entry);
if (!need_update)
return;
Expand Down
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
skb->encapsulation = 1;

if (skb_is_gso(skb)) {
if (skb->inner_protocol)
if (skb->inner_protocol && x->props.mode == XFRM_MODE_TUNNEL)
return xfrm_output_gso(net, sk, skb);

skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
Expand Down
1 change: 1 addition & 0 deletions net/xfrm/xfrm_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff
}

replay_esn->oseq = oseq;
xfrm_dev_state_advance_esn(x);

if (xfrm_aevent_is_on(net))
xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
Expand Down