From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0082.outbound.protection.outlook.com [104.47.0.82]) by dpdk.org (Postfix) with ESMTP id EB6A01B23E for ; Wed, 8 Nov 2017 16:33:58 +0100 (CET) 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=4USYAHsZZoHANEGNp9ICx6RsJsQRKTIi1l84+7/oVXs=; b=o+WL1Axnqh2KP+A8qMDyonuXq3xqyRauyq8HQ+JpoeYEYQPDV1ApjBcsCzya4nUoU2lqtGQC5PREAtOSMVQXq+XUl+Spqw8rNasJjz+kmo2cjjNXUKRytYHv6QxZYrb61ar6PRGGF4LUlSzZEdO+JivH1f2LudFIKFibSpbhzDM= Received: from AM4PR05MB1907.eurprd05.prod.outlook.com (10.167.91.15) by AM4PR05MB1908.eurprd05.prod.outlook.com (10.167.91.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Wed, 8 Nov 2017 15:33:57 +0000 Received: from AM4PR05MB1907.eurprd05.prod.outlook.com ([fe80::c568:a3d:1d2:c68]) by AM4PR05MB1907.eurprd05.prod.outlook.com ([fe80::c568:a3d:1d2:c68%13]) with mapi id 15.20.0197.017; Wed, 8 Nov 2017 15:33:57 +0000 From: Mordechay Haimovsky To: Adrien Mazarguil CC: "dev@dpdk.org" Thread-Topic: [PATCH v1] net/mlx4: improve Rx packet type offloads report Thread-Index: AQHTWImPwvZYptLfIU63uqOyQONsmKMKktoAgAAG13A= Date: Wed, 8 Nov 2017 15:33:57 +0000 Message-ID: References: <1510142565-142115-1-git-send-email-motih@mellanox.com> <20171108145758.GV24849@6wind.com> In-Reply-To: <20171108145758.GV24849@6wind.com> Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; x-originating-ip: [79.177.178.169] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB1908; 6:UfEuwVL7UKQwNWSxMyV+76IoiJn5XtGuGPUPvimXNZAD9GDcx8XlJgdxtzw21SW9+DePRs7imtaFXDsNn891Kr8FEK7NvDb0vnD4HwNqEAEhhZpEXbsEBHRoeyGvir6IifXbJRGKs4L4R8cu4HBDjQ80BT5sTh1DqurMvuug/rOMuLC/37B4lqUwkYplk37BqMRwL+2kgnH6YruJvRDXKilYRNGJcTKPfx40Ef6eXmkGbfsiFGH4RsihHwBh52RVTWEPAj/bbtEt9kFERtXOtrCSaZpVu/WWTePxF1QJzMSmuFmHYcQWg+9wCO/IExqyJKf9Q8zJ5EN84JkfxVvXVzKGfT+8erc4HZgRt8L/hE4=; 5:pG9CKU55LnQo7Nx9MdRd9ybn1JDn+gZXIL+DerAsEPrfVckubYhib59aItgwHAeJqQZO4kYBA25HFW/VKh0zV+Bw2fDkfc7VRfHIlV+ECrKFdlPZuhCWtO/sd3mDwLY0rfW+/6ad8u11cbrTkG8vjmJS9P3cAHhOSWNINxnoYCk=; 24:qDePBw8UaXyovKFcDVDRExIp+o/LUvz36Eub/JYHHXmnpOHWEGf7EjcfN5FlnZdl5LMcMhKl/XgNsMPgOJFdFXMqS++L43fTHK0e0BbwwgM=; 7:EqmGdqT8QcaD27Y5hYNrc45ULiiVMTKFvvQYaS3ROCCdQZfpr3FbgYgUbLCvwiKDKk0gvysqlUItNjymEgtjOF7J20cY2JG5q1YqEHQKQsxVh+NlG5tqnd+6sQEinnI1mwf4OGlXoaRPVBWrtpyTEehFkFkNS4mJHbrbcW2dN8QqxDasjVhv/KW/lzzVMKEhUInpM6WTQZdYCRYzSAizkO6P8GIe6qGoviQc3ZNJ9g+Yz3AiwNvRYk3AFgWDGKeX x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 380da953-be62-4be1-8b5b-08d526be2084 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:AM4PR05MB1908; x-ms-traffictypediagnostic: AM4PR05MB1908: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-exchange-antispam-report-test: UriScan:(211171220733660); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3231021)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR05MB1908; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR05MB1908; x-forefront-prvs: 0485417665 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(189002)(199003)(24454002)(13464003)(8936002)(86362001)(50986999)(6436002)(3280700002)(7696004)(25786009)(53936002)(6916009)(66066001)(2950100002)(5660300001)(54356999)(76176999)(99286004)(97736004)(6506006)(2900100001)(316002)(6116002)(8676002)(102836003)(6246003)(53546010)(189998001)(2906002)(5250100002)(81166006)(68736007)(3846002)(7736002)(33656002)(14454004)(105586002)(3660700001)(229853002)(9686003)(101416001)(74316002)(55016002)(305945005)(478600001)(81156014)(4326008)(106356001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB1908; H:AM4PR05MB1907.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.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: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 380da953-be62-4be1-8b5b-08d526be2084 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2017 15:33:57.2585 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1908 Subject: Re: [dpdk-dev] [PATCH v1] net/mlx4: improve Rx packet type offloads report 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: Wed, 08 Nov 2017 15:33:59 -0000 Inline > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Wednesday, November 8, 2017 4:58 PM > To: Mordechay Haimovsky > Cc: dev@dpdk.org > Subject: Re: [PATCH v1] net/mlx4: improve Rx packet type offloads report >=20 > Hi Moti, >=20 > On Wed, Nov 08, 2017 at 02:02:45PM +0200, Moti Haimovsky wrote: > > This patch improves Rx packet type offload report in case the device > > is a virtual function device. L2 tunnel indications are not reported > > by those devices and therefore should not be checked by the PMD. > > > > Fixes: aee4a03fee4f ("net/mlx4: enhance Rx packet type offloads") > > > > Signed-off-by: Moti Haimovsky >=20 > Does "not reporting them" cause any issue? Is this patch adding anything = on > top of checking they can't be reported before not reporting them either? >=20 > Otherwise this additional unnecessary check may cause a minor performance > regression for no good reason. >=20 In VFs (sriov VF devices) we see that the L2 tunnel flag is set which cause= s a complete misinterpretation of the packet type being received. This happens since the tunnel_mode is not set to 0x7 by the driver and ther= efore has meaningless value in such case and should be ignored. And yes, performance-wise there is probably an impact. Another approach which will not affect performance can be to init the mlx4_= ptype_table according to the device at hand (i.e. per-device table). This however will require some effort :) > I think this patch should really update mlx4_dev_supported_ptypes_get() > (control path) instead of rxq_cq_to_pkt_type() (data path). What's your > opinion? >=20 > A few other suggestions, see below. >=20 > > --- > > drivers/net/mlx4/mlx4.c | 2 ++ > > drivers/net/mlx4/mlx4.h | 1 + > > drivers/net/mlx4/mlx4_rxq.c | 1 + > > drivers/net/mlx4/mlx4_rxtx.c | 9 ++++++--- > > drivers/net/mlx4/mlx4_rxtx.h | 1 + > > 5 files changed, 11 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index > > f9e4f9d..efff65d 100644 > > --- a/drivers/net/mlx4/mlx4.c > > +++ b/drivers/net/mlx4/mlx4.c > > @@ -573,6 +573,8 @@ struct mlx4_conf { > > PCI_DEVICE_ID_MELLANOX_CONNECTX3PRO); > > DEBUG("L2 tunnel checksum offloads are %ssupported", > > (priv->hw_csum_l2tun ? "" : "not ")); > > + /* VFs are not configured to offload L2 tunnels */ > > + priv->hw_l2tun_offload =3D !vf; >=20 > Seeing how you're adding a new bit to this field, is hw_l2tun_offload rea= lly > different from hw_csum_l2tun? >=20 > Can you get inner VXLAN checksums if the packet can't be recognized as > VXLAN in the first place? I don't think so. >=20 > Perhaps hw_csum_l2tun should be renamed, however in my opinion you > could simply update the hw_csum_l2tun assignment with a vf check and use > that. >=20 > > /* Configure the first MAC address by default. */ > > if (mlx4_get_mac(priv, &mac.addr_bytes)) { > > ERROR("cannot get MAC address, is mlx4_en > loaded?" > > diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index > > 3aeef87..cbb8628 100644 > > --- a/drivers/net/mlx4/mlx4.h > > +++ b/drivers/net/mlx4/mlx4.h > > @@ -128,6 +128,7 @@ struct priv { > > uint32_t isolated:1; /**< Toggle isolated mode. */ > > uint32_t hw_csum:1; /* Checksum offload is supported. */ > > uint32_t hw_csum_l2tun:1; /* Checksum support for L2 tunnels. */ > > + uint32_t hw_l2tun_offload:1; /**< L2 tunnel offload is configured. > > +*/ >=20 > This change would become unnecessary. >=20 > > struct rte_intr_handle intr_handle; /**< Port interrupt handle. */ > > struct mlx4_drop *drop; /**< Shared resources for drop flow rules. > */ > > LIST_HEAD(, mlx4_rss) rss; /**< Shared targets for Rx flow rules. */ > > diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c > > index 8b97a89..802be84 100644 > > --- a/drivers/net/mlx4/mlx4_rxq.c > > +++ b/drivers/net/mlx4/mlx4_rxq.c > > @@ -750,6 +750,7 @@ struct mlx4_rss * > > dev->data->dev_conf.rxmode.hw_ip_checksum), > > .csum_l2tun =3D (priv->hw_csum_l2tun && > > dev->data- > >dev_conf.rxmode.hw_ip_checksum), > > + .l2tun_offload =3D priv->hw_l2tun_offload, >=20 > Assuming a data path change is really needed, this one could likely stay = since > it doesn't depend on the user enabling checksums. >=20 > > .stats =3D { > > .idx =3D idx, > > }, > > diff --git a/drivers/net/mlx4/mlx4_rxtx.c > > b/drivers/net/mlx4/mlx4_rxtx.c index 3985e06..1131d56 100644 > > --- a/drivers/net/mlx4/mlx4_rxtx.c > > +++ b/drivers/net/mlx4/mlx4_rxtx.c > > @@ -37,6 +37,7 @@ > > */ > > > > #include > > +#include >=20 > What for? >=20 > > #include > > #include > > > > @@ -751,7 +752,8 @@ struct pv { > > * Packet type for struct rte_mbuf. > > */ > > static inline uint32_t > > -rxq_cq_to_pkt_type(volatile struct mlx4_cqe *cqe) > > +rxq_cq_to_pkt_type(volatile struct mlx4_cqe *cqe, > > + uint32_t l2tun_offload) > > { > > uint8_t idx =3D 0; > > uint32_t pinfo =3D rte_be_to_cpu_32(cqe->vlan_my_qpn); > > @@ -762,7 +764,7 @@ struct pv { > > * bit[7] - MLX4_CQE_L2_TUNNEL > > * bit[6] - MLX4_CQE_L2_TUNNEL_IPV4 > > */ > > - if (!(pinfo & MLX4_CQE_L2_VLAN_MASK) && (pinfo & > MLX4_CQE_L2_TUNNEL)) > > + if (l2tun_offload && (pinfo & MLX4_CQE_L2_TUNNEL)) > > idx |=3D ((pinfo & MLX4_CQE_L2_TUNNEL) >> 20) | > > ((pinfo & MLX4_CQE_L2_TUNNEL_IPV4) >> 19); > > /* > > @@ -960,7 +962,8 @@ struct pv { > > } > > pkt =3D seg; > > /* Update packet information. */ > > - pkt->packet_type =3D rxq_cq_to_pkt_type(cqe); > > + pkt->packet_type =3D > > + rxq_cq_to_pkt_type(cqe, rxq- > >l2tun_offload); > > pkt->ol_flags =3D 0; > > pkt->pkt_len =3D len; > > if (rxq->csum | rxq->csum_l2tun) { diff --git > > a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h index > > 4acad80..463df2b 100644 > > --- a/drivers/net/mlx4/mlx4_rxtx.h > > +++ b/drivers/net/mlx4/mlx4_rxtx.h > > @@ -80,6 +80,7 @@ struct rxq { > > volatile uint32_t *rq_db; /**< RQ doorbell record. */ > > uint32_t csum:1; /**< Enable checksum offloading. */ > > uint32_t csum_l2tun:1; /**< Same for L2 tunnels. */ > > + uint32_t l2tun_offload:1; /**< L2 tunnel offload is enabled. */ > > struct mlx4_cq mcq; /**< Info for directly manipulating the CQ. */ > > struct mlx4_rxq_stats stats; /**< Rx queue counters. */ > > unsigned int socket; /**< CPU socket ID for allocations. */ > > -- > > 1.8.3.1 > > >=20 > -- > Adrien Mazarguil > 6WIND