From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B842A1D011 for ; Fri, 8 Jun 2018 19:24:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 10:24:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,490,1520924400"; d="scan'208";a="231036147" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 08 Jun 2018 10:24:05 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 8 Jun 2018 10:24:05 -0700 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.220]) by FMSMSX157.amr.corp.intel.com ([169.254.14.71]) with mapi id 14.03.0319.002; Fri, 8 Jun 2018 10:24:04 -0700 From: "Wiles, Keith" To: "Wu, Yanglong" CC: "dev@dpdk.org" , "Zhang, Qi Z" , "Ananyev, Konstantin" Thread-Topic: [dpdk-dev] [PATCH v2] net/i40e: illagel pactket checking Thread-Index: AQHT/t185Jl1J/mF50Wrc8Q22S5tXaRXEpuA Date: Fri, 8 Jun 2018 17:24:04 +0000 Message-ID: <5E2AE9A3-BFFE-4435-A6BB-7C589BEDC3EF@intel.com> References: <20180607093938.62579-1-yanglong.wu@intel.com> <20180608035412.91329-1-yanglong.wu@intel.com> In-Reply-To: <20180608035412.91329-1-yanglong.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.85.247] Content-Type: text/plain; charset="us-ascii" Content-ID: <36AE767AD3691748994A28BE93EB2A2B@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: illagel pactket checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2018 17:24:07 -0000 > On Jun 7, 2018, at 8:54 PM, Yanglong Wu wrote: >=20 > 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. The subject line has a number of spelling mistakes and that is used in the = comments, please fix. >=20 > Signed-off-by: Yanglong Wu > --- > 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(+) >=20 > 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; > } >=20 > + /*check the size of pkt len*/ > + if (m->pkt_len > I40E_FRAME_SIZE_MAX || > + m->pkt_len < I40E_TX_MIN_PKT_LEN) { > + rte_errno =3D -EINVAL; > + return i; } > + > + /*check the number of mbuf segments*/ > + if (m->nb_segs > I40E_TX_MAX_MTU_SEG) { > + rte_errno =3D -EINVAL; > + return i; } Also I am being a bit picky, but the comments should have a space after the= /* and before the */, and of course the changes that Konstantin suggested. > + > #ifdef RTE_LIBRTE_ETHDEV_DEBUG > ret =3D rte_validate_tx_offload(m); > if (ret !=3D 0) { > diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h > index ea73a8a1b..3fc619af9 100644 > --- a/drivers/net/i40e/i40e_rxtx.h > +++ b/drivers/net/i40e/i40e_rxtx.h > @@ -30,6 +30,8 @@ > #define I40E_TX_MAX_SEG UINT8_MAX > #define I40E_TX_MAX_MTU_SEG 8 >=20 > +#define I40E_TX_MIN_PKT_LEN 17 > + > #undef container_of > #define container_of(ptr, type, member) ({ \ > typeof(((type *)0)->member)(*__mptr) =3D (ptr); \ > --=20 > 2.11.0 >=20 Regards, Keith