From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 825FC5B2C for ; Thu, 14 Feb 2019 00:27:17 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2019 15:27:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,366,1544515200"; d="scan'208";a="146659124" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by fmsmga001.fm.intel.com with ESMTP; 13 Feb 2019 15:27:15 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.72]) by IRSMSX154.ger.corp.intel.com ([169.254.12.219]) with mapi id 14.03.0415.000; Wed, 13 Feb 2019 23:27:14 +0000 From: "Ananyev, Konstantin" To: Andrew Rybchenko , "Kulasek, TomaszX" , Olivier Matz CC: "dev@dpdk.org" , Thomas Monjalon , Stephen Hemminger Thread-Topic: [RFC PATCH] mbuf: move headers not fragmented check to checksum Thread-Index: AQHUt6+coV7q8kbmiUGWsJpO7U7PBaXed2Jg Date: Wed, 13 Feb 2019 23:27:13 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580124139979@irsmsx105.ger.corp.intel.com> References: <1548751746-16030-1-git-send-email-arybchenko@solarflare.com> In-Reply-To: <1548751746-16030-1-git-send-email-arybchenko@solarflare.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTM5ZDM3NWEtNDYxYS00YTBkLTk1YWUtNjY4Mzc4NWRkNGI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUkREUG51SllsVGhSMk52K25kNDNWeGFacjYxcll4YXdubUlcL0ZxUHFEaHIzMnlhSFo0VHhTNERDRmRkdER6bGoifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [RFC PATCH] mbuf: move headers not fragmented check to checksum 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: Wed, 13 Feb 2019 23:27:18 -0000 Hi Andrew, =20 > rte_validate_tx_offload() is used in Tx prepare callbacks > (RTE_LIBRTE_ETHDEV_DEBUG only) to check Tx offloads consistency. > Requirement that packet headers should not be fragmented is not > documented and unclear where it comes from except > rte_net_intel_cksum_prepare() functions which relies on it. >=20 > It could be NIC vendor specific driver or hardware limitation, but, > if so, it should be documented and checked in corresponding Tx > prepare callbacks. >=20 > Signed-off-by: Andrew Rybchenko > --- > May be the check should be done in rte_net_intel_cksum_prepare() > under RTE_LIBRTE_ETHDEV_DEBUG only. Mainly I'd like to get feedback > on where the limitation comes from and idea to remove it from > rte_validate_tx_offload(). >=20 > lib/librte_mbuf/rte_mbuf.h | 12 ------------ > lib/librte_net/rte_net.h | 17 +++++++++++++++++ > 2 files changed, 17 insertions(+), 12 deletions(-) >=20 > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index a7f67023a..14a3b472b 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -2257,23 +2257,11 @@ static inline int > rte_validate_tx_offload(const struct rte_mbuf *m) > { > uint64_t ol_flags =3D m->ol_flags; > - uint64_t inner_l3_offset =3D m->l2_len; >=20 > /* Does packet set any of available offloads? */ > if (!(ol_flags & PKT_TX_OFFLOAD_MASK)) > return 0; >=20 > - if (ol_flags & PKT_TX_OUTER_IP_CKSUM) > - /* NB: elaborating the addition like this instead of using > - * +=3D gives the result uint64_t type instead of int, > - * avoiding compiler warnings on gcc 8.1 at least */ > - inner_l3_offset =3D inner_l3_offset + m->outer_l2_len + > - m->outer_l3_len; > - > - /* Headers are fragmented */ > - if (rte_pktmbuf_data_len(m) < inner_l3_offset + m->l3_len + m->l4_len) > - return -ENOTSUP; > - > /* IP checksum can be counted only for IPv4 packet */ > if ((ol_flags & PKT_TX_IP_CKSUM) && (ol_flags & PKT_TX_IPV6)) > return -EINVAL; > diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h > index e59760a0a..bd75aea8e 100644 > --- a/lib/librte_net/rte_net.h > +++ b/lib/librte_net/rte_net.h > @@ -118,10 +118,27 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *= m, uint64_t ol_flags) > struct udp_hdr *udp_hdr; > uint64_t inner_l3_offset =3D m->l2_len; >=20 > + /* > + * Does packet set any of available offloads? > + * Mainly it is required to avoid fragmented headers check if > + * no offloads are requested. > + */ > + if (!(ol_flags & PKT_TX_OFFLOAD_MASK)) > + return 0; > + > if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) || > (ol_flags & PKT_TX_OUTER_IPV6)) > inner_l3_offset +=3D m->outer_l2_len + m->outer_l3_len; >=20 > + /* > + * Check if headers are fragmented. > + * The check could be less strict depending on which offloads are > + * requested and headers to be used, but let's keep it simple. > + */ > + if (unlikely(rte_pktmbuf_data_len(m) < > + inner_l3_offset + m->l3_len + m->l4_len)) > + return -ENOTSUP; > + > if (ol_flags & PKT_TX_IPV4) { > ipv4_hdr =3D rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, > inner_l3_offset); > -- Looks good to me, though extra-testing would be needed. Acked-by: Konstantin Ananyev > 2.17.1