@@ -137,10 +137,12 @@ EXPORT_SYMBOL_GPL(lockdep_ovsl_is_held);
137137static struct vport * new_vport (const struct vport_parms * );
138138static int queue_gso_packets (struct datapath * dp , struct sk_buff * ,
139139 const struct sw_flow_key * ,
140- const struct dp_upcall_info * );
140+ const struct dp_upcall_info * ,
141+ uint32_t cutlen );
141142static int queue_userspace_packet (struct datapath * dp , struct sk_buff * ,
142143 const struct sw_flow_key * ,
143- const struct dp_upcall_info * );
144+ const struct dp_upcall_info * ,
145+ uint32_t cutlen );
144146
145147/* Must be called with rcu_read_lock. */
146148static struct datapath * get_dp_rcu (struct net * net , int dp_ifindex )
@@ -275,7 +277,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
275277 upcall .cmd = OVS_PACKET_CMD_MISS ;
276278 upcall .portid = ovs_vport_find_upcall_portid (p , skb );
277279 upcall .mru = OVS_CB (skb )-> mru ;
278- error = ovs_dp_upcall (dp , skb , key , & upcall );
280+ error = ovs_dp_upcall (dp , skb , key , & upcall , 0 );
279281 if (unlikely (error ))
280282 kfree_skb (skb );
281283 else
@@ -300,7 +302,8 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
300302
301303int ovs_dp_upcall (struct datapath * dp , struct sk_buff * skb ,
302304 const struct sw_flow_key * key ,
303- const struct dp_upcall_info * upcall_info )
305+ const struct dp_upcall_info * upcall_info ,
306+ uint32_t cutlen )
304307{
305308 struct dp_stats_percpu * stats ;
306309 int err ;
@@ -311,9 +314,9 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
311314 }
312315
313316 if (!skb_is_gso (skb ))
314- err = queue_userspace_packet (dp , skb , key , upcall_info );
317+ err = queue_userspace_packet (dp , skb , key , upcall_info , cutlen );
315318 else
316- err = queue_gso_packets (dp , skb , key , upcall_info );
319+ err = queue_gso_packets (dp , skb , key , upcall_info , cutlen );
317320 if (err )
318321 goto err ;
319322
@@ -331,7 +334,8 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
331334
332335static int queue_gso_packets (struct datapath * dp , struct sk_buff * skb ,
333336 const struct sw_flow_key * key ,
334- const struct dp_upcall_info * upcall_info )
337+ const struct dp_upcall_info * upcall_info ,
338+ uint32_t cutlen )
335339{
336340 unsigned short gso_type = skb_shinfo (skb )-> gso_type ;
337341 struct sw_flow_key later_key ;
@@ -360,7 +364,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
360364 if (gso_type & SKB_GSO_UDP && skb != segs )
361365 key = & later_key ;
362366
363- err = queue_userspace_packet (dp , skb , key , upcall_info );
367+ err = queue_userspace_packet (dp , skb , key , upcall_info , cutlen );
364368 if (err )
365369 break ;
366370
@@ -416,7 +420,8 @@ static void pad_packet(struct datapath *dp, struct sk_buff *skb)
416420
417421static int queue_userspace_packet (struct datapath * dp , struct sk_buff * skb ,
418422 const struct sw_flow_key * key ,
419- const struct dp_upcall_info * upcall_info )
423+ const struct dp_upcall_info * upcall_info ,
424+ uint32_t cutlen )
420425{
421426 struct ovs_header * upcall ;
422427 struct sk_buff * nskb = NULL ;
@@ -461,7 +466,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
461466 else
462467 hlen = skb -> len ;
463468
464- len = upcall_msg_size (upcall_info , hlen );
469+ len = upcall_msg_size (upcall_info , hlen - cutlen );
465470 user_skb = genlmsg_new (len , GFP_ATOMIC );
466471 if (!user_skb ) {
467472 err = - ENOMEM ;
@@ -515,9 +520,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
515520 err = - ENOBUFS ;
516521 goto out ;
517522 }
518- nla -> nla_len = nla_attr_size (skb -> len );
523+ nla -> nla_len = nla_attr_size (skb -> len - cutlen );
519524
520- err = skb_zerocopy (user_skb , skb , skb -> len , hlen );
525+ err = skb_zerocopy (user_skb , skb , skb -> len - cutlen , hlen );
521526 if (err )
522527 goto out ;
523528
0 commit comments