~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/libeth/tx.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/net/libeth/tx.h (Architecture sparc64) and /include/net/libeth/tx.h (Architecture alpha)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /* Copyright (C) 2024 Intel Corporation */          2 /* Copyright (C) 2024 Intel Corporation */
  3                                                     3 
  4 #ifndef __LIBETH_TX_H                               4 #ifndef __LIBETH_TX_H
  5 #define __LIBETH_TX_H                               5 #define __LIBETH_TX_H
  6                                                     6 
  7 #include <linux/skbuff.h>                           7 #include <linux/skbuff.h>
  8                                                     8 
  9 #include <net/libeth/types.h>                       9 #include <net/libeth/types.h>
 10                                                    10 
 11 /* Tx buffer completion */                         11 /* Tx buffer completion */
 12                                                    12 
 13 /**                                                13 /**
 14  * enum libeth_sqe_type - type of &libeth_sqe      14  * enum libeth_sqe_type - type of &libeth_sqe to act on Tx completion
 15  * @LIBETH_SQE_EMPTY: unused/empty, no action      15  * @LIBETH_SQE_EMPTY: unused/empty, no action required
 16  * @LIBETH_SQE_CTX: context descriptor with em     16  * @LIBETH_SQE_CTX: context descriptor with empty SQE, no action required
 17  * @LIBETH_SQE_SLAB: kmalloc-allocated buffer,     17  * @LIBETH_SQE_SLAB: kmalloc-allocated buffer, unmap and kfree()
 18  * @LIBETH_SQE_FRAG: mapped skb frag, only unm     18  * @LIBETH_SQE_FRAG: mapped skb frag, only unmap DMA
 19  * @LIBETH_SQE_SKB: &sk_buff, unmap and napi_c     19  * @LIBETH_SQE_SKB: &sk_buff, unmap and napi_consume_skb(), update stats
 20  */                                                20  */
 21 enum libeth_sqe_type {                             21 enum libeth_sqe_type {
 22         LIBETH_SQE_EMPTY                = 0U,      22         LIBETH_SQE_EMPTY                = 0U,
 23         LIBETH_SQE_CTX,                            23         LIBETH_SQE_CTX,
 24         LIBETH_SQE_SLAB,                           24         LIBETH_SQE_SLAB,
 25         LIBETH_SQE_FRAG,                           25         LIBETH_SQE_FRAG,
 26         LIBETH_SQE_SKB,                            26         LIBETH_SQE_SKB,
 27 };                                                 27 };
 28                                                    28 
 29 /**                                                29 /**
 30  * struct libeth_sqe - represents a Send Queue     30  * struct libeth_sqe - represents a Send Queue Element / Tx buffer
 31  * @type: type of the buffer, see the enum abo     31  * @type: type of the buffer, see the enum above
 32  * @rs_idx: index of the last buffer from the      32  * @rs_idx: index of the last buffer from the batch this one was sent in
 33  * @raw: slab buffer to free via kfree()           33  * @raw: slab buffer to free via kfree()
 34  * @skb: &sk_buff to consume                       34  * @skb: &sk_buff to consume
 35  * @dma: DMA address to unmap                      35  * @dma: DMA address to unmap
 36  * @len: length of the mapped region to unmap      36  * @len: length of the mapped region to unmap
 37  * @nr_frags: number of frags in the frame thi     37  * @nr_frags: number of frags in the frame this buffer belongs to
 38  * @packets: number of physical packets sent f     38  * @packets: number of physical packets sent for this frame
 39  * @bytes: number of physical bytes sent for t     39  * @bytes: number of physical bytes sent for this frame
 40  * @priv: driver-private scratchpad                40  * @priv: driver-private scratchpad
 41  */                                                41  */
 42 struct libeth_sqe {                                42 struct libeth_sqe {
 43         enum libeth_sqe_type            type:3     43         enum libeth_sqe_type            type:32;
 44         u32                             rs_idx     44         u32                             rs_idx;
 45                                                    45 
 46         union {                                    46         union {
 47                 void                               47                 void                            *raw;
 48                 struct sk_buff                     48                 struct sk_buff                  *skb;
 49         };                                         49         };
 50                                                    50 
 51         DEFINE_DMA_UNMAP_ADDR(dma);                51         DEFINE_DMA_UNMAP_ADDR(dma);
 52         DEFINE_DMA_UNMAP_LEN(len);                 52         DEFINE_DMA_UNMAP_LEN(len);
 53                                                    53 
 54         u32                             nr_fra     54         u32                             nr_frags;
 55         u32                             packet     55         u32                             packets;
 56         u32                             bytes;     56         u32                             bytes;
 57                                                    57 
 58         unsigned long                   priv;      58         unsigned long                   priv;
 59 } __aligned_largest;                               59 } __aligned_largest;
 60                                                    60 
 61 /**                                                61 /**
 62  * LIBETH_SQE_CHECK_PRIV - check the driver's      62  * LIBETH_SQE_CHECK_PRIV - check the driver's private SQE data
 63  * @p: type or name of the object the driver w     63  * @p: type or name of the object the driver wants to fit into &libeth_sqe
 64  *                                                 64  *
 65  * Make sure the driver's private data fits in     65  * Make sure the driver's private data fits into libeth_sqe::priv. To be used
 66  * right after its declaration.                    66  * right after its declaration.
 67  */                                                67  */
 68 #define LIBETH_SQE_CHECK_PRIV(p)                   68 #define LIBETH_SQE_CHECK_PRIV(p)                                          \
 69         static_assert(sizeof(p) <= sizeof_fiel     69         static_assert(sizeof(p) <= sizeof_field(struct libeth_sqe, priv))
 70                                                    70 
 71 /**                                                71 /**
 72  * struct libeth_cq_pp - completion queue poll     72  * struct libeth_cq_pp - completion queue poll params
 73  * @dev: &device to perform DMA unmapping          73  * @dev: &device to perform DMA unmapping
 74  * @ss: onstack NAPI stats to fill                 74  * @ss: onstack NAPI stats to fill
 75  * @napi: whether it's called from the NAPI co     75  * @napi: whether it's called from the NAPI context
 76  *                                                 76  *
 77  * libeth uses this structure to access object     77  * libeth uses this structure to access objects needed for performing full
 78  * Tx complete operation without passing lots      78  * Tx complete operation without passing lots of arguments and change the
 79  * prototypes each time a new one is added.        79  * prototypes each time a new one is added.
 80  */                                                80  */
 81 struct libeth_cq_pp {                              81 struct libeth_cq_pp {
 82         struct device                   *dev;      82         struct device                   *dev;
 83         struct libeth_sq_napi_stats     *ss;       83         struct libeth_sq_napi_stats     *ss;
 84                                                    84 
 85         bool                            napi;      85         bool                            napi;
 86 };                                                 86 };
 87                                                    87 
 88 /**                                                88 /**
 89  * libeth_tx_complete - perform Tx completion      89  * libeth_tx_complete - perform Tx completion for one SQE
 90  * @sqe: SQE to complete                           90  * @sqe: SQE to complete
 91  * @cp: poll params                                91  * @cp: poll params
 92  *                                                 92  *
 93  * Do Tx complete for all the types of buffers     93  * Do Tx complete for all the types of buffers, incl. freeing, unmapping,
 94  * updating the stats etc.                         94  * updating the stats etc.
 95  */                                                95  */
 96 static inline void libeth_tx_complete(struct l     96 static inline void libeth_tx_complete(struct libeth_sqe *sqe,
 97                                       const st     97                                       const struct libeth_cq_pp *cp)
 98 {                                                  98 {
 99         switch (sqe->type) {                       99         switch (sqe->type) {
100         case LIBETH_SQE_EMPTY:                    100         case LIBETH_SQE_EMPTY:
101                 return;                           101                 return;
102         case LIBETH_SQE_SKB:                      102         case LIBETH_SQE_SKB:
103         case LIBETH_SQE_FRAG:                     103         case LIBETH_SQE_FRAG:
104         case LIBETH_SQE_SLAB:                     104         case LIBETH_SQE_SLAB:
105                 dma_unmap_page(cp->dev, dma_un    105                 dma_unmap_page(cp->dev, dma_unmap_addr(sqe, dma),
106                                dma_unmap_len(s    106                                dma_unmap_len(sqe, len), DMA_TO_DEVICE);
107                 break;                            107                 break;
108         default:                                  108         default:
109                 break;                            109                 break;
110         }                                         110         }
111                                                   111 
112         switch (sqe->type) {                      112         switch (sqe->type) {
113         case LIBETH_SQE_SKB:                      113         case LIBETH_SQE_SKB:
114                 cp->ss->packets += sqe->packet    114                 cp->ss->packets += sqe->packets;
115                 cp->ss->bytes += sqe->bytes;      115                 cp->ss->bytes += sqe->bytes;
116                                                   116 
117                 napi_consume_skb(sqe->skb, cp-    117                 napi_consume_skb(sqe->skb, cp->napi);
118                 break;                            118                 break;
119         case LIBETH_SQE_SLAB:                     119         case LIBETH_SQE_SLAB:
120                 kfree(sqe->raw);                  120                 kfree(sqe->raw);
121                 break;                            121                 break;
122         default:                                  122         default:
123                 break;                            123                 break;
124         }                                         124         }
125                                                   125 
126         sqe->type = LIBETH_SQE_EMPTY;             126         sqe->type = LIBETH_SQE_EMPTY;
127 }                                                 127 }
128                                                   128 
129 #endif /* __LIBETH_TX_H */                        129 #endif /* __LIBETH_TX_H */
130                                                   130 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php