From 6ca3a595e0f0179d044c8e3636f8454f7fc83a38 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 13 Oct 2016 16:16:06 +0200 Subject: [PATCH] mbuf: add flag for LRO When receiving coalesced packets in virtio, the original size of the segments is provided. This is a useful information because it allows to resegment with the same size. Add a RX new flag in mbuf, that can be set when packets are coalesced by a hardware or virtual driver when the m->tso_segsz field is valid and is set to the segment size of original packets. This flag is used in next commits in the virtio pmd. Signed-off-by: Olivier Matz Reviewed-by: Maxime Coquelin Reviewed-by: Yuanhan Liu --- doc/guides/rel_notes/release_16_11.rst | 2 ++ lib/librte_mbuf/rte_mbuf.c | 2 ++ lib/librte_mbuf/rte_mbuf.h | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index ada852ce8d..660c3fc930 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -52,6 +52,8 @@ New Features * Added new Rx checksum flags in mbufs to describe more states: unknown, good, bad, or not present (useful for virtual drivers). This modification was done for IP and L4. + * Added a new RX LRO mbuf flag, used when packets are coalesced. This + flag indicates that the segment size of original packets is known. * **Added vhost-user dequeue zero copy support** diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 8d9b8754b3..63f43c8975 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -319,6 +319,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask) case PKT_RX_IEEE1588_PTP: return "PKT_RX_IEEE1588_PTP"; case PKT_RX_IEEE1588_TMST: return "PKT_RX_IEEE1588_TMST"; case PKT_RX_QINQ_STRIPPED: return "PKT_RX_QINQ_STRIPPED"; + case PKT_RX_LRO: return "PKT_RX_LRO"; default: return NULL; } } @@ -352,6 +353,7 @@ rte_get_rx_ol_flag_list(uint64_t mask, char *buf, size_t buflen) { PKT_RX_IEEE1588_PTP, PKT_RX_IEEE1588_PTP, NULL }, { PKT_RX_IEEE1588_TMST, PKT_RX_IEEE1588_TMST, NULL }, { PKT_RX_QINQ_STRIPPED, PKT_RX_QINQ_STRIPPED, NULL }, + { PKT_RX_LRO, PKT_RX_LRO, NULL }, }; const char *name; unsigned int i; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 38022a399f..f5eedda492 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -170,6 +170,13 @@ extern "C" { */ #define PKT_RX_QINQ_PKT PKT_RX_QINQ_STRIPPED +/** + * When packets are coalesced by a hardware or virtual driver, this flag + * can be set in the RX mbuf, meaning that the m->tso_segsz field is + * valid and is set to the segment size of original packets. + */ +#define PKT_RX_LRO (1ULL << 16) + /* add new RX flags here */ /* add new TX flags here */ -- 2.20.1