From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0058.outbound.protection.outlook.com [104.47.1.58]) by dpdk.org (Postfix) with ESMTP id 66ABC11D4 for ; Tue, 22 May 2018 09:43:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Tqyo2U6/BiFqpzx/4fLFQJATSDUDGlTrfh0SYhf3rR4=; b=Jkspl5Zw+r4lr2esEV+41bEUVZM+faA0YOkg1sF9ubUb+gQx5Dxm1o4O6V73/yXRwN17R0aNsNiCtaCW5IwnWkeEQ5AQ36nyPFk2entyON1Ojgi/bEv10y4/2PKLxThFb22D/QPB9iFH2UPqYqlFlU5ce7Wx0YypWnrfDWdHDpY= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4169.eurprd05.prod.outlook.com (52.134.107.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 07:43:53 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::e57e:5e77:595f:d4f7]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::e57e:5e77:595f:d4f7%13]) with mapi id 15.20.0776.015; Tue, 22 May 2018 07:43:53 +0000 From: Shahaf Shuler To: Yongseok Koh , Adrien Mazarguil , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 2/2] net/mlx5: remove redundant checks Thread-Index: AQHT8ZoUi9Up/HiRRE2M/Q8aBYl1kKQ7XVtQ Date: Tue, 22 May 2018 07:43:53 +0000 Message-ID: References: <20180522065631.23204-1-yskoh@mellanox.com> <20180522065631.23204-2-yskoh@mellanox.com> In-Reply-To: <20180522065631.23204-2-yskoh@mellanox.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=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4169; 7:pv5QkC6EwpreCRBTjI8d7vM3T4LjGjQtOYPC5fNU1k2/zmHHtde6tiuHwWLYaxzzHlXEqHKbbH1BGNLW3fxupFCFDE/+eE4A2HMlwleu2uTo4DRdNGKnzcAw60gATWtWBEMEDBiiAaJUZHVVo3s2+yb4TyId6lJhvurksOaHHPb7Y/TIbD3AFnayPErzh86G5alvbMu+I+tWvc8Umpe3kxgHNcSWeWqfr8Wp0FhZrMxEgAUrnTCt0h4e0d+bOAzN x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4169; x-ms-traffictypediagnostic: DB7PR05MB4169: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4169; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4169; x-forefront-prvs: 0680FADD48 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39380400002)(39860400002)(376002)(366004)(189003)(199004)(106356001)(8936002)(2906002)(5250100002)(3280700002)(9686003)(55016002)(97736004)(6436002)(5660300001)(102836004)(99286004)(6506007)(105586002)(229853002)(8676002)(81156014)(81166006)(478600001)(3660700001)(14454004)(76176011)(316002)(6116002)(68736007)(6246003)(25786009)(33656002)(26005)(7696005)(110136005)(476003)(74316002)(486006)(3846002)(4326008)(446003)(86362001)(305945005)(2900100001)(53936002)(7736002)(66066001)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4169; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 6EQ+PU14NzPjDnRKZB7wCHcuFQWuznKd7cz6tUoRum4jZjqbxDu2Z114UeXPIc4zNjOEeA3FP13TQ3gYDuzT7BPHfvIvx5rXgZAZ5EyNW4MCh/AqAjHHMQAUZMkm04yKe9SZ2CVpvtYVHOOm0ezzeG2hAYsjimMHYMc4aNTVBkx15xUVzyaaQYm7eUb+GGHT spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 4e5ddf3d-35da-419f-1d7e-08d5bfb7c467 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e5ddf3d-35da-419f-1d7e-08d5bfb7c467 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 May 2018 07:43:53.6868 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4169 Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/mlx5: remove redundant checks 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, 22 May 2018 07:43:55 -0000 Hi Koh, Please see question below Tuesday, May 22, 2018 9:57 AM, Yongseok Koh: > Subject: [PATCH v2 2/2] net/mlx5: remove redundant checks >=20 > Signed-off-by: Yongseok Koh > Acked-by: Xueming Li > --- >=20 > v2: > * add missing 'Acked-by' tag. >=20 > drivers/net/mlx5/mlx5_rxtx.c | 6 ++---- drivers/net/mlx5/mlx5_rxtx.h |= 14 > +++++++------- > 2 files changed, 9 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c > index cdd373e3e..527859461 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -522,7 +522,6 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf > **pkts, uint16_t pkts_n) > uint16_t ehdr; > uint8_t cs_flags; > uint8_t tso =3D txq->tso_en && (buf->ol_flags & > PKT_TX_TCP_SEG); > - uint8_t is_vlan =3D !!(buf->ol_flags & PKT_TX_VLAN_PKT); > uint32_t swp_offsets =3D 0; > uint8_t swp_types =3D 0; > uint16_t tso_segsz =3D 0; > @@ -566,11 +565,10 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf > **pkts, uint16_t pkts_n) > rte_prefetch0( > rte_pktmbuf_mtod(*(pkts + 1), volatile void *)); > cs_flags =3D txq_ol_cksum_to_cs(buf); > - txq_mbuf_to_swp(txq, buf, tso, is_vlan, > - (uint8_t *)&swp_offsets, &swp_types); > + txq_mbuf_to_swp(txq, buf, (uint8_t *)&swp_offsets, > &swp_types); > raw =3D ((uint8_t *)(uintptr_t)wqe) + 2 * > MLX5_WQE_DWORD_SIZE; > /* Replace the Ethernet type by the VLAN if necessary. */ > - if (is_vlan) { > + if (buf->ol_flags & PKT_TX_VLAN_PKT) { > uint32_t vlan =3D rte_cpu_to_be_32(0x81000000 | > buf->vlan_tci); > unsigned int len =3D 2 * ETHER_ADDR_LEN - 2; diff --git > a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index > 1e4b2fdb9..5d9a7dffd 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -651,10 +651,10 @@ mlx5_tx_dbrec(struct mlx5_txq_data *txq, volatile > struct mlx5_wqe *wqe) > */ > static __rte_always_inline void > txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, > - uint8_t tso, uint64_t vlan, > - uint8_t *offsets, uint8_t *swp_types) > + uint8_t *offsets, uint8_t *swp_types) > { > - uint64_t tunnel =3D buf->ol_flags & PKT_TX_TUNNEL_MASK; > + const uint64_t vlan =3D buf->ol_flags & PKT_TX_VLAN_PKT; > + const uint64_t tunnel =3D buf->ol_flags & PKT_TX_TUNNEL_MASK; > const uint64_t csum_flags =3D buf->ol_flags & PKT_TX_L4_MASK; > const uint64_t inner_ip =3D > buf->ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6); @@ -663,8 > +663,8 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf > *buf, > uint16_t idx; > uint16_t off; >=20 > - if (likely(!tunnel || !txq->swp_en || > - (tunnel !=3D PKT_TX_TUNNEL_UDP && tunnel !=3D > PKT_TX_TUNNEL_IP))) > + if (likely(!txq->swp_en || (tunnel !=3D PKT_TX_TUNNEL_UDP && > + tunnel !=3D PKT_TX_TUNNEL_IP))) > return; > /* > * The index should have: > @@ -684,7 +684,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct > rte_mbuf *buf, > * in if any of SWP offsets is set. Therefore, all of the L3 offsets > * should be set regardless of HW offload. > */ > - off =3D buf->outer_l2_len + (vlan ? 4 : 0); > + off =3D buf->outer_l2_len + (vlan ? sizeof(struct vlan_hdr) : 0); > offsets[1] =3D off >> 1; /* Outer L3 offset. */ > if (tunnel =3D=3D PKT_TX_TUNNEL_UDP) { > off +=3D buf->outer_l3_len; > @@ -693,7 +693,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct > rte_mbuf *buf, > if (inner_ip) { > off +=3D buf->l2_len; > offsets[3] =3D off >> 1; /* Inner L3 offset. */ > - if (csum_flags =3D=3D PKT_TX_TCP_CKSUM || tso || > + if (csum_flags =3D=3D PKT_TX_TCP_CKSUM || Why are you removing the tso? Per my understanding application can set only the PKT_TX_TCP_SEG for TSO an= d this implies TCP checksum.=20 > csum_flags =3D=3D PKT_TX_UDP_CKSUM) { > off +=3D buf->l3_len; > offsets[2] =3D off >> 1; /* Inner L4 offset. */ > -- > 2.11.0