From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0072.outbound.protection.outlook.com [104.47.1.72]) by dpdk.org (Postfix) with ESMTP id BDB442C6A for ; Mon, 7 May 2018 07:41:02 +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; bh=VpHMrtykehLKOLTTUf2Z5Cd0j5BMWbf5SWxXfVDQEGQ=; b=BQoLVf4k+04MsS9mJoGuykQv9DA42lJlW/mw5TZdYJqIOtWQEGgbjR52UGVH8cKHj0b85ehPYOiZvC/J0NUnHvKwh1kRaDBfY6zhYE/LsRyW7ttl1ECxXj7g+A8VhoPF1MFYyrsqS31PBBPos17SsR1y4APmtf2UQ80VOr4fo6g= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4425.eurprd05.prod.outlook.com (52.134.109.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Mon, 7 May 2018 05:41:01 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::f116:5be4:ba29:fed8%13]) with mapi id 15.20.0735.018; Mon, 7 May 2018 05:41:01 +0000 From: Shahaf Shuler To: Yongseok Koh , Adrien Mazarguil , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= CC: "dev@dpdk.org" , Yongseok Koh Thread-Topic: [dpdk-dev] [PATCH 1/3] net/mlx5: separate filling Rx flags Thread-Index: AQHT4mxLJmZvHe5Ct02h0rvoatTIQaQjxo1w Date: Mon, 7 May 2018 05:41:01 +0000 Message-ID: References: <20180502232054.7852-1-yskoh@mellanox.com> <20180502232054.7852-2-yskoh@mellanox.com> In-Reply-To: <20180502232054.7852-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; DB7PR05MB4425; 7:fDL/ODlpgjDwqUfDgPJKBCR+945ihOTvOJVz0UpAlCWf5G1Sdx+Uz4Uzq5Q6C7RNWKiF7/RSc3P/KgiP08V3QabqfZ0WabCMhOC7yHdHwnGoNFfaIYXEf/+cfkp8ToXXnFqGecZLWqOu4itfh1qzfs38EIABnZXO2D1p+M2FPgml5mI2u8zWWl9nGSBmGIMOYDngYb4M+WmmJLZv1OVZwG/K0TlfWqhagx9zAMPmRSnXfMl0at26JJQ0YACHOuNF 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:DB7PR05MB4425; x-ms-traffictypediagnostic: DB7PR05MB4425: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150022)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DB7PR05MB4425; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4425; x-forefront-prvs: 066517B35B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(366004)(39380400002)(396003)(346002)(376002)(199004)(189003)(2900100001)(4326008)(59450400001)(102836004)(99286004)(54906003)(107886003)(7736002)(305945005)(6506007)(9686003)(6246003)(66066001)(110136005)(486006)(33656002)(97736004)(7696005)(76176011)(106356001)(446003)(11346002)(105586002)(5660300001)(86362001)(55016002)(476003)(26005)(53936002)(68736007)(6436002)(2906002)(316002)(81166006)(81156014)(25786009)(8676002)(74316002)(3846002)(6116002)(5250100002)(8936002)(3280700002)(3660700001)(478600001)(14454004)(229853002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4425; H:DB7PR05MB4426.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: BJEJrhIdbziNXMvgajZHM3lERjEkoNArDbbmNKK/DwSZh4hY+3y5EiSxkvf3vocDmmHA41q6kpGyxaywG14TvK0rDPuAgODvA3o+s3DN4PDZToOiPSa2AJObebGOY3WHcxlrDjoSP0dp2j86RxMQ+1+eEQCtEr7/WkGEIFC+pX2oPrgdxV2rMulovMsjiuuq 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: 7e1e217e-7d44-4df0-d240-08d5b3dd1dd0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e1e217e-7d44-4df0-d240-08d5b3dd1dd0 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 May 2018 05:41:01.0443 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4425 Subject: Re: [dpdk-dev] [PATCH 1/3] net/mlx5: separate filling Rx flags 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: Mon, 07 May 2018 05:41:03 -0000 Thursday, May 3, 2018 2:21 AM, Yongseok Koh: > Subject: [dpdk-dev] [PATCH 1/3] net/mlx5: separate filling Rx flags >=20 > Filling in fields of mbuf becomes a separate inline function so that this= can be > reused. >=20 > Signed-off-by: Yongseok Koh Acked-by: Shahaf Shuler > --- > drivers/net/mlx5/mlx5_rxtx.c | 84 +++++++++++++++++++++++++++-------- > --------- > 1 file changed, 51 insertions(+), 33 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c > index 8a863c157..299408b31 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -43,6 +43,10 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile > struct mlx5_cqe *cqe, static __rte_always_inline uint32_t > rxq_cq_to_ol_flags(volatile struct mlx5_cqe *cqe); >=20 > +static __rte_always_inline void > +rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, > + volatile struct mlx5_cqe *cqe, uint32_t rss_hash_res); > + > uint32_t mlx5_ptype_table[] __rte_cache_aligned =3D { > [0xff] =3D RTE_PTYPE_ALL_MASK, /* Last entry for errored packet. */ > }; @@ -1841,6 +1845,52 @@ rxq_cq_to_ol_flags(volatile struct mlx5_cqe > *cqe) } >=20 > /** > + * Fill in mbuf fields from RX completion flags. > + * Note that pkt->ol_flags should be initialized outside of this functio= n. > + * > + * @param rxq > + * Pointer to RX queue. > + * @param pkt > + * mbuf to fill. > + * @param cqe > + * CQE to process. > + * @param rss_hash_res > + * Packet RSS Hash result. > + */ > +static inline void > +rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, > + volatile struct mlx5_cqe *cqe, uint32_t rss_hash_res) { > + /* Update packet information. */ > + pkt->packet_type =3D rxq_cq_to_pkt_type(rxq, cqe); > + if (rss_hash_res && rxq->rss_hash) { > + pkt->hash.rss =3D rss_hash_res; > + pkt->ol_flags |=3D PKT_RX_RSS_HASH; > + } > + if (rxq->mark && MLX5_FLOW_MARK_IS_VALID(cqe- > >sop_drop_qpn)) { > + pkt->ol_flags |=3D PKT_RX_FDIR; > + if (cqe->sop_drop_qpn !=3D > + rte_cpu_to_be_32(MLX5_FLOW_MARK_DEFAULT)) { > + uint32_t mark =3D cqe->sop_drop_qpn; > + > + pkt->ol_flags |=3D PKT_RX_FDIR_ID; > + pkt->hash.fdir.hi =3D mlx5_flow_mark_get(mark); > + } > + } > + if (rxq->csum) > + pkt->ol_flags |=3D rxq_cq_to_ol_flags(cqe); > + if (rxq->vlan_strip && > + (cqe->hdr_type_etc & > rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) { > + pkt->ol_flags |=3D PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; > + pkt->vlan_tci =3D rte_be_to_cpu_16(cqe->vlan_info); > + } > + if (rxq->hw_timestamp) { > + pkt->timestamp =3D rte_be_to_cpu_64(cqe->timestamp); > + pkt->ol_flags |=3D PKT_RX_TIMESTAMP; > + } > +} > + > +/** > * DPDK callback for RX. > * > * @param dpdk_rxq > @@ -1916,40 +1966,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf > **pkts, uint16_t pkts_n) > } > pkt =3D seg; > assert(len >=3D (rxq->crc_present << 2)); > - /* Update packet information. */ > - pkt->packet_type =3D rxq_cq_to_pkt_type(rxq, cqe); > pkt->ol_flags =3D 0; > - if (rss_hash_res && rxq->rss_hash) { > - pkt->hash.rss =3D rss_hash_res; > - pkt->ol_flags =3D PKT_RX_RSS_HASH; > - } > - if (rxq->mark && > - MLX5_FLOW_MARK_IS_VALID(cqe- > >sop_drop_qpn)) { > - pkt->ol_flags |=3D PKT_RX_FDIR; > - if (cqe->sop_drop_qpn !=3D > - > rte_cpu_to_be_32(MLX5_FLOW_MARK_DEFAULT)) { > - uint32_t mark =3D cqe->sop_drop_qpn; > - > - pkt->ol_flags |=3D PKT_RX_FDIR_ID; > - pkt->hash.fdir.hi =3D > - mlx5_flow_mark_get(mark); > - } > - } > - if (rxq->csum) > - pkt->ol_flags |=3D rxq_cq_to_ol_flags(cqe); > - if (rxq->vlan_strip && > - (cqe->hdr_type_etc & > - rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) > { > - pkt->ol_flags |=3D PKT_RX_VLAN | > - PKT_RX_VLAN_STRIPPED; > - pkt->vlan_tci =3D > - rte_be_to_cpu_16(cqe->vlan_info); > - } > - if (rxq->hw_timestamp) { > - pkt->timestamp =3D > - rte_be_to_cpu_64(cqe->timestamp); > - pkt->ol_flags |=3D PKT_RX_TIMESTAMP; > - } > + rxq_cq_to_mbuf(rxq, pkt, cqe, rss_hash_res); > if (rxq->crc_present) > len -=3D ETHER_CRC_LEN; > PKT_LEN(pkt) =3D len; > -- > 2.11.0