DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Zhang, Xiao" <xiao.zhang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [v2] net/ixgbe: check illegal packets
Date: Mon, 17 Feb 2020 15:09:28 +0000	[thread overview]
Message-ID: <SN6PR11MB2558DC60FDD6750096AAEEFF9A160@SN6PR11MB2558.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1581951075-56261-1-git-send-email-xiao.zhang@intel.com>


> 
> 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


  reply	other threads:[~2020-02-17 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  7:19 [dpdk-dev] " Xiao Zhang
2020-02-17 14:51 ` [dpdk-dev] [v2] " Xiao Zhang
2020-02-17 15:09   ` Ananyev, Konstantin [this message]
2020-02-17 16:00   ` Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR11MB2558DC60FDD6750096AAEEFF9A160@SN6PR11MB2558.namprd11.prod.outlook.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiao.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).