[v12,01/22] gso: don't log message on non TCP/UDP

Message ID 20230329234049.11071-2-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Covert static log types in libraries to dynamic |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger March 29, 2023, 11:40 p.m. UTC
  If a large packet is passed into GSO routines of unknown protocol
then library would log a message.
Better to tell the application instead of logging.

Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO")
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/gso/rte_gso.c | 4 +---
 lib/gso/rte_gso.h | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)
  

Patch

diff --git a/lib/gso/rte_gso.c b/lib/gso/rte_gso.c
index 4b59217c16ee..e29c7d884aed 100644
--- a/lib/gso/rte_gso.c
+++ b/lib/gso/rte_gso.c
@@ -80,9 +80,7 @@  rte_gso_segment(struct rte_mbuf *pkt,
 		ret = gso_udp4_segment(pkt, gso_size, direct_pool,
 				indirect_pool, pkts_out, nb_pkts_out);
 	} else {
-		/* unsupported packet, skip */
-		RTE_LOG(DEBUG, GSO, "Unsupported packet type\n");
-		ret = 0;
+		ret = -ENOTSUP;	/* only UDP or TCP allowed */
 	}
 
 	if (ret < 0) {
diff --git a/lib/gso/rte_gso.h b/lib/gso/rte_gso.h
index 40922524df42..c0f9a1b66ff2 100644
--- a/lib/gso/rte_gso.h
+++ b/lib/gso/rte_gso.h
@@ -114,6 +114,7 @@  struct rte_gso_ctx {
  *  - The number of GSO segments filled in pkts_out on success.
  *  - Return 0 if it does not need to be GSO'd.
  *  - Return -ENOMEM if run out of memory in MBUF pools.
+ *  - Return -ENOTSUP for protocols that can not be segmented
  *  - Return -EINVAL for invalid parameters.
  */
 int rte_gso_segment(struct rte_mbuf *pkt,