DPDK  24.07.0
rte_pmd_iavf.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019 Intel Corporation
3  */
4 
5 #ifndef _RTE_PMD_IAVF_H_
6 #define _RTE_PMD_IAVF_H_
7 
17 #include <stdio.h>
18 #include <rte_compat.h>
19 #include <rte_mbuf.h>
20 #include <rte_mbuf_dyn.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
30  uint32_t metadata;
31 
32  struct {
33  uint16_t data0;
34  uint16_t data1;
35  } raw;
36 
37  struct {
38  uint16_t stag_vid:12,
39  stag_dei:1,
40  stag_pcp:3;
41  uint16_t ctag_vid:12,
42  ctag_dei:1,
43  ctag_pcp:3;
44  } vlan;
45 
46  struct {
47  uint16_t protocol:8,
48  ttl:8;
49  uint16_t tos:8,
50  ihl:4,
51  version:4;
52  } ipv4;
53 
54  struct {
55  uint16_t hoplimit:8,
56  nexthdr:8;
57  uint16_t flowhi4:4,
58  tc:8,
59  version:4;
60  } ipv6;
61 
62  struct {
63  uint16_t flowlo16;
64  uint16_t flowhi4:4,
65  tc:8,
66  version:4;
67  } ipv6_flow;
68 
69  struct {
70  uint16_t fin:1,
71  syn:1,
72  rst:1,
73  psh:1,
74  ack:1,
75  urg:1,
76  ece:1,
77  cwr:1,
78  res1:4,
79  doff:4;
80  uint16_t rsvd;
81  } tcp;
82 
83  uint32_t ip_ofs;
84 };
85 
86 /* Offset of mbuf dynamic field for flexible descriptor's extraction data */
87 extern int rte_pmd_ifd_dynfield_proto_xtr_metadata_offs;
88 
89 /* Mask of mbuf dynamic flags for flexible descriptor's extraction type */
90 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_vlan_mask;
91 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipv4_mask;
92 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipv6_mask;
93 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipv6_flow_mask;
94 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_tcp_mask;
95 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask;
96 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipsec_crypto_said_mask;
97 
101 #define RTE_PMD_IFD_DYNF_PROTO_XTR_METADATA(m) \
102  RTE_MBUF_DYNFIELD((m), \
103  rte_pmd_ifd_dynfield_proto_xtr_metadata_offs, \
104  uint32_t *)
105 
110 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_VLAN \
111  (rte_pmd_ifd_dynflag_proto_xtr_vlan_mask)
112 
117 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV4 \
118  (rte_pmd_ifd_dynflag_proto_xtr_ipv4_mask)
119 
124 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6 \
125  (rte_pmd_ifd_dynflag_proto_xtr_ipv6_mask)
126 
131 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW \
132  (rte_pmd_ifd_dynflag_proto_xtr_ipv6_flow_mask)
133 
138 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_TCP \
139  (rte_pmd_ifd_dynflag_proto_xtr_tcp_mask)
140 
145 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET \
146  (rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask)
147 
155 __rte_experimental
156 static __rte_always_inline int
158 {
159  return rte_pmd_ifd_dynfield_proto_xtr_metadata_offs != -1;
160 }
161 
170 __rte_experimental
171 static __rte_always_inline uint32_t
173 {
175 }
176 
183 __rte_experimental
184 static inline void
186 {
188 
190  return;
191 
192  data.metadata = rte_pmd_ifd_dynf_proto_xtr_metadata_get(m);
193 
195  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
196  "vlan,stag=%u:%u:%u,ctag=%u:%u:%u",
197  data.raw.data0, data.raw.data1,
198  data.vlan.stag_pcp,
199  data.vlan.stag_dei,
200  data.vlan.stag_vid,
201  data.vlan.ctag_pcp,
202  data.vlan.ctag_dei,
203  data.vlan.ctag_vid);
205  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
206  "ipv4,ver=%u,hdrlen=%u,tos=%u,ttl=%u,proto=%u",
207  data.raw.data0, data.raw.data1,
208  data.ipv4.version,
209  data.ipv4.ihl,
210  data.ipv4.tos,
211  data.ipv4.ttl,
212  data.ipv4.protocol);
214  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
215  "ipv6,ver=%u,tc=%u,flow_hi4=0x%x,nexthdr=%u,hoplimit=%u",
216  data.raw.data0, data.raw.data1,
217  data.ipv6.version,
218  data.ipv6.tc,
219  data.ipv6.flowhi4,
220  data.ipv6.nexthdr,
221  data.ipv6.hoplimit);
223  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
224  "ipv6_flow,ver=%u,tc=%u,flow=0x%x%04x",
225  data.raw.data0, data.raw.data1,
226  data.ipv6_flow.version,
227  data.ipv6_flow.tc,
228  data.ipv6_flow.flowhi4,
229  data.ipv6_flow.flowlo16);
231  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
232  "tcp,doff=%u,flags=%s%s%s%s%s%s%s%s",
233  data.raw.data0, data.raw.data1,
234  data.tcp.doff,
235  data.tcp.cwr ? "C" : "",
236  data.tcp.ece ? "E" : "",
237  data.tcp.urg ? "U" : "",
238  data.tcp.ack ? "A" : "",
239  data.tcp.psh ? "P" : "",
240  data.tcp.rst ? "R" : "",
241  data.tcp.syn ? "S" : "",
242  data.tcp.fin ? "F" : "");
244  printf(" - Flexible descriptor's Extraction: ip_offset=%u",
245  data.ip_ofs);
246 }
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 
252 #endif /* _RTE_PMD_IAVF_H_ */
#define __rte_always_inline
Definition: rte_common.h:370
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET
Definition: rte_pmd_iavf.h:145
static __rte_experimental __rte_always_inline uint32_t rte_pmd_ifd_dynf_proto_xtr_metadata_get(struct rte_mbuf *m)
Definition: rte_pmd_iavf.h:172
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6
Definition: rte_pmd_iavf.h:124
static __rte_experimental __rte_always_inline int rte_pmd_ifd_dynf_proto_xtr_metadata_avail(void)
Definition: rte_pmd_iavf.h:157
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW
Definition: rte_pmd_iavf.h:131
uint64_t ol_flags
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_TCP
Definition: rte_pmd_iavf.h:138
#define RTE_PMD_IFD_DYNF_PROTO_XTR_METADATA(m)
Definition: rte_pmd_iavf.h:101
static __rte_experimental void rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m)
Definition: rte_pmd_iavf.h:185
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_VLAN
Definition: rte_pmd_iavf.h:110
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV4
Definition: rte_pmd_iavf.h:117