1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
5 #ifndef _RTE_PMD_ICE_H_
6 #define _RTE_PMD_ICE_H_
11 * ice PMD specific functions.
13 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
19 #include <rte_mbuf_dyn.h>
26 * The supported network protocol extraction metadata format.
28 union rte_net_ice_proto_xtr_metadata {
83 /* Offset of mbuf dynamic field for protocol extraction data */
84 extern int rte_net_ice_dynfield_proto_xtr_metadata_offs;
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;
94 * The mbuf dynamic field pointer for protocol extraction metadata.
96 #define RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m) \
97 RTE_MBUF_DYNFIELD((m), \
98 rte_net_ice_dynfield_proto_xtr_metadata_offs, \
102 * The mbuf dynamic flag for VLAN protocol extraction metadata, it is valid
103 * when dev_args 'proto_xtr' has 'vlan' specified.
105 #define RTE_PKT_RX_DYNF_PROTO_XTR_VLAN \
106 (rte_net_ice_dynflag_proto_xtr_vlan_mask)
109 * The mbuf dynamic flag for IPv4 protocol extraction metadata, it is valid
110 * when dev_args 'proto_xtr' has 'ipv4' specified.
112 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV4 \
113 (rte_net_ice_dynflag_proto_xtr_ipv4_mask)
116 * The mbuf dynamic flag for IPv6 protocol extraction metadata, it is valid
117 * when dev_args 'proto_xtr' has 'ipv6' specified.
119 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6 \
120 (rte_net_ice_dynflag_proto_xtr_ipv6_mask)
123 * The mbuf dynamic flag for IPv6 with flow protocol extraction metadata, it is
124 * valid when dev_args 'proto_xtr' has 'ipv6_flow' specified.
126 #define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW \
127 (rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask)
130 * The mbuf dynamic flag for TCP protocol extraction metadata, it is valid
131 * when dev_args 'proto_xtr' has 'tcp' specified.
133 #define RTE_PKT_RX_DYNF_PROTO_XTR_TCP \
134 (rte_net_ice_dynflag_proto_xtr_tcp_mask)
137 * Check if mbuf dynamic field for protocol extraction metadata is registered.
140 * True if registered, false otherwise.
143 static __rte_always_inline int
144 rte_net_ice_dynf_proto_xtr_metadata_avail(void)
146 return rte_net_ice_dynfield_proto_xtr_metadata_offs != -1;
150 * Get the mbuf dynamic field for protocol extraction metadata.
153 * The pointer to the mbuf.
155 * The saved protocol extraction metadata.
158 static __rte_always_inline uint32_t
159 rte_net_ice_dynf_proto_xtr_metadata_get(struct rte_mbuf *m)
161 return *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m);
165 * Dump the mbuf dynamic field for protocol extraction metadata.
168 * The pointer to the mbuf.
172 rte_net_ice_dump_proto_xtr_metadata(struct rte_mbuf *m)
174 union rte_net_ice_proto_xtr_metadata data;
176 if (!rte_net_ice_dynf_proto_xtr_metadata_avail())
179 data.metadata = rte_net_ice_dynf_proto_xtr_metadata_get(m);
181 if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_VLAN)
182 printf(" - Protocol Extraction:[0x%04x:0x%04x],vlan,stag=%u:%u:%u,ctag=%u:%u:%u",
183 data.raw.data0, data.raw.data1,
190 else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IPV4)
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,
198 else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IPV6)
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,
206 else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW)
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,
211 data.ipv6_flow.flowhi4,
212 data.ipv6_flow.flowlo16);
213 else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_TCP)
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,
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" : "");
231 #endif /* _RTE_PMD_ICE_H_ */