diff options
Diffstat (limited to 'lib/librte_mbuf')
-rw-r--r-- | lib/librte_mbuf/meson.build | 2 | ||||
-rw-r--r-- | lib/librte_mbuf/rte_mbuf.c | 53 | ||||
-rw-r--r-- | lib/librte_mbuf/rte_mbuf.h | 130 | ||||
-rw-r--r-- | lib/librte_mbuf/rte_mbuf_ptype.c | 3 | ||||
-rw-r--r-- | lib/librte_mbuf/rte_mbuf_ptype.h | 22 |
5 files changed, 150 insertions, 60 deletions
diff --git a/lib/librte_mbuf/meson.build b/lib/librte_mbuf/meson.build index 45ffb0db..94d9c4c9 100644 --- a/lib/librte_mbuf/meson.build +++ b/lib/librte_mbuf/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -version = 3 +version = 4 sources = files('rte_mbuf.c', 'rte_mbuf_ptype.c', 'rte_mbuf_pool_ops.c') headers = files('rte_mbuf.h', 'rte_mbuf_ptype.h', 'rte_mbuf_pool_ops.h') deps += ['mempool'] diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index e714c5a5..9790b4fb 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -296,11 +296,19 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_VLAN_STRIPPED: return "PKT_RX_VLAN_STRIPPED"; case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP"; case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST"; + case PKT_RX_FDIR_ID: return "PKT_RX_FDIR_ID"; + case PKT_RX_FDIR_FLX: return "PKT_RX_FDIR_FLX"; case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED"; + case PKT_RX_QINQ: return "PKT_RX_QINQ"; case PKT_RX_LRO: return "PKT_RX_LRO"; case PKT_RX_TIMESTAMP: return "PKT_RX_TIMESTAMP"; case PKT_RX_SEC_OFFLOAD: return "PKT_RX_SEC_OFFLOAD"; case PKT_RX_SEC_OFFLOAD_FAILED: return "PKT_RX_SEC_OFFLOAD_FAILED"; + case PKT_RX_OUTER_L4_CKSUM_BAD: return "PKT_RX_OUTER_L4_CKSUM_BAD"; + case PKT_RX_OUTER_L4_CKSUM_GOOD: return "PKT_RX_OUTER_L4_CKSUM_GOOD"; + case PKT_RX_OUTER_L4_CKSUM_INVALID: + return "PKT_RX_OUTER_L4_CKSUM_INVALID"; + default: return NULL; } } @@ -333,12 +341,21 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { PKT_RX_VLAN_STRIPPED, PKT_RX_VLAN_STRIPPED, NULL }, { PKT_RX_IEEE1588_PTP, PKT_RX_IEEE1588_PTP, NULL }, { PKT_RX_IEEE1588_TMST, PKT_RX_IEEE1588_TMST, NULL }, + { PKT_RX_FDIR_ID, PKT_RX_FDIR_ID, NULL }, + { PKT_RX_FDIR_FLX, PKT_RX_FDIR_FLX, NULL }, { PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL }, { PKT_RX_LRO, PKT_RX_LRO, NULL }, { PKT_RX_TIMESTAMP, PKT_RX_TIMESTAMP, NULL }, { PKT_RX_SEC_OFFLOAD, PKT_RX_SEC_OFFLOAD, NULL }, { PKT_RX_SEC_OFFLOAD_FAILED, PKT_RX_SEC_OFFLOAD_FAILED, NULL }, { PKT_RX_QINQ, PKT_RX_QINQ, NULL }, + { PKT_RX_OUTER_L4_CKSUM_BAD, PKT_RX_OUTER_L4_CKSUM_MASK, NULL }, + { PKT_RX_OUTER_L4_CKSUM_GOOD, PKT_RX_OUTER_L4_CKSUM_MASK, + NULL }, + { PKT_RX_OUTER_L4_CKSUM_INVALID, PKT_RX_OUTER_L4_CKSUM_MASK, + NULL }, + { PKT_RX_OUTER_L4_CKSUM_UNKNOWN, PKT_RX_OUTER_L4_CKSUM_MASK, + "PKT_RX_OUTER_L4_CKSUM_UNKNOWN" }, }; const char *name; unsigned int i; @@ -373,7 +390,7 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) const char *rte_get_tx_ol_flag_name(uint64_t mask) { switch (mask) { - case PKT_TX_VLAN_PKT: return "PKT_TX_VLAN_PKT"; + case PKT_TX_VLAN: return "PKT_TX_VLAN"; case PKT_TX_IP_CKSUM: return "PKT_TX_IP_CKSUM"; case PKT_TX_TCP_CKSUM: return "PKT_TX_TCP_CKSUM"; case PKT_TX_SCTP_CKSUM: return "PKT_TX_SCTP_CKSUM"; @@ -393,8 +410,12 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask) case PKT_TX_TUNNEL_VXLAN_GPE: return "PKT_TX_TUNNEL_VXLAN_GPE"; case PKT_TX_TUNNEL_IP: return "PKT_TX_TUNNEL_IP"; case PKT_TX_TUNNEL_UDP: return "PKT_TX_TUNNEL_UDP"; + case PKT_TX_QINQ: return "PKT_TX_QINQ"; case PKT_TX_MACSEC: return "PKT_TX_MACSEC"; case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD"; + case PKT_TX_UDP_SEG: return "PKT_TX_UDP_SEG"; + case PKT_TX_OUTER_UDP_CKSUM: return "PKT_TX_OUTER_UDP_CKSUM"; + case PKT_TX_METADATA: return "PKT_TX_METADATA"; default: return NULL; } } @@ -404,7 +425,7 @@ int rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { const struct flag_mask tx_flags[] = { - { PKT_TX_VLAN_PKT, PKT_TX_VLAN_PKT, NULL }, + { PKT_TX_VLAN, PKT_TX_VLAN, NULL }, { PKT_TX_IP_CKSUM, PKT_TX_IP_CKSUM, NULL }, { PKT_TX_TCP_CKSUM, PKT_TX_L4_MASK, NULL }, { PKT_TX_SCTP_CKSUM, PKT_TX_L4_MASK, NULL }, @@ -417,24 +438,20 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { PKT_TX_OUTER_IP_CKSUM, PKT_TX_OUTER_IP_CKSUM, NULL }, { PKT_TX_OUTER_IPV4, PKT_TX_OUTER_IPV4, NULL }, { PKT_TX_OUTER_IPV6, PKT_TX_OUTER_IPV6, NULL }, - { PKT_TX_TUNNEL_VXLAN, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_GRE, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_IPIP, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_GENEVE, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_VXLAN_GPE, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_IP, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, - { PKT_TX_TUNNEL_UDP, PKT_TX_TUNNEL_MASK, - "PKT_TX_TUNNEL_NONE" }, + { PKT_TX_TUNNEL_VXLAN, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_GRE, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_IPIP, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_GENEVE, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_VXLAN_GPE, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_IP, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_TUNNEL_UDP, PKT_TX_TUNNEL_MASK, NULL }, + { PKT_TX_QINQ, PKT_TX_QINQ, NULL }, { PKT_TX_MACSEC, PKT_TX_MACSEC, NULL }, { PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL }, + { PKT_TX_UDP_SEG, PKT_TX_UDP_SEG, NULL }, + { PKT_TX_OUTER_UDP_CKSUM, PKT_TX_OUTER_UDP_CKSUM, NULL }, + { PKT_TX_METADATA, PKT_TX_METADATA, NULL }, }; const char *name; unsigned int i; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 9ce5d76d..3dbc6695 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -140,7 +140,7 @@ extern "C" { * The 2 vlans have been stripped by the hardware and their tci are * saved in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer). * This can only happen if vlan stripping is enabled in the RX - * configuration of the PMD. If this flag is set, + * configuration of the PMD. * When PKT_RX_QINQ_STRIPPED is set, the flags (PKT_RX_VLAN | * PKT_RX_VLAN_STRIPPED | PKT_RX_QINQ) must also be set. */ @@ -170,18 +170,54 @@ extern "C" { /** * The RX packet is a double VLAN, and the outer tci has been - * saved in in mbuf->vlan_tci_outer. + * saved in in mbuf->vlan_tci_outer. If PKT_RX_QINQ set, PKT_RX_VLAN + * also should be set and inner tci should be saved to mbuf->vlan_tci. * If the flag PKT_RX_QINQ_STRIPPED is also present, both VLANs * headers have been stripped from mbuf data, else they are still * present. */ #define PKT_RX_QINQ (1ULL << 20) +/** + * Mask of bits used to determine the status of outer RX L4 checksum. + * - PKT_RX_OUTER_L4_CKSUM_UNKNOWN: no info about the outer RX L4 checksum + * - PKT_RX_OUTER_L4_CKSUM_BAD: the outer L4 checksum in the packet is wrong + * - PKT_RX_OUTER_L4_CKSUM_GOOD: the outer L4 checksum in the packet is valid + * - PKT_RX_OUTER_L4_CKSUM_INVALID: invalid outer L4 checksum state. + * + * The detection of PKT_RX_OUTER_L4_CKSUM_GOOD shall be based on the given + * HW capability, At minimum, the PMD should support + * PKT_RX_OUTER_L4_CKSUM_UNKNOWN and PKT_RX_OUTER_L4_CKSUM_BAD states + * if the DEV_RX_OFFLOAD_OUTER_UDP_CKSUM offload is available. + */ +#define PKT_RX_OUTER_L4_CKSUM_MASK ((1ULL << 21) | (1ULL << 22)) + +#define PKT_RX_OUTER_L4_CKSUM_UNKNOWN 0 +#define PKT_RX_OUTER_L4_CKSUM_BAD (1ULL << 21) +#define PKT_RX_OUTER_L4_CKSUM_GOOD (1ULL << 22) +#define PKT_RX_OUTER_L4_CKSUM_INVALID ((1ULL << 21) | (1ULL << 22)) + /* add new RX flags here */ /* add new TX flags here */ /** + * Indicate that the metadata field in the mbuf is in use. + */ +#define PKT_TX_METADATA (1ULL << 40) + +/** + * Outer UDP checksum offload flag. This flag is used for enabling + * outer UDP checksum in PMD. To use outer UDP checksum, the user needs to + * 1) Enable the following in mbuff, + * a) Fill outer_l2_len and outer_l3_len in mbuf. + * b) Set the PKT_TX_OUTER_UDP_CKSUM flag. + * c) Set the PKT_TX_OUTER_IPV4 or PKT_TX_OUTER_IPV6 flag. + * 2) Configure DEV_TX_OFFLOAD_OUTER_UDP_CKSUM offload flag. + */ +#define PKT_TX_OUTER_UDP_CKSUM (1ULL << 41) + +/** * UDP Fragmentation Offload flag. This flag is used for enabling UDP * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used * to store the MSS of UDP fragments. @@ -334,16 +370,23 @@ extern "C" { * which can be set for packet. */ #define PKT_TX_OFFLOAD_MASK ( \ + PKT_TX_OUTER_IPV6 | \ + PKT_TX_OUTER_IPV4 | \ + PKT_TX_OUTER_IP_CKSUM | \ + PKT_TX_VLAN_PKT | \ + PKT_TX_IPV6 | \ + PKT_TX_IPV4 | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_OUTER_IP_CKSUM | \ - PKT_TX_TCP_SEG | \ PKT_TX_IEEE1588_TMST | \ + PKT_TX_TCP_SEG | \ PKT_TX_QINQ_PKT | \ - PKT_TX_VLAN_PKT | \ PKT_TX_TUNNEL_MASK | \ PKT_TX_MACSEC | \ - PKT_TX_SEC_OFFLOAD) + PKT_TX_SEC_OFFLOAD | \ + PKT_TX_UDP_SEG | \ + PKT_TX_OUTER_UDP_CKSUM | \ + PKT_TX_METADATA) /** * Mbuf having an external buffer attached. shinfo in mbuf must be filled. @@ -464,7 +507,9 @@ struct rte_mbuf { }; uint16_t nb_segs; /**< Number of segments. */ - /** Input port (16 bits to support more than 256 virtual ports). */ + /** Input port (16 bits to support more than 256 virtual ports). + * The event eth Tx adapter uses this field to specify the output port. + */ uint16_t port; uint64_t ol_flags; /**< Offload features. */ @@ -511,28 +556,47 @@ struct rte_mbuf { /** VLAN TCI (CPU order), valid if PKT_RX_VLAN is set. */ uint16_t vlan_tci; + RTE_STD_C11 union { - uint32_t rss; /**< RSS hash result if RSS enabled */ - struct { - RTE_STD_C11 - union { - struct { - uint16_t hash; - uint16_t id; + union { + uint32_t rss; /**< RSS hash result if RSS enabled */ + struct { + union { + struct { + uint16_t hash; + uint16_t id; + }; + uint32_t lo; + /**< Second 4 flexible bytes */ }; + uint32_t hi; + /**< First 4 flexible bytes or FD ID, dependent + * on PKT_RX_FDIR_* flag in ol_flags. + */ + } fdir; /**< Filter identifier if FDIR enabled */ + struct { uint32_t lo; - /**< Second 4 flexible bytes */ - }; - uint32_t hi; - /**< First 4 flexible bytes or FD ID, dependent on - PKT_RX_FDIR_* flag in ol_flags. */ - } fdir; /**< Filter identifier if FDIR enabled */ + uint32_t hi; + /**< The event eth Tx adapter uses this field + * to store Tx queue id. + * @see rte_event_eth_tx_adapter_txq_set() + */ + } sched; /**< Hierarchical scheduler */ + /**< User defined tags. See rte_distributor_process() */ + uint32_t usr; + } hash; /**< hash information */ struct { - uint32_t lo; - uint32_t hi; - } sched; /**< Hierarchical scheduler */ - uint32_t usr; /**< User defined tags. See rte_distributor_process() */ - } hash; /**< hash information */ + /** + * Application specific metadata value + * for egress flow rule match. + * Valid if PKT_TX_METADATA is set. + * Located here to allow conjunct use + * with hash.sched.hi. + */ + uint32_t tx_metadata; + uint32_t reserved; + }; + }; /** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ is set. */ uint16_t vlan_tci_outer; @@ -1038,14 +1102,6 @@ rte_mbuf_raw_free(struct rte_mbuf *m) rte_mempool_put(m->pool, m); } -/* compat with older versions */ -__rte_deprecated -static inline void -__rte_mbuf_raw_free(struct rte_mbuf *m) -{ - rte_mbuf_raw_free(m); -} - /** * The packet mbuf constructor. * @@ -1658,14 +1714,6 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) return NULL; } -/* deprecated, replaced by rte_pktmbuf_prefree_seg() */ -__rte_deprecated -static inline struct rte_mbuf * -__rte_pktmbuf_prefree_seg(struct rte_mbuf *m) -{ - return rte_pktmbuf_prefree_seg(m); -} - /** * Free a segment of a packet mbuf into its original mempool. * diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c index d7835e28..d6f906b0 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.c +++ b/lib/librte_mbuf/rte_mbuf_ptype.c @@ -19,6 +19,8 @@ const char *rte_get_ptype_l2_name(uint32_t ptype) case RTE_PTYPE_L2_ETHER_VLAN: return "L2_ETHER_VLAN"; case RTE_PTYPE_L2_ETHER_QINQ: return "L2_ETHER_QINQ"; case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE"; + case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE"; + case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS"; default: return "L2_UNKNOWN"; } } @@ -47,6 +49,7 @@ const char *rte_get_ptype_l4_name(uint32_t ptype) case RTE_PTYPE_L4_SCTP: return "L4_SCTP"; case RTE_PTYPE_L4_ICMP: return "L4_ICMP"; case RTE_PTYPE_L4_NONFRAG: return "L4_NONFRAG"; + case RTE_PTYPE_L4_IGMP: return "L4_IGMP"; default: return "L4_UNKNOWN"; } } diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h index 01acc66e..23bc635f 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.h +++ b/lib/librte_mbuf/rte_mbuf_ptype.h @@ -131,6 +131,20 @@ extern "C" { */ #define RTE_PTYPE_L2_ETHER_PPPOE 0x00000008 /** + * FCoE packet type. + * + * Packet format: + * <'ether type'=[0x8906]> + */ +#define RTE_PTYPE_L2_ETHER_FCOE 0x00000009 +/** + * MPLS packet type. + * + * Packet format: + * <'ether type'=[0x8847|0x8848]> + */ +#define RTE_PTYPE_L2_ETHER_MPLS 0x0000000a +/** * Mask of layer 2 packet types. * It is used for outer packet for tunneling cases. */ @@ -287,6 +301,14 @@ extern "C" { */ #define RTE_PTYPE_L4_NONFRAG 0x00000600 /** + * IGMP (Internet Group Management Protocol) packet type. + * + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=2, 'MF'=0, 'frag_offset'=0> + */ +#define RTE_PTYPE_L4_IGMP 0x00000700 +/** * Mask of layer 4 packet types. * It is used for outer packet for tunneling cases. */ |