DPDK  20.11.10
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_mbuf.h>
19 #include <rte_mbuf_dyn.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
29  uint32_t metadata;
30 
31  struct {
32  uint16_t data0;
33  uint16_t data1;
34  } raw;
35 
36  struct {
37  uint16_t stag_vid:12,
38  stag_dei:1,
39  stag_pcp:3;
40  uint16_t ctag_vid:12,
41  ctag_dei:1,
42  ctag_pcp:3;
43  } vlan;
44 
45  struct {
46  uint16_t protocol:8,
47  ttl:8;
48  uint16_t tos:8,
49  ihl:4,
50  version:4;
51  } ipv4;
52 
53  struct {
54  uint16_t hoplimit:8,
55  nexthdr:8;
56  uint16_t flowhi4:4,
57  tc:8,
58  version:4;
59  } ipv6;
60 
61  struct {
62  uint16_t flowlo16;
63  uint16_t flowhi4:4,
64  tc:8,
65  version:4;
66  } ipv6_flow;
67 
68  struct {
69  uint16_t fin:1,
70  syn:1,
71  rst:1,
72  psh:1,
73  ack:1,
74  urg:1,
75  ece:1,
76  cwr:1,
77  res1:4,
78  doff:4;
79  uint16_t rsvd;
80  } tcp;
81 
82  uint32_t ip_ofs;
83 };
84 
85 /* Offset of mbuf dynamic field for flexible descriptor's extraction data */
86 extern int rte_pmd_ifd_dynfield_proto_xtr_metadata_offs;
87 
88 /* Mask of mbuf dynamic flags for flexible descriptor's extraction type */
89 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_vlan_mask;
90 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipv4_mask;
91 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipv6_mask;
92 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipv6_flow_mask;
93 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_tcp_mask;
94 extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask;
95 
99 #define RTE_PMD_IFD_DYNF_PROTO_XTR_METADATA(m) \
100  RTE_MBUF_DYNFIELD((m), \
101  rte_pmd_ifd_dynfield_proto_xtr_metadata_offs, \
102  uint32_t *)
103 
108 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_VLAN \
109  (rte_pmd_ifd_dynflag_proto_xtr_vlan_mask)
110 
115 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV4 \
116  (rte_pmd_ifd_dynflag_proto_xtr_ipv4_mask)
117 
122 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6 \
123  (rte_pmd_ifd_dynflag_proto_xtr_ipv6_mask)
124 
129 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW \
130  (rte_pmd_ifd_dynflag_proto_xtr_ipv6_flow_mask)
131 
136 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_TCP \
137  (rte_pmd_ifd_dynflag_proto_xtr_tcp_mask)
138 
143 #define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET \
144  (rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask)
145 
153 __rte_experimental
154 static __rte_always_inline int
156 {
157  return rte_pmd_ifd_dynfield_proto_xtr_metadata_offs != -1;
158 }
159 
168 __rte_experimental
169 static __rte_always_inline uint32_t
171 {
173 }
174 
181 __rte_experimental
182 static inline void
184 {
186 
188  return;
189 
190  data.metadata = rte_pmd_ifd_dynf_proto_xtr_metadata_get(m);
191 
193  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
194  "vlan,stag=%u:%u:%u,ctag=%u:%u:%u",
195  data.raw.data0, data.raw.data1,
196  data.vlan.stag_pcp,
197  data.vlan.stag_dei,
198  data.vlan.stag_vid,
199  data.vlan.ctag_pcp,
200  data.vlan.ctag_dei,
201  data.vlan.ctag_vid);
203  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
204  "ipv4,ver=%u,hdrlen=%u,tos=%u,ttl=%u,proto=%u",
205  data.raw.data0, data.raw.data1,
206  data.ipv4.version,
207  data.ipv4.ihl,
208  data.ipv4.tos,
209  data.ipv4.ttl,
210  data.ipv4.protocol);
212  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
213  "ipv6,ver=%u,tc=%u,flow_hi4=0x%x,nexthdr=%u,hoplimit=%u",
214  data.raw.data0, data.raw.data1,
215  data.ipv6.version,
216  data.ipv6.tc,
217  data.ipv6.flowhi4,
218  data.ipv6.nexthdr,
219  data.ipv6.hoplimit);
221  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
222  "ipv6_flow,ver=%u,tc=%u,flow=0x%x%04x",
223  data.raw.data0, data.raw.data1,
224  data.ipv6_flow.version,
225  data.ipv6_flow.tc,
226  data.ipv6_flow.flowhi4,
227  data.ipv6_flow.flowlo16);
229  printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x],"
230  "tcp,doff=%u,flags=%s%s%s%s%s%s%s%s",
231  data.raw.data0, data.raw.data1,
232  data.tcp.doff,
233  data.tcp.cwr ? "C" : "",
234  data.tcp.ece ? "E" : "",
235  data.tcp.urg ? "U" : "",
236  data.tcp.ack ? "A" : "",
237  data.tcp.psh ? "P" : "",
238  data.tcp.rst ? "R" : "",
239  data.tcp.syn ? "S" : "",
240  data.tcp.fin ? "F" : "");
242  printf(" - Flexible descriptor's Extraction: ip_offset=%u",
243  data.ip_ofs);
244 }
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* _RTE_PMD_IAVF_H_ */
#define __rte_always_inline
Definition: rte_common.h:231
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET
Definition: rte_pmd_iavf.h:143
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:170
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6
Definition: rte_pmd_iavf.h:122
static __rte_experimental __rte_always_inline int rte_pmd_ifd_dynf_proto_xtr_metadata_avail(void)
Definition: rte_pmd_iavf.h:155
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW
Definition: rte_pmd_iavf.h:129
uint64_t ol_flags
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_TCP
Definition: rte_pmd_iavf.h:136
#define RTE_PMD_IFD_DYNF_PROTO_XTR_METADATA(m)
Definition: rte_pmd_iavf.h:99
static __rte_experimental void rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m)
Definition: rte_pmd_iavf.h:183
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_VLAN
Definition: rte_pmd_iavf.h:108
#define RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IPV4
Definition: rte_pmd_iavf.h:115