DPDK  21.02.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  uint32_t ip_ofs;
83 };
84 
85 /* Offset of mbuf dynamic field for protocol extraction data */
86 extern int rte_net_ice_dynfield_proto_xtr_metadata_offs;
87 
88 /* Mask of mbuf dynamic flags for protocol extraction type */
89 extern uint64_t rte_net_ice_dynflag_proto_xtr_vlan_mask;
90 extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv4_mask;
91 extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_mask;
92 extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
93 extern uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;
94 extern uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
95 
99 #define RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m) \
100  RTE_MBUF_DYNFIELD((m), \
101  rte_net_ice_dynfield_proto_xtr_metadata_offs, \
102  uint32_t *)
103 
108 #define RTE_PKT_RX_DYNF_PROTO_XTR_VLAN \
109  (rte_net_ice_dynflag_proto_xtr_vlan_mask)
110 
115 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV4 \
116  (rte_net_ice_dynflag_proto_xtr_ipv4_mask)
117 
122 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6 \
123  (rte_net_ice_dynflag_proto_xtr_ipv6_mask)
124 
129 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW \
130  (rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask)
131 
136 #define RTE_PKT_RX_DYNF_PROTO_XTR_TCP \
137  (rte_net_ice_dynflag_proto_xtr_tcp_mask)
138 
143 #define RTE_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET \
144  (rte_net_ice_dynflag_proto_xtr_ip_offset_mask)
145 
152 __rte_experimental
153 static __rte_always_inline int
155 {
156  return rte_net_ice_dynfield_proto_xtr_metadata_offs != -1;
157 }
158 
167 __rte_experimental
168 static __rte_always_inline uint32_t
170 {
172 }
173 
180 __rte_experimental
181 static inline void
183 {
185 
187  return;
188 
189  data.metadata = rte_net_ice_dynf_proto_xtr_metadata_get(m);
190 
192  printf(" - Protocol Extraction:[0x%04x:0x%04x],vlan,stag=%u:%u:%u,ctag=%u:%u:%u",
193  data.raw.data0, data.raw.data1,
194  data.vlan.stag_pcp,
195  data.vlan.stag_dei,
196  data.vlan.stag_vid,
197  data.vlan.ctag_pcp,
198  data.vlan.ctag_dei,
199  data.vlan.ctag_vid);
201  printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv4,ver=%u,hdrlen=%u,tos=%u,ttl=%u,proto=%u",
202  data.raw.data0, data.raw.data1,
203  data.ipv4.version,
204  data.ipv4.ihl,
205  data.ipv4.tos,
206  data.ipv4.ttl,
207  data.ipv4.protocol);
209  printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv6,ver=%u,tc=%u,flow_hi4=0x%x,nexthdr=%u,hoplimit=%u",
210  data.raw.data0, data.raw.data1,
211  data.ipv6.version,
212  data.ipv6.tc,
213  data.ipv6.flowhi4,
214  data.ipv6.nexthdr,
215  data.ipv6.hoplimit);
217  printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv6_flow,ver=%u,tc=%u,flow=0x%x%04x",
218  data.raw.data0, data.raw.data1,
219  data.ipv6_flow.version,
220  data.ipv6_flow.tc,
221  data.ipv6_flow.flowhi4,
222  data.ipv6_flow.flowlo16);
224  printf(" - Protocol Extraction:[0x%04x:0x%04x],tcp,doff=%u,flags=%s%s%s%s%s%s%s%s",
225  data.raw.data0, data.raw.data1,
226  data.tcp.doff,
227  data.tcp.cwr ? "C" : "",
228  data.tcp.ece ? "E" : "",
229  data.tcp.urg ? "U" : "",
230  data.tcp.ack ? "A" : "",
231  data.tcp.psh ? "P" : "",
232  data.tcp.rst ? "R" : "",
233  data.tcp.syn ? "S" : "",
234  data.tcp.fin ? "F" : "");
236  printf(" - Protocol Offset:ip_offset=%u",
237  data.ip_ofs);
238 }
239 
240 #ifdef __cplusplus
241 }
242 #endif
243 
244 #endif /* _RTE_PMD_ICE_H_ */
#define __rte_always_inline
Definition: rte_common.h:226
static __rte_experimental __rte_always_inline int rte_net_ice_dynf_proto_xtr_metadata_avail(void)
Definition: rte_pmd_ice.h:154
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:169
#define RTE_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET
Definition: rte_pmd_ice.h:143
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6
Definition: rte_pmd_ice.h:122
static __rte_experimental void rte_net_ice_dump_proto_xtr_metadata(struct rte_mbuf *m)
Definition: rte_pmd_ice.h:182
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW
Definition: rte_pmd_ice.h:129
uint64_t ol_flags
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV4
Definition: rte_pmd_ice.h:115
#define RTE_PKT_RX_DYNF_PROTO_XTR_TCP
Definition: rte_pmd_ice.h:136
#define RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m)
Definition: rte_pmd_ice.h:99
#define RTE_PKT_RX_DYNF_PROTO_XTR_VLAN
Definition: rte_pmd_ice.h:108