From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 3B46A2B8B for ; Thu, 29 Sep 2016 12:40:45 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 29 Sep 2016 03:40:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,414,1470726000"; d="scan'208";a="174510877" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by fmsmga004.fm.intel.com with ESMTP; 29 Sep 2016 03:40:43 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.196]) by IRSMSX154.ger.corp.intel.com ([169.254.12.149]) with mapi id 14.03.0248.002; Thu, 29 Sep 2016 11:40:41 +0100 From: "Ananyev, Konstantin" To: "Kulasek, TomaszX" , "dev@dpdk.org" Thread-Topic: [PATCH v3 1/6] ethdev: add Tx preparation Thread-Index: AQHSGXlhCES3CNrMHk+9VvxQQTGWNKCQRZ4Q Date: Thu, 29 Sep 2016 10:40:41 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F0BC5E0@irsmsx105.ger.corp.intel.com> References: <1473691487-10032-1-git-send-email-tomaszx.kulasek@intel.com> <20160928111052.9968-1-tomaszx.kulasek@intel.com> <20160928111052.9968-2-tomaszx.kulasek@intel.com> In-Reply-To: <20160928111052.9968-2-tomaszx.kulasek@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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] [PATCH v3 1/6] ethdev: add Tx preparation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2016 10:40:45 -0000 Hi Tomasz, > -----Original Message----- > From: Kulasek, TomaszX > Sent: Wednesday, September 28, 2016 12:11 PM > To: dev@dpdk.org > Cc: Ananyev, Konstantin ; Kulasek, TomaszX = > Subject: [PATCH v3 1/6] ethdev: add Tx preparation >=20 > Added API for `rte_eth_tx_prep` >=20 > uint16_t rte_eth_tx_prep(uint8_t port_id, uint16_t queue_id, > struct rte_mbuf **tx_pkts, uint16_t nb_pkts) >=20 > Added fields to the `struct rte_eth_desc_lim`: >=20 > uint16_t nb_seg_max; > /**< Max number of segments per whole packet. */ >=20 > uint16_t nb_mtu_seg_max; > /**< Max number of segments per one MTU */ >=20 > Created `rte_pkt.h` header with common used functions: >=20 > int rte_validate_tx_offload(struct rte_mbuf *m) > to validate general requirements for tx offload in packet such a > flag completness. In current implementation this function is called > optionaly when RTE_LIBRTE_ETHDEV_DEBUG is enabled. >=20 > int rte_phdr_cksum_fix(struct rte_mbuf *m) > to fix pseudo header checksum for TSO and non-TSO tcp/udp packets > before hardware tx checksum offload. > - for non-TSO tcp/udp packets full pseudo-header checksum is > counted and set. > - for TSO the IP payload length is not included. >=20 > Signed-off-by: Tomasz Kulasek > --- > config/common_base | 1 + > lib/librte_ether/rte_ethdev.h | 85 ++++++++++++++++++++++++++ > lib/librte_mbuf/rte_mbuf.h | 8 +++ > lib/librte_net/Makefile | 2 +- > lib/librte_net/rte_pkt.h | 133 +++++++++++++++++++++++++++++++++++= ++++++ > 5 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 li= b/librte_net/rte_pkt.h >=20 .... > diff --git a/lib/librte_net/rte_pkt.h b/lib/librte_net/rte_pkt.h new file= mode 100644 index 0000000..72903ac > --- /dev/null > +++ b/lib/librte_net/rte_pkt.h > @@ -0,0 +1,133 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2016 Intel Corporation. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyrig= ht > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS F= OR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGH= T > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTA= L, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF US= E, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON A= NY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE U= SE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE= . > + */ > + > +#ifndef _RTE_PKT_H_ > +#define _RTE_PKT_H_ > + > +#include > +#include > +#include > +#include > + > +/** > + * Validate general requirements for tx offload in packet. > + */ > +static inline int > +rte_validate_tx_offload(struct rte_mbuf *m) { > + uint64_t ol_flags =3D m->ol_flags; > + > + /* Does packet set any of available offloads? */ > + if (!(ol_flags & PKT_TX_OFFLOAD_MASK)) > + return 0; > + > + /* IP checksum can be counted only for IPv4 packet */ > + if ((ol_flags & PKT_TX_IP_CKSUM) && (ol_flags & PKT_TX_IPV6)) > + return -EINVAL; > + > + if (ol_flags & (PKT_TX_L4_MASK | PKT_TX_TCP_SEG)) Not sure what you are trying to test here? Is that PKT_TX_TCP_SEG is set? If so, then the test condition doesn't look correct to me. > + /* IP type not set */ > + if (!(ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6))) > + return -EINVAL; > + > + if (ol_flags & PKT_TX_TCP_SEG) > + /* PKT_TX_IP_CKSUM offload not set for IPv4 TSO packet */ > + if ((m->tso_segsz =3D=3D 0) || > + ((ol_flags & PKT_TX_IPV4) && !(ol_flags & PKT_TX_IP_CKSUM))) > + return -EINVAL; > + Why not just: If ((ol_flags & PKT_TX_L4_MASK) =3D=3D PKT_TX_TCP_SEG) { uint64_t f =3D ol_flags & PKT_TX_L4_MASK; if ((f & (PKT_TX_IPV4 | PKT_TX_IPV6)) =3D=3D 0 || f =3D=3D PKT_TX= _IPV4 || m->tso_segsz =3D=3D 0) return -EINVAL; } Instead of 2 ifs around TCP_SEG above? Konstantin