From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0060.outbound.protection.outlook.com [104.47.38.60]) by dpdk.org (Postfix) with ESMTP id 9ECF3106A for ; Tue, 13 Dec 2016 19:15:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kIFcueHpLtW+ZorCVN0F438njdBTFheWo2cIPRoYhcE=; b=MkoJ7tv6p/Z7DH+4SXIH8SVYdxRWjeXKf1I3Tl7XvZ0QiGWubrNv6lnCLKnVLAzvwzonetgi+u8ipuW4AQSwKJKidlSPC78TIxV4zqdPsfFetgGeXD+HZt50WFOdzkywMNzlA5WTyN4eZTmTJHZ1Rz8Ze+OlFLqkz3fBSOcnhrQ= Received: from BY2PR05MB2359.namprd05.prod.outlook.com (10.166.113.11) by BY2PR05MB2357.namprd05.prod.outlook.com (10.166.113.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.5; Tue, 13 Dec 2016 18:15:12 +0000 Received: from BY2PR05MB2359.namprd05.prod.outlook.com ([10.166.113.11]) by BY2PR05MB2359.namprd05.prod.outlook.com ([10.166.113.11]) with mapi id 15.01.0789.009; Tue, 13 Dec 2016 18:15:13 +0000 From: Yong Wang To: Tomasz Kulasek , "dev@dpdk.org" CC: "Ananyev, Konstantin" Thread-Topic: [dpdk-dev] [PATCH v13 6/7] vmxnet3: add Tx preparation Thread-Index: AQHSVWj51otIG6ArxEGhbF0aBs2K8KEGK1Fg Date: Tue, 13 Dec 2016 18:15:12 +0000 Message-ID: References: <1479922585-8640-1-git-send-email-tomaszx.kulasek@intel.com> <1481650914-40324-1-git-send-email-tomaszx.kulasek@intel.com> <1481650914-40324-7-git-send-email-tomaszx.kulasek@intel.com> In-Reply-To: <1481650914-40324-7-git-send-email-tomaszx.kulasek@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yongwang@vmware.com; x-originating-ip: [208.91.1.34] x-ms-office365-filtering-correlation-id: 7c80a84b-57c2-4fb1-cc1a-08d42383fb58 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR05MB2357; x-microsoft-exchange-diagnostics: 1; BY2PR05MB2357; 7:hN8EvKkRFVwJ6qsBvsT0yTt7CdUfwGba3ciBPHL32pPZwBlIfI2e/7cBlKFvCRh0VuRm2CaIrFBioVX2KES/+4T3N/ovdI1fij1X/PLNWs6SKevOB7W6Kf2iI7beE0XtGFxObiCrrLawwk4HWEc77zZprKWI2JF+LsHH03ZQeBlcQodpNt0oUZrzMAPa7ox+54ac6jjf7EGURRN6NG+dACl9uIPgETc4XloNViledInQ4vAeWBEv/A5IzA1l4tzbJmYU1leiROmLfzKyQ2AiXExN4nM5M6xiH5YJWFtIOA8xcndC4G4n+fltz3XurMa6Qsqp9NOrPw0YZvyKvPW2xlQjXZCLZOOjkrMXQBqhP1a6QYLmlfoQG1S/mB+mzV0eUiWEUGAmnwEJ5bl3xUrszvW/4wxXx7hlrYW4wAiojoo3GvbvBWVKxCXgrk9B8Y/mQGQD3oQmeLRJhZGoCck3ZA==; 20:/DhRahi6aluKQ+Efui1KUO20gIBDc7gcyj42F2+VPRW6A7stRUKJZHON9v1uSchkFpLViQxXqp4KEOvwbw6feRlW2attdSHO1uzOCD0aG7E+xT2Rbz8EiIcF057GtAEUVFffWORDqJZqr306O3DrF98R7DNe9f269FT3hktdrYo= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(20161123558021)(6072148); SRVR:BY2PR05MB2357; BCL:0; PCL:0; RULEID:; SRVR:BY2PR05MB2357; x-forefront-prvs: 01559F388D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(199003)(13464003)(377454003)(189002)(3846002)(102836003)(6116002)(106356001)(6436002)(2950100002)(106116001)(105586002)(66066001)(2501003)(2906002)(4326007)(74316002)(305945005)(229853002)(86362001)(7736002)(6506006)(9686002)(92566002)(3660700001)(38730400001)(3280700002)(122556002)(2900100001)(77096006)(33656002)(68736007)(76576001)(189998001)(50986999)(5660300001)(101416001)(76176999)(7696004)(99286002)(54356999)(5001770100001)(97736004)(81156014)(8936002)(8676002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR05MB2357; H:BY2PR05MB2359.namprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2016 18:15:12.8229 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB2357 Subject: Re: [dpdk-dev] [PATCH v13 6/7] vmxnet3: add Tx preparation 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: Tue, 13 Dec 2016 18:15:15 -0000 Looks good and two nits below. > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Kulasek > Sent: Tuesday, December 13, 2016 9:42 AM > To: dev@dpdk.org > Cc: Ananyev, Konstantin > Subject: [dpdk-dev] [PATCH v13 6/7] vmxnet3: add Tx preparation >=20 > From: "Ananyev, Konstantin" >=20 > Signed-off-by: Konstantin Ananyev > --- > drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +++ > drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 ++ > drivers/net/vmxnet3/vmxnet3_rxtx.c | 57 > ++++++++++++++++++++++++++++++++++ > 3 files changed, 63 insertions(+) >=20 > diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c > b/drivers/net/vmxnet3/vmxnet3_ethdev.c > index 8bb13e5..f85be91 100644 > --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c > +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c > @@ -237,6 +237,7 @@ static void vmxnet3_mac_addr_set(struct > rte_eth_dev *dev, > eth_dev->dev_ops =3D &vmxnet3_eth_dev_ops; > eth_dev->rx_pkt_burst =3D &vmxnet3_recv_pkts; > eth_dev->tx_pkt_burst =3D &vmxnet3_xmit_pkts; > + eth_dev->tx_pkt_prepare =3D vmxnet3_prep_pkts; > pci_dev =3D eth_dev->pci_dev; >=20 > /* > @@ -326,6 +327,7 @@ static void vmxnet3_mac_addr_set(struct > rte_eth_dev *dev, > eth_dev->dev_ops =3D NULL; > eth_dev->rx_pkt_burst =3D NULL; > eth_dev->tx_pkt_burst =3D NULL; > + eth_dev->tx_pkt_prepare =3D NULL; >=20 > rte_free(eth_dev->data->mac_addrs); > eth_dev->data->mac_addrs =3D NULL; > @@ -728,6 +730,8 @@ static void vmxnet3_mac_addr_set(struct > rte_eth_dev *dev, > .nb_max =3D VMXNET3_TX_RING_MAX_SIZE, > .nb_min =3D VMXNET3_DEF_TX_RING_SIZE, > .nb_align =3D 1, > + .nb_seg_max =3D UINT8_MAX, To be consistent with other drivers, can you define VMXNET3_TX_MAX_SEG as U= INT8_MAX and use it here? > + .nb_mtu_seg_max =3D VMXNET3_MAX_TXD_PER_PKT, > }; >=20 > dev_info->rx_offload_capa =3D > diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h > b/drivers/net/vmxnet3/vmxnet3_ethdev.h > index 7d3b11e..469db71 100644 > --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h > +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h > @@ -171,5 +171,7 @@ uint16_t vmxnet3_recv_pkts(void *rx_queue, struct > rte_mbuf **rx_pkts, > uint16_t nb_pkts); > uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > uint16_t nb_pkts); > +uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > + uint16_t nb_pkts); >=20 > #endif /* _VMXNET3_ETHDEV_H_ */ > diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c > b/drivers/net/vmxnet3/vmxnet3_rxtx.c > index b109168..0c35738 100644 > --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c > +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c > @@ -69,6 +69,7 @@ > #include > #include > #include > +#include >=20 > #include "base/vmxnet3_defs.h" > #include "vmxnet3_ring.h" > @@ -76,6 +77,14 @@ > #include "vmxnet3_logs.h" > #include "vmxnet3_ethdev.h" >=20 > +#define VMXNET3_TX_OFFLOAD_MASK ( \ > + PKT_TX_VLAN_PKT | \ > + PKT_TX_L4_MASK | \ > + PKT_TX_TCP_SEG) > + > +#define VMXNET3_TX_OFFLOAD_NOTSUP_MASK \ > + (PKT_TX_OFFLOAD_MASK ^ VMXNET3_TX_OFFLOAD_MASK) > + > static const uint32_t rxprod_reg[2] =3D {VMXNET3_REG_RXPROD, > VMXNET3_REG_RXPROD2}; >=20 > static int vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t*, uint8_t); > @@ -350,6 +359,54 @@ > } >=20 > uint16_t > +vmxnet3_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf > **tx_pkts, > + uint16_t nb_pkts) > +{ > + int32_t ret; > + uint32_t i; > + uint64_t ol_flags; > + struct rte_mbuf *m; > + > + for (i =3D 0; i !=3D nb_pkts; i++) { > + m =3D tx_pkts[i]; > + ol_flags =3D m->ol_flags; > + > + /* > + * Non-TSO packet cannot occupy more than > + * VMXNET3_MAX_TXD_PER_PKT TX descriptors. > + */ > + if ((ol_flags & PKT_TX_TCP_SEG) =3D=3D 0 && > + m->nb_segs > > VMXNET3_MAX_TXD_PER_PKT) { > + rte_errno =3D -EINVAL; > + return i; > + } > + > + /* check that only supported TX offloads are requested. */ > + if ((ol_flags & VMXNET3_TX_OFFLOAD_NOTSUP_MASK) !=3D 0 > || > + (ol_flags & PKT_TX_L4_MASK) =3D=3D > + PKT_TX_SCTP_CKSUM) { > + rte_errno =3D -EINVAL; Return ENOTSUP instead of EINVAL here? > + return i; > + } > + > +#ifdef RTE_LIBRTE_ETHDEV_DEBUG > + ret =3D rte_validate_tx_offload(m); > + if (ret !=3D 0) { > + rte_errno =3D ret; > + return i; > + } > +#endif > + ret =3D rte_net_intel_cksum_prepare(m); > + if (ret !=3D 0) { > + rte_errno =3D ret; > + return i; > + } > + } > + > + return i; > +} > + > +uint16_t > vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, > uint16_t nb_pkts) > { > -- > 1.7.9.5