DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] net/ixgbe: check illegal packets
@ 2020-02-14  7:19 Xiao Zhang
  2020-02-17 14:51 ` [dpdk-dev] [v2] " Xiao Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Xiao Zhang @ 2020-02-14  7:19 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, konstantin.ananyev, Xiao Zhang, stable

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(+)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 7b398f1..f839bca 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -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) {
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index 000c5b1..31dbdfc 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -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
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [v2] net/ixgbe: check illegal packets
  2020-02-14  7:19 [dpdk-dev] net/ixgbe: check illegal packets Xiao Zhang
@ 2020-02-17 14:51 ` Xiao Zhang
  2020-02-17 15:09   ` Ananyev, Konstantin
  2020-02-17 16:00   ` Ye Xiaolong
  0 siblings, 2 replies; 4+ messages in thread
From: Xiao Zhang @ 2020-02-17 14:51 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, konstantin.ananyev, Xiao Zhang, stable

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>
---
v2 change the minimum packet length according to the datasheet.
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++++
 drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 7b398f1..f839bca 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -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) {
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index 000c5b1..20a8b29 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -53,6 +53,8 @@
 
 #define IXGBE_TX_MAX_SEG                    40
 
+#define IXGBE_TX_MIN_PKT_LEN		     14
+
 #define IXGBE_PACKET_TYPE_MASK_82599        0X7F
 #define IXGBE_PACKET_TYPE_MASK_X550         0X10FF
 #define IXGBE_PACKET_TYPE_MASK_TUNNEL       0XFF
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [v2] net/ixgbe: check illegal packets
  2020-02-17 14:51 ` [dpdk-dev] [v2] " Xiao Zhang
@ 2020-02-17 15:09   ` Ananyev, Konstantin
  2020-02-17 16:00   ` Ye Xiaolong
  1 sibling, 0 replies; 4+ messages in thread
From: Ananyev, Konstantin @ 2020-02-17 15:09 UTC (permalink / raw)
  To: Zhang, Xiao, dev; +Cc: Lu, Wenzhuo, stable


> 
> 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>
> ---
> v2 change the minimum packet length according to the datasheet.
> ---
>  drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++++
>  drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index 7b398f1..f839bca 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -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) {
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
> index 000c5b1..20a8b29 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.h
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.h
> @@ -53,6 +53,8 @@
> 
>  #define IXGBE_TX_MAX_SEG                    40
> 
> +#define IXGBE_TX_MIN_PKT_LEN		     14
> +
>  #define IXGBE_PACKET_TYPE_MASK_82599        0X7F
>  #define IXGBE_PACKET_TYPE_MASK_X550         0X10FF
>  #define IXGBE_PACKET_TYPE_MASK_TUNNEL       0XFF
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [v2] net/ixgbe: check illegal packets
  2020-02-17 14:51 ` [dpdk-dev] [v2] " Xiao Zhang
  2020-02-17 15:09   ` Ananyev, Konstantin
@ 2020-02-17 16:00   ` Ye Xiaolong
  1 sibling, 0 replies; 4+ messages in thread
From: Ye Xiaolong @ 2020-02-17 16:00 UTC (permalink / raw)
  To: Xiao Zhang; +Cc: dev, wenzhuo.lu, konstantin.ananyev, stable

On 02/17, Xiao Zhang wrote:
>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>
>---
>v2 change the minimum packet length according to the datasheet.
>---
> drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++++
> drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++
> 2 files changed, 8 insertions(+)
>
>diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
>index 7b398f1..f839bca 100644
>--- a/drivers/net/ixgbe/ixgbe_rxtx.c
>+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
>@@ -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) {
>diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
>index 000c5b1..20a8b29 100644
>--- a/drivers/net/ixgbe/ixgbe_rxtx.h
>+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
>@@ -53,6 +53,8 @@
> 
> #define IXGBE_TX_MAX_SEG                    40
> 
>+#define IXGBE_TX_MIN_PKT_LEN		     14
>+
> #define IXGBE_PACKET_TYPE_MASK_82599        0X7F
> #define IXGBE_PACKET_TYPE_MASK_X550         0X10FF
> #define IXGBE_PACKET_TYPE_MASK_TUNNEL       0XFF
>-- 
>2.7.4
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel, Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-17 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14  7:19 [dpdk-dev] net/ixgbe: check illegal packets Xiao Zhang
2020-02-17 14:51 ` [dpdk-dev] [v2] " Xiao Zhang
2020-02-17 15:09   ` Ananyev, Konstantin
2020-02-17 16:00   ` Ye Xiaolong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).