Skip to content

Commit 0bafedc

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
Steffen Klassert says: ==================== pull request (net): ipsec 2022-09-29 1) Use the inner instead of the outer protocol for GSO on inter address family tunnels. This fixes the GSO case for address family tunnels. From Sabrina Dubroca. 2) Reset ipcomp_scratches with NULL when freed, otherwise it holds obsolete address. From Khalid Masum. 3) Reinject transport-mode packets through workqueue instead of a tasklet. The tasklet might take too long to finish. From Liu Jian. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents f4ce91c + 4f49206 commit 0bafedc

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

net/ipv4/esp4_offload.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ static struct sk_buff *xfrm4_tunnel_gso_segment(struct xfrm_state *x,
110110
struct sk_buff *skb,
111111
netdev_features_t features)
112112
{
113-
return skb_eth_gso_segment(skb, features, htons(ETH_P_IP));
113+
__be16 type = x->inner_mode.family == AF_INET6 ? htons(ETH_P_IPV6)
114+
: htons(ETH_P_IP);
115+
116+
return skb_eth_gso_segment(skb, features, type);
114117
}
115118

116119
static struct sk_buff *xfrm4_transport_gso_segment(struct xfrm_state *x,

net/ipv6/esp6_offload.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ static struct sk_buff *xfrm6_tunnel_gso_segment(struct xfrm_state *x,
145145
struct sk_buff *skb,
146146
netdev_features_t features)
147147
{
148-
return skb_eth_gso_segment(skb, features, htons(ETH_P_IPV6));
148+
__be16 type = x->inner_mode.family == AF_INET ? htons(ETH_P_IP)
149+
: htons(ETH_P_IPV6);
150+
151+
return skb_eth_gso_segment(skb, features, type);
149152
}
150153

151154
static struct sk_buff *xfrm6_transport_gso_segment(struct xfrm_state *x,

net/xfrm/xfrm_input.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#include "xfrm_inout.h"
2525

2626
struct xfrm_trans_tasklet {
27-
struct tasklet_struct tasklet;
27+
struct work_struct work;
28+
spinlock_t queue_lock;
2829
struct sk_buff_head queue;
2930
};
3031

@@ -760,18 +761,22 @@ int xfrm_input_resume(struct sk_buff *skb, int nexthdr)
760761
}
761762
EXPORT_SYMBOL(xfrm_input_resume);
762763

763-
static void xfrm_trans_reinject(struct tasklet_struct *t)
764+
static void xfrm_trans_reinject(struct work_struct *work)
764765
{
765-
struct xfrm_trans_tasklet *trans = from_tasklet(trans, t, tasklet);
766+
struct xfrm_trans_tasklet *trans = container_of(work, struct xfrm_trans_tasklet, work);
766767
struct sk_buff_head queue;
767768
struct sk_buff *skb;
768769

769770
__skb_queue_head_init(&queue);
771+
spin_lock_bh(&trans->queue_lock);
770772
skb_queue_splice_init(&trans->queue, &queue);
773+
spin_unlock_bh(&trans->queue_lock);
771774

775+
local_bh_disable();
772776
while ((skb = __skb_dequeue(&queue)))
773777
XFRM_TRANS_SKB_CB(skb)->finish(XFRM_TRANS_SKB_CB(skb)->net,
774778
NULL, skb);
779+
local_bh_enable();
775780
}
776781

777782
int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb,
@@ -789,8 +794,10 @@ int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb,
789794

790795
XFRM_TRANS_SKB_CB(skb)->finish = finish;
791796
XFRM_TRANS_SKB_CB(skb)->net = net;
797+
spin_lock_bh(&trans->queue_lock);
792798
__skb_queue_tail(&trans->queue, skb);
793-
tasklet_schedule(&trans->tasklet);
799+
spin_unlock_bh(&trans->queue_lock);
800+
schedule_work(&trans->work);
794801
return 0;
795802
}
796803
EXPORT_SYMBOL(xfrm_trans_queue_net);
@@ -817,7 +824,8 @@ void __init xfrm_input_init(void)
817824
struct xfrm_trans_tasklet *trans;
818825

819826
trans = &per_cpu(xfrm_trans_tasklet, i);
827+
spin_lock_init(&trans->queue_lock);
820828
__skb_queue_head_init(&trans->queue);
821-
tasklet_setup(&trans->tasklet, xfrm_trans_reinject);
829+
INIT_WORK(&trans->work, xfrm_trans_reinject);
822830
}
823831
}

net/xfrm/xfrm_ipcomp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ static void ipcomp_free_scratches(void)
203203
vfree(*per_cpu_ptr(scratches, i));
204204

205205
free_percpu(scratches);
206+
ipcomp_scratches = NULL;
206207
}
207208

208209
static void * __percpu *ipcomp_alloc_scratches(void)

0 commit comments

Comments
 (0)