@@ -430,28 +430,32 @@ enum {
430430 /* device driver is going to provide hardware time stamp */
431431 SKBTX_IN_PROGRESS = 1 << 2 ,
432432
433- /* device driver supports TX zero-copy buffers */
434- SKBTX_DEV_ZEROCOPY = 1 << 3 ,
435-
436433 /* generate wifi status information (where possible) */
437434 SKBTX_WIFI_STATUS = 1 << 4 ,
438435
439- /* This indicates at least one fragment might be overwritten
440- * (as in vmsplice(), sendfile() ...)
441- * If we need to compute a TX checksum, we'll need to copy
442- * all frags to avoid possible bad checksum
443- */
444- SKBTX_SHARED_FRAG = 1 << 5 ,
445-
446436 /* generate software time stamp when entering packet scheduling */
447437 SKBTX_SCHED_TSTAMP = 1 << 6 ,
448438};
449439
450- #define SKBTX_ZEROCOPY_FRAG (SKBTX_DEV_ZEROCOPY | SKBTX_SHARED_FRAG)
451440#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \
452441 SKBTX_SCHED_TSTAMP)
453442#define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP)
454443
444+ /* Definitions for flags in struct skb_shared_info */
445+ enum {
446+ /* use zcopy routines */
447+ SKBFL_ZEROCOPY_ENABLE = BIT (0 ),
448+
449+ /* This indicates at least one fragment might be overwritten
450+ * (as in vmsplice(), sendfile() ...)
451+ * If we need to compute a TX checksum, we'll need to copy
452+ * all frags to avoid possible bad checksum
453+ */
454+ SKBFL_SHARED_FRAG = BIT (1 ),
455+ };
456+
457+ #define SKBFL_ZEROCOPY_FRAG (SKBFL_ZEROCOPY_ENABLE | SKBFL_SHARED_FRAG)
458+
455459/*
456460 * The callback notifies userspace to release buffers when skb DMA is done in
457461 * lower device, the skb last reference should be 0 when calling this.
@@ -506,7 +510,7 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
506510 * the end of the header data, ie. at skb->end.
507511 */
508512struct skb_shared_info {
509- __u8 __unused ;
513+ __u8 flags ;
510514 __u8 meta_len ;
511515 __u8 nr_frags ;
512516 __u8 tx_flags ;
@@ -1433,7 +1437,7 @@ static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
14331437
14341438static inline struct ubuf_info * skb_zcopy (struct sk_buff * skb )
14351439{
1436- bool is_zcopy = skb && skb_shinfo (skb )-> tx_flags & SKBTX_DEV_ZEROCOPY ;
1440+ bool is_zcopy = skb && skb_shinfo (skb )-> flags & SKBFL_ZEROCOPY_ENABLE ;
14371441
14381442 return is_zcopy ? skb_uarg (skb ) : NULL ;
14391443}
@@ -1452,14 +1456,14 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg,
14521456 else
14531457 skb_zcopy_get (uarg );
14541458 skb_shinfo (skb )-> destructor_arg = uarg ;
1455- skb_shinfo (skb )-> tx_flags |= SKBTX_ZEROCOPY_FRAG ;
1459+ skb_shinfo (skb )-> flags |= SKBFL_ZEROCOPY_FRAG ;
14561460 }
14571461}
14581462
14591463static inline void skb_zcopy_set_nouarg (struct sk_buff * skb , void * val )
14601464{
14611465 skb_shinfo (skb )-> destructor_arg = (void * )((uintptr_t ) val | 0x1UL );
1462- skb_shinfo (skb )-> tx_flags |= SKBTX_ZEROCOPY_FRAG ;
1466+ skb_shinfo (skb )-> flags |= SKBFL_ZEROCOPY_FRAG ;
14631467}
14641468
14651469static inline bool skb_zcopy_is_nouarg (struct sk_buff * skb )
@@ -1497,7 +1501,7 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy_success)
14971501 if (!skb_zcopy_is_nouarg (skb ))
14981502 uarg -> callback (skb , uarg , zerocopy_success );
14991503
1500- skb_shinfo (skb )-> tx_flags &= ~SKBTX_ZEROCOPY_FRAG ;
1504+ skb_shinfo (skb )-> flags &= ~SKBFL_ZEROCOPY_FRAG ;
15011505 }
15021506}
15031507
@@ -3323,7 +3327,7 @@ static inline int skb_linearize(struct sk_buff *skb)
33233327static inline bool skb_has_shared_frag (const struct sk_buff * skb )
33243328{
33253329 return skb_is_nonlinear (skb ) &&
3326- skb_shinfo (skb )-> tx_flags & SKBTX_SHARED_FRAG ;
3330+ skb_shinfo (skb )-> flags & SKBFL_SHARED_FRAG ;
33273331}
33283332
33293333/**
0 commit comments