DPDK  20.05.0
rte_pmd_ice.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_ICE_H_
6 #define _RTE_PMD_ICE_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 
83 /* Offset of mbuf dynamic field for protocol extraction data */
84 extern int rte_net_ice_dynfield_proto_xtr_metadata_offs;
85 
86 /* Mask of mbuf dynamic flags for protocol extraction type */
87 extern uint64_t rte_net_ice_dynflag_proto_xtr_vlan_mask;
88 extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv4_mask;
89 extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_mask;
90 extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
91 extern uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;
92 
96 #define RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m) \
97  RTE_MBUF_DYNFIELD((m), \
98  rte_net_ice_dynfield_proto_xtr_metadata_offs, \
99  uint32_t *)
100 
105 #define RTE_PKT_RX_DYNF_PROTO_XTR_VLAN \
106  (rte_net_ice_dynflag_proto_xtr_vlan_mask)
107 
112 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV4 \
113  (rte_net_ice_dynflag_proto_xtr_ipv4_mask)
114 
119 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6 \
120  (rte_net_ice_dynflag_proto_xtr_ipv6_mask)
121 
126 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW \
127  (rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask)
128 
133 #define RTE_PKT_RX_DYNF_PROTO_XTR_TCP \
134  (rte_net_ice_dynflag_proto_xtr_tcp_mask)
135 
142 __rte_experimental
143 static __rte_always_inline int
145 {
146  return rte_net_ice_dynfield_proto_xtr_metadata_offs != -1;
147 }
148 
157 __rte_experimental
158 static __rte_always_inline uint32_t
160 {
162 }
163 
170 __rte_experimental
171 static inline void
173 {
175 
177  return;
178 
179  data.metadata = rte_net_ice_dynf_proto_xtr_metadata_get(m);
180 
182  printf(" - Protocol Extraction:[0x%04x:0x%04x],vlan,stag=%u:%u:%u,ctag=%u:%u:%u",
183  data.raw.data0, data.raw.data1,
184  data.vlan.stag_pcp,
185  data.vlan.stag_dei,
186  data.vlan.stag_vid,
187  data.vlan.ctag_pcp,
188  data.vlan.ctag_dei,
189  data.vlan.ctag_vid);
191  printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv4,ver=%u,hdrlen=%u,tos=%u,ttl=%u,proto=%u",
192  data.raw.data0, data.raw.data1,
193  data.ipv4.version,
194  data.ipv4.ihl,
195  data.ipv4.tos,
196  data.ipv4.ttl,
197  data.ipv4.protocol);
199  printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv6,ver=%u,tc=%u,flow_hi4=0x%x,nexthdr=%u,hoplimit=%u",
200  data.raw.data0, data.raw.data1,
201  data.ipv6.version,
202  data.ipv6.tc,
203  data.ipv6.flowhi4,
204  data.ipv6.nexthdr,
205  data.ipv6.hoplimit);
207  printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv6_flow,ver=%u,tc=%u,flow=0x%x%04x",
208  data.raw.data0, data.raw.data1,
209  data.ipv6_flow.version,
210  data.ipv6_flow.tc,
211  data.ipv6_flow.flowhi4,
212  data.ipv6_flow.flowlo16);
214  printf(" - Protocol Extraction:[0x%04x:0x%04x],tcp,doff=%u,flags=%s%s%s%s%s%s%s%s",
215  data.raw.data0, data.raw.data1,
216  data.tcp.doff,
217  data.tcp.cwr ? "C" : "",
218  data.tcp.ece ? "E" : "",
219  data.tcp.urg ? "U" : "",
220  data.tcp.ack ? "A" : "",
221  data.tcp.psh ? "P" : "",
222  data.tcp.rst ? "R" : "",
223  data.tcp.syn ? "S" : "",
224  data.tcp.fin ? "F" : "");
225 }
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* _RTE_PMD_ICE_H_ */
#define __rte_always_inline
Definition: rte_common.h:193
static __rte_experimental __rte_always_inline int rte_net_ice_dynf_proto_xtr_metadata_avail(void)
Definition: rte_pmd_ice.h:144
static __rte_experimental __rte_always_inline uint32_t rte_net_ice_dynf_proto_xtr_metadata_get(struct rte_mbuf *m)
Definition: rte_pmd_ice.h:159
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6
Definition: rte_pmd_ice.h:119
static __rte_experimental void rte_net_ice_dump_proto_xtr_metadata(struct rte_mbuf *m)
Definition: rte_pmd_ice.h:172
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW
Definition: rte_pmd_ice.h:126
uint64_t ol_flags
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV4
Definition: rte_pmd_ice.h:112
#define RTE_PKT_RX_DYNF_PROTO_XTR_TCP
Definition: rte_pmd_ice.h:133
#define RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m)
Definition: rte_pmd_ice.h:96
#define RTE_PKT_RX_DYNF_PROTO_XTR_VLAN
Definition: rte_pmd_ice.h:105