From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00073.outbound.protection.outlook.com [40.107.0.73]) by dpdk.org (Postfix) with ESMTP id 0634B1CF3C for ; Sun, 13 May 2018 08:05:37 +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=VvpyyJ02XgSBmXuB7mp/6HBAY/HaTLyl+YPDm2+WGP0=; b=DdDK1/bAC6eT4EcY2gsSi/TG04KRCdzaVTELHHVLRIPWEreQAbKEf5nqGJoEM9f+nUYERnbQ8IPzth0KhiBECKQ6BE1UREXsmq5EbsfRnmM+h6/g1+OHBzwTUP1o6rGs9MOR6QI3dZUjZPYoRyElcC8E8dtZJYTZNDAUmaZSPiQ= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4379.eurprd05.prod.outlook.com (52.134.108.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Sun, 13 May 2018 06:05:35 +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.0755.018; Sun, 13 May 2018 06:05:35 +0000 From: Shahaf Shuler To: Ophir Munk , "dev@dpdk.org" , "Adrien Mazarguil" CC: Thomas Monjalon , Olga Shern Thread-Topic: [PATCH v3 1/2] net/mlx4: advertise supported RSS hash functions Thread-Index: AQHT6GpGYO0sFAyAIU+9J9WRfQevZ6QtLx7Q Date: Sun, 13 May 2018 06:05:35 +0000 Message-ID: References: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: <1525962108-15215-1-git-send-email-ophirmu@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: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4379; 7:FR7d+Fwr7P1/H7KQ46ojll3DXvwI8rif8pjJNsT0oZf7U8jHbFq54tzC+q1S7Ko+t9RtwblipW075gBgDKmsRK+s0yrbidrLgjZcX+cCiCYSD6E/9dEWAQrl9lWxaNk4xZ+gb+o7vFjuXfrfQnma0duz7czsD7B+yGFbBk6A+9lSMrSI/K0CVRV49Qds46mlIUuuItDM63fK3ClSDvkw1gqKvEy9ix7R6glsfzy1qEw5LkPBu1uKRUFvg0EQ9uBm 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:DB7PR05MB4379; x-ms-traffictypediagnostic: DB7PR05MB4379: 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)(8121501046)(5005006)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB7PR05MB4379; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4379; x-forefront-prvs: 0671F32598 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(39380400002)(39860400002)(396003)(189003)(199004)(59450400001)(107886003)(478600001)(229853002)(5250100002)(3280700002)(2501003)(14454004)(25786009)(8936002)(102836004)(99286004)(6246003)(7696005)(76176011)(55016002)(86362001)(486006)(66066001)(2900100001)(2906002)(3660700001)(6436002)(105586002)(9686003)(53936002)(54906003)(4326008)(3846002)(6116002)(7736002)(81166006)(81156014)(5660300001)(74316002)(110136005)(476003)(106356001)(305945005)(33656002)(446003)(11346002)(6506007)(68736007)(316002)(26005)(8676002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4379; 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: 1xkc9/WFmWE7BodhnL7tI6JyTdCpZBeGh/yMLSc06FdRzF9qyqIL6tc9GF6HaXsGAunK4oKUR8gvglvh5ZX1DqQ9Car+651umz2Q/cBisxyNRWbRQ2MhK691fFzooYEBEZNmQkpplOEUV/yAtclix+E3bjkXNJhO6ZOBzTnj6ffoyefil8lBe6fJYP4ToJEs spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: fb3d80a6-7258-4e76-2ebf-08d5b8978b4a X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb3d80a6-7258-4e76-2ebf-08d5b8978b4a X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2018 06:05:35.7697 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4379 Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/mlx4: advertise supported RSS hash functions 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: Sun, 13 May 2018 06:05:37 -0000 Thursday, May 10, 2018 5:22 PM, Ophir Munk: @mellanox.com>; Shahaf > Shuler > Subject: [PATCH v3 1/2] net/mlx4: advertise supported RSS hash functions >=20 > Advertise mlx4 supported RSS functions as part of dev_infos_get callback. > Previous to this commit RSS support was reported as none. Since the > introduction of [1] it is required that all RSS configurations will be ve= rified. >=20 > [1] commit 8863a1fbfc66 ("ethdev: add supported hash function check") >=20 > Signed-off-by: Ophir Munk > --- > v1: > Initial release > v2: > Update based on reviews (split into 2 commits) > v3: > More updates based on reviews >=20 > drivers/net/mlx4/mlx4_ethdev.c | 12 ++++++----- > drivers/net/mlx4/mlx4_flow.c | 45 > ++++++++++++++++++++++++++++++++++++++++++ > drivers/net/mlx4/mlx4_flow.h | 35 > ++++++++++++++++++++++++++++++++ > 3 files changed, 87 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4_ethdev.c > b/drivers/net/mlx4/mlx4_ethdev.c index 9a76670..ef559a3 100644 > --- a/drivers/net/mlx4/mlx4_ethdev.c > +++ b/drivers/net/mlx4/mlx4_ethdev.c > @@ -582,11 +582,13 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, > struct rte_eth_dev_info *info) > info->if_index =3D if_nametoindex(ifname); > info->hash_key_size =3D MLX4_RSS_HASH_KEY_SIZE; > info->speed_capa =3D > - ETH_LINK_SPEED_1G | > - ETH_LINK_SPEED_10G | > - ETH_LINK_SPEED_20G | > - ETH_LINK_SPEED_40G | > - ETH_LINK_SPEED_56G; > + ETH_LINK_SPEED_1G | > + ETH_LINK_SPEED_10G | > + ETH_LINK_SPEED_20G | > + ETH_LINK_SPEED_40G | > + ETH_LINK_SPEED_56G; > + info->flow_type_rss_offloads =3D > + mlx4_ibv_to_rss_types(priv->hw_rss_sup); > } >=20 > /** > diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c > index 397a150..baad299 100644 > --- a/drivers/net/mlx4/mlx4_flow.c > +++ b/drivers/net/mlx4/mlx4_flow.c > @@ -134,6 +134,51 @@ mlx4_conv_rss_types(struct priv *priv, uint64_t > types) } >=20 > /** > + * Convert verbs RSS types to their DPDK equivalents. > + * > + * This function returns a group of RSS dpdk types given their dpdk -> DPDK > +equivalent group > + * of verbs types. > + * For example both source IPv4 and destination IPv4 verbs types are > +converted > + * into their equivalent RSS group types. If each of these verbs types > +existed > + * exclusively - no conversion would take place. > + * > + * @param types > + * RSS hash types in verbs format. > + * > + * @return > + * DPDK RSS hash fields supported by mlx4. > + */ > +uint64_t > +mlx4_ibv_to_rss_types(uint64_t types) > +{ > + enum { IPV4, IPV6, IPV4_TCP, IPV6_TCP, IPV4_UDP, IPV6_UDP}; > + > + const uint64_t in[] =3D { > + [IPV4] =3D IPV4_IBV_HF, > + [IPV6] =3D IPV6_IBV_HF, > + [IPV4_TCP] =3D IPV4_IBV_HF | TCP_IBV_HF, > + [IPV6_TCP] =3D IPV6_IBV_HF | TCP_IBV_HF, > + [IPV4_UDP] =3D IPV4_IBV_HF | UDP_IBV_HF, > + [IPV6_UDP] =3D IPV6_IBV_HF | UDP_IBV_HF, > + }; > + const uint64_t out[RTE_DIM(in)] =3D { > + [IPV4] =3D IPV4_RSS_HF, > + [IPV6] =3D IPV6_RSS_HF, > + [IPV4_TCP] =3D IPV4_RSS_HF | IPV4_TCP_RSS_HF, > + [IPV6_TCP] =3D IPV6_RSS_HF | IPV6_TCP_RSS_HF, > + [IPV4_UDP] =3D IPV4_RSS_HF | IPV4_UDP_RSS_HF, > + [IPV6_UDP] =3D IPV6_RSS_HF | IPV6_UDP_RSS_HF, > + }; > + uint64_t conv =3D 0; > + unsigned int i; > + > + for (i =3D 0; i !=3D RTE_DIM(in); ++i) > + if ((types & in[i]) =3D=3D in[i]) > + conv |=3D out[i]; > + return conv; > +} > + > +/** > * Merge Ethernet pattern item into flow rule handle. > * > * Additional mlx4-specific constraints on supported fields: > diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h > index 2c8dff3..e47982c 100644 > --- a/drivers/net/mlx4/mlx4_flow.h > +++ b/drivers/net/mlx4/mlx4_flow.h > @@ -30,6 +30,40 @@ > /** Meta pattern item used to distinguish internal rules. */ #define > MLX4_FLOW_ITEM_TYPE_INTERNAL ((enum rte_flow_item_type)-1) >=20 Any specific reason below MACRO are part of the .h file and not the .c file= ? Also all mlx4 related macros should be prefixed with MLX4_ > +/** IBV supported RSS hash functions combinations */ #define > +IPV4_IBV_HF ( \ > + IBV_RX_HASH_SRC_IPV4 | \ > + IBV_RX_HASH_DST_IPV4) > +#define IPV6_IBV_HF ( \ > + IBV_RX_HASH_SRC_IPV6 | \ > + IBV_RX_HASH_DST_IPV6) > +#define TCP_IBV_HF ( \ > + IBV_RX_HASH_SRC_PORT_TCP | \ > + IBV_RX_HASH_DST_PORT_TCP) > +#define UDP_IBV_HF (IBV_RX_HASH_SRC_PORT_UDP | \ > + IBV_RX_HASH_DST_PORT_UDP) > + > +/** Supported RSS hash functions combinations */ #define IPV4_RSS_HF ( > +\ > + ETH_RSS_IPV4 | \ > + ETH_RSS_FRAG_IPV4 | \ > + ETH_RSS_NONFRAG_IPV4_OTHER) > +#define IPV6_RSS_HF ( \ > + ETH_RSS_IPV6 | \ > + ETH_RSS_FRAG_IPV6 | \ > + ETH_RSS_NONFRAG_IPV6_OTHER | \ > + ETH_RSS_IPV6_EX) > +#define IPV4_TCP_RSS_HF ( \ > + ETH_RSS_NONFRAG_IPV4_TCP) > +#define IPV6_TCP_RSS_HF ( \ > + ETH_RSS_NONFRAG_IPV6_TCP | \ > + ETH_RSS_IPV6_TCP_EX) > +#define IPV4_UDP_RSS_HF ( \ > + ETH_RSS_NONFRAG_IPV4_UDP) > +#define IPV6_UDP_RSS_HF ( \ > + ETH_RSS_NONFRAG_IPV6_UDP | \ > + ETH_RSS_IPV6_UDP_EX) > + > /** PMD-specific (mlx4) definition of a flow rule handle. */ struct rte= _flow { > LIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. > */ @@ -49,6 +83,7 @@ struct rte_flow { > /* mlx4_flow.c */ >=20 > uint64_t mlx4_conv_rss_types(struct priv *priv, uint64_t rss_hf); > +uint64_t mlx4_ibv_to_rss_types(uint64_t ibv_rss_types); > int mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error); vo= id > mlx4_flow_clean(struct priv *priv); int mlx4_filter_ctrl(struct rte_eth_= dev > *dev, > -- > 2.7.4