From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0054.outbound.protection.outlook.com [104.47.1.54]) by dpdk.org (Postfix) with ESMTP id 67FB11D9E for ; Tue, 22 May 2018 10:11:58 +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=gtGt0FfWNiyGQo5ktFBEmLtrsOdtR6XDvDHKBktsrY8=; b=l6X12LQZvo6YcXNM9bii6wd/UAoDPcf45pwcFG298GyrSv+aIqTK5zdftUIv1Q0cl9D673HG7ogkvLVpLPCRh5gPna9kBhS6H+bSMbFtOdFVCiw9PAuvMSZ2KBctVHqHBokXYk13pR3SNVvqXBQfNclV7Zf8EFXCnyRaBxddmZM= Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com (10.167.195.147) by VI1PR0501MB2672.eurprd05.prod.outlook.com (10.172.13.22) 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 08:11:56 +0000 Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::11b2:1e2d:709c:695d]) by VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::11b2:1e2d:709c:695d%13]) with mapi id 15.20.0776.015; Tue, 22 May 2018 08:11:56 +0000 From: Yongseok Koh To: Shahaf Shuler CC: Adrien Mazarguil , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= , "dev@dpdk.org" Thread-Topic: [PATCH v2 2/2] net/mlx5: remove redundant checks Thread-Index: AQHT8ZoQXyqdMmgVyUuy1SVEZg+JuaQ7Xg6AgAAH1YA= Date: Tue, 22 May 2018 08:11:56 +0000 Message-ID: <50C7517D-3696-4CF4-956F-27959C07F0FE@mellanox.com> References: <20180522065631.23204-1-yskoh@mellanox.com> <20180522065631.23204-2-yskoh@mellanox.com> In-Reply-To: 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=yskoh@mellanox.com; x-originating-ip: [73.222.116.174] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0501MB2672; 7:tHwfR6wd7+i0lmh4hz+b5QTJRyLaj3wZBYl1QDR7hUw9B0Mvnwa+Zql/alEk9Xkxag7JU1gbmi/IueP5wIn6AahgybNzh1/V2SLFM/DK4cgeOXDcwUtHAcU78Lmu1nr7HlJoRetjQql8TwhZlBspTTUgILiskQHrZBRwE5kMM6N4oIoWm58BNw1wLZkdvcLU47YR8SShdnQeJJHeihjmf8H9HCweIZC24hgLCJGWiuhHQfjtMZt4FEYLbv6mQIx6 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:VI1PR0501MB2672; x-ms-traffictypediagnostic: VI1PR0501MB2672: 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)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2672; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2672; x-forefront-prvs: 0680FADD48 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39380400002)(396003)(346002)(39860400002)(199004)(189003)(68736007)(5660300001)(99286004)(316002)(3660700001)(3280700002)(6506007)(59450400001)(6512007)(7736002)(97736004)(2900100001)(305945005)(53546011)(102836004)(81166006)(8676002)(81156014)(26005)(8936002)(82746002)(86362001)(76176011)(14454004)(229853002)(54906003)(37006003)(6486002)(3846002)(6436002)(2906002)(6116002)(83716003)(6636002)(33656002)(36756003)(4326008)(486006)(476003)(11346002)(105586002)(66066001)(2616005)(478600001)(6246003)(106356001)(25786009)(5250100002)(6862004)(446003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2672; H:VI1PR0501MB2045.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: l5hXlRbDqchtxjMpGCgrL1S7n3nAL44s8+XtzveXM0AeyQXwe6TFhOum3SZztX+rNbvdIW21QrXcjIG+jlBl5W/fEhmcq6Dsmi1KD+SC0aRWVRNV13KlXAO/I20BFQ7daPiJa3j02zoMQGVY8bHMT5HH7mfUV+dAiiq5EjnkCM8WSvYZYLPTkxfT1LsTMIS/ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-ID: <977EAA7F02AAF143B562674E4EC52496@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b751cfe6-b317-4c22-383b-08d5bfbbafa3 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b751cfe6-b317-4c22-383b-08d5bfbbafa3 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 May 2018 08:11:56.8042 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2672 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 08:11:58 -0000 > On May 22, 2018, at 12:43 AM, Shahaf Shuler wrote: >=20 > Hi Koh, >=20 > Please see question below >=20 > 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 || >=20 > Why are you removing the tso? > Per my understanding application can set only the PKT_TX_TCP_SEG for TSO = and this implies TCP checksum.=20 Right. I don't know why but I wrongly thought PKT_TX_TCP_SEG enforces PKT_T= X_TCP_CKSUM. Have to restore it. Thanks, Yongseok >> csum_flags =3D=3D PKT_TX_UDP_CKSUM) { >> off +=3D buf->l3_len; >> offsets[2] =3D off >> 1; /* Inner L4 offset. */ >> -- >> 2.11.0