From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Wu, Yanglong" <yanglong.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Zhang, Qi Z" <qi.z.zhang@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: illagel pactket checking
Date: Fri, 8 Jun 2018 14:04:53 +0000 [thread overview]
Message-ID: <2601191342CEEE43887BDE71AB977258C0C3990E@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <20180608035412.91329-1-yanglong.wu@intel.com>
> -----Original Message-----
> From: Wu, Yanglong
> Sent: Friday, June 8, 2018 4:54 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wu, Yanglong
> <yanglong.wu@intel.com>
> Subject: [PATCH v2] net/i40e: illagel pactket checking
>
> Some illegal packets will lead to TX/RX hang and
> can't recover automatically. This pacth check those
> illegal packets and protect TX/RX from hanging.
>
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
> v2:
> fix coding style issue and error
> ---
> drivers/net/i40e/i40e_rxtx.c | 11 +++++++++++
> drivers/net/i40e/i40e_rxtx.h | 2 ++
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 6032d5541..05cf3956c 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1458,6 +1458,17 @@ i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
> return i;
> }
>
> + /*check the size of pkt len*/
> + if (m->pkt_len > I40E_FRAME_SIZE_MAX ||
> + m->pkt_len < I40E_TX_MIN_PKT_LEN) {
> + rte_errno = -EINVAL;
> + return i; }
Please follow DPDK coding style:
If (...) {
...
}
> +
> + /*check the number of mbuf segments*/
> + if (m->nb_segs > I40E_TX_MAX_MTU_SEG) {
> + rte_errno = -EINVAL;
> + return i; }
I'll just repeat comment from my previous mail:
We already checking that in that function:
/* Check for m->nb_segs to not exceed the limits. */
if (!(ol_flags & PKT_TX_TCP_SEG)) {
if (m->nb_segs > I40E_TX_MAX_SEG ||
m->nb_segs > I40E_TX_MAX_MTU_SEG) {
rte_errno = -EINVAL;
return i;
}
} else if ((m->tso_segsz < I40E_MIN_TSO_MSS) ||
(m->tso_segsz > I40E_MAX_TSO_MSS)) {
/* MSS outside the range (256B - 9674B) are considered
* malicious
*/
rte_errno = -EINVAL;
return i;
}
Though it seems it is not totally correct, should probably be:
if (!(ol_flags & PKT_TX_TCP_SEG)) {
if (m->nb_segs > I40E_TX_MAX_SEG) {
...
}
} else if (m->nb_segs > I40E_TX_MAX_MTU_SEG ||
m->tso_segsz < I40E_MIN_TSO_MSS ||
m->tso_segsz > I40E_MAX_TSO_MSS) {
...
}
Konstantin
next prev parent reply other threads:[~2018-06-08 14:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 9:39 [dpdk-dev] [PATCH] " Yanglong Wu
2018-06-07 16:04 ` Ananyev, Konstantin
2018-06-08 3:54 ` [dpdk-dev] [PATCH v2] " Yanglong Wu
2018-06-08 14:04 ` Ananyev, Konstantin [this message]
2018-06-08 17:24 ` Wiles, Keith
2018-06-15 6:18 ` [dpdk-dev] [PATCH v3] " Yanglong Wu
2018-06-15 14:56 ` Zhang, Qi Z
2018-06-19 8:42 ` [dpdk-dev] [PATCH v3] net/i40e: illegal " Yanglong Wu
2018-06-19 9:10 ` [dpdk-dev] [PATCH] " Yanglong Wu
2018-06-20 1:44 ` Yanglong Wu
2018-06-20 1:46 ` [dpdk-dev] [PATCH v3] " Yanglong Wu
2018-06-20 2:12 ` [dpdk-dev] [PATCH v4] net/i40e: illegal packet checking Yanglong Wu
2018-06-22 9:17 ` Ananyev, Konstantin
2018-06-22 11:52 ` Zhang, Qi Z
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=2601191342CEEE43887BDE71AB977258C0C3990E@irsmsx105.ger.corp.intel.com \
--to=konstantin.ananyev@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=yanglong.wu@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).