net/ixgbe: check illegal packets
Checks
Commit Message
Some illegal packets will lead to TX hang. This patch checks those illegal
packets and protects TX from hanging.
Fixes: 7829b8d52be0 ("net/ixgbe: add Tx preparation")
Cc: stable@dpdk.org
Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++++
drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++
2 files changed, 8 insertions(+)
@@ -986,6 +986,12 @@ ixgbe_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
return i;
}
+ /* check the size of packet */
+ if (m->pkt_len < IXGBE_TX_MIN_PKT_LEN) {
+ rte_errno = EINVAL;
+ return i;
+ }
+
#ifdef RTE_LIBRTE_ETHDEV_DEBUG
ret = rte_validate_tx_offload(m);
if (ret != 0) {
@@ -53,6 +53,8 @@
#define IXGBE_TX_MAX_SEG 40
+#define IXGBE_TX_MIN_PKT_LEN 17
+
#define IXGBE_PACKET_TYPE_MASK_82599 0X7F
#define IXGBE_PACKET_TYPE_MASK_X550 0X10FF
#define IXGBE_PACKET_TYPE_MASK_TUNNEL 0XFF