From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40088.outbound.protection.outlook.com [40.107.4.88]) by dpdk.org (Postfix) with ESMTP id E938A1B1F8 for ; Wed, 2 Jan 2019 10:43:20 +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:X-MS-Exchange-SenderADCheck; bh=J5nwu2z8lKc1auUloHwqqUIfSbiHGIWACTL7IqDJkFY=; b=Yt5HffqJR+4Oz/2Pxwpnp2Kt3Kd9/RAAOXsSaR29v/dpTJTYPYhxJfMraxSFGdDvAoAY9iOtTJNdg210GOquYwfcuGchDvVpe7I/uH68m40FlXTBZ3VWX3+QeNB84FTVB+Tet9dcE8JhulLt+LZwy1De1KevGbY2cc+LeUTQaOs= Received: from DB7PR05MB4444.eurprd05.prod.outlook.com (52.134.109.21) by DB7PR05MB5415.eurprd05.prod.outlook.com (20.177.123.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Wed, 2 Jan 2019 09:43:19 +0000 Received: from DB7PR05MB4444.eurprd05.prod.outlook.com ([fe80::6d18:42b9:26fe:ea2f]) by DB7PR05MB4444.eurprd05.prod.outlook.com ([fe80::6d18:42b9:26fe:ea2f%2]) with mapi id 15.20.1495.005; Wed, 2 Jan 2019 09:43:19 +0000 From: Mordechay Haimovsky To: "dev@dpdk.org" CC: Mordechay Haimovsky Thread-Topic: [PATCH v3 2/3] net/mlx5: add devx functions to glue Thread-Index: AQHUon+Y9Z+lCqnpC0u6CpNSfBiAEA== Date: Wed, 2 Jan 2019 09:43:19 +0000 Message-ID: <1546422185-30813-3-git-send-email-motih@mellanox.com> References: <1545949196-3355-4-git-send-email-motih@mellanox.com> In-Reply-To: <1545949196-3355-4-git-send-email-motih@mellanox.com> Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0218.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::14) To DB7PR05MB4444.eurprd05.prod.outlook.com (2603:10a6:5:1b::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB5415; 6:dasNMG4tePP3AuMCOv3YEz8clbZXFF8X8fYp5rV8Jk3iui0+hdFGBO+TZbO35vzYeSw3vexZOoNwN4/FwRBgJY0xkARnGFb5JfaVpmB6yl0fThzHxwqTyAf1hqh3Sph9zdSo+aU/fCg9UM39oCvO0M9aCPNPAqLd8zezNC7pbm9l+YevxNWqN6+TB87AIyEHl194nG29iom4SWWYup6ErJe1OQ93BEQg5mPmemPPJHDsCjhrLwj0ILmJ81rjx9F32PKum3rE1D2j7vIvF6sAVR+T/sI6maxSeCBnHC+n7T04KJElDRgybSvVNa0RIZ/mAwBsAPC2oHfuU2AQ/w94N3x2g5fcIWabErvMKMBtgx1frsdxrAjGOHSGS9IjfhUCmecaQ1Th9tPQlm1NN0b7L3mAjPqezgzoGslWx8QzlWIFXCxTECPfjiTsdTu6iIHSsxHrfSd8ewTEEaGagwV27Q==; 5:tAE55X2az7fCcsujdFYgUd1zc6hhXz+DUUKY/GKb3A2LaunJwt66JCDEwuJ89W9okypMddVnpBIwb/daZJO7vIAAfoKw5RW4gqOHvnje1e8sepRSX/teM3S8lhqwJEazKTKD2eTvXyo2KUDK56z7/aPepCtn0xwbUEmai2wnAU6+y5cVSw6M7B3KICcf06/K8n2Lt8eVmtY2Bh2KsRJA4w==; 7:29GNwNQxEbiN862SQ2TF0N0y9u+mDz//rt04c/dsxW1XNLJ2iIt3+3UaewW8tKeyzObEy+4hnIf0HyoRBx3LvWPyEm/IjN0SRZerRZf1ezch5qV1kEt2yfs/jzQ28/ShNhMGdEZs/u+wZ3nD01FI+g== x-ms-office365-filtering-correlation-id: bea784c9-8a6b-4abd-1348-08d67096ba6a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB5415; x-ms-traffictypediagnostic: DB7PR05MB5415: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(93006095)(93001095)(3231475)(944501520)(52105112)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB5415; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB5415; x-forefront-prvs: 0905A6B2C7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(136003)(366004)(346002)(199004)(189003)(476003)(8676002)(6436002)(81156014)(8936002)(6116002)(3846002)(14454004)(2351001)(68736007)(6486002)(2906002)(5640700003)(81166006)(107886003)(4326008)(7736002)(305945005)(25786009)(1730700003)(6512007)(5660300001)(53936002)(6916009)(66066001)(99286004)(2501003)(36756003)(478600001)(86362001)(316002)(256004)(386003)(6506007)(105586002)(26005)(102836004)(71200400001)(97736004)(106356001)(76176011)(52116002)(446003)(2616005)(11346002)(186003)(71190400001)(486006)(19627235002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5415; H:DB7PR05MB4444.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9d0nkmxsPezbzsQpew0VPvop+6TGCKsiz9OfHXZOxIv4v3mK5VaWNAut4QTQX1ImIqXOENskVfFae/IiPkyE3ux0k1glQp2CjOkLJrikzO+sNix9duhggHp44CTMnNRYmczZSUYk0QSWLiyc1S1Unt6AGMdO+yHhVR3i+BXdT0TNU9oY7PGsbRds/uNfq4max4AUJLRHcyjGOMy1stpNBWed7c6hkNk8k7grD/nnXQQR0D80qGG8AXhVSfuCTI4wwE+wTw1FoVSDjcuHjor2lp5rJuqtG7bgudB55VGaavzBSznxemyGF8qovQV/i6RJ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: bea784c9-8a6b-4abd-1348-08d67096ba6a X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2019 09:43:19.8016 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5415 Subject: [dpdk-dev] [PATCH v3 2/3] net/mlx5: add devx functions to glue 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, 02 Jan 2019 09:43:21 -0000 This patch adds glue functions for operations: - dv_open_device. - devx object create, destroy, query and modify. - devx general command The new operations depend on HAVE_IBV_DEVX_OBJ. Signed-off-by: Moti Haimovsky --- v2: * Modifications according to review inputs. see message Id: 1545748697-3385-3-git-send-email-motih@mellanox.com --- drivers/net/mlx5/Makefile | 5 +++ drivers/net/mlx5/meson.build | 2 + drivers/net/mlx5/mlx5_glue.c | 98 ++++++++++++++++++++++++++++++++++++++++= ++++ drivers/net/mlx5/mlx5_glue.h | 19 +++++++++ 4 files changed, 124 insertions(+) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 1353c18..8ddad1a 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -148,6 +148,11 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config= -h.sh func mlx5dv_create_flow_action_packet_reformat \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ + HAVE_IBV_DEVX_OBJ \ + infiniband/mlx5dv.h \ + func mlx5dv_devx_obj_create \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_ETHTOOL_LINK_MODE_25G \ /usr/include/linux/ethtool.h \ enum ETHTOOL_LINK_MODE_25000baseCR_Full_BIT \ diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 8ba19e8..e2fc4ea 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -104,6 +104,8 @@ if build 'IBV_FLOW_SPEC_MPLS' ], [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', 'IBV_WQ_FLAG_RX_END_PADDING' ], + [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_create' ], [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', 'SUPPORTED_40000baseKR4_Full' ], [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c index a806d92..c817d86 100644 --- a/drivers/net/mlx5/mlx5_glue.c +++ b/drivers/net/mlx5/mlx5_glue.c @@ -498,6 +498,98 @@ #endif } =20 +static struct ibv_context * +mlx5_glue_dv_open_device(struct ibv_device *device) +{ +#ifdef HAVE_IBV_DEVX_OBJ + return mlx5dv_open_device(device, + &(struct mlx5dv_context_attr){ + .flags =3D MLX5DV_CONTEXT_FLAGS_DEVX, + }); +#else + (void)device; + return NULL; +#endif +} + +static struct mlx5dv_devx_obj * +mlx5_glue_devx_obj_create(struct ibv_context *ctx, + const void *in, size_t inlen, + void *out, size_t outlen) +{ +#ifdef HAVE_IBV_DEVX_OBJ + return mlx5dv_devx_obj_create(ctx, in, inlen, out, outlen); +#else + (void)ctx; + (void)in; + (void)inlen; + (void)out; + (void)outlen; + return NULL; +#endif +} + +static int +mlx5_glue_devx_obj_destroy(struct mlx5dv_devx_obj *obj) +{ +#ifdef HAVE_IBV_DEVX_OBJ + return mlx5dv_devx_obj_destroy(obj); +#else + (void)obj; + return -ENOTSUP; +#endif +} + +static int +mlx5_glue_devx_obj_query(struct mlx5dv_devx_obj *obj, + const void *in, size_t inlen, + void *out, size_t outlen) +{ +#ifdef HAVE_IBV_DEVX_OBJ + return mlx5dv_devx_obj_query(obj, in, inlen, out, outlen); +#else + (void)obj; + (void)in; + (void)inlen; + (void)out; + (void)outlen; + return -ENOTSUP; +#endif +} + +static int +mlx5_glue_devx_obj_modify(struct mlx5dv_devx_obj *obj, + const void *in, size_t inlen, + void *out, size_t outlen) +{ +#ifdef HAVE_IBV_DEVX_OBJ + return mlx5dv_devx_obj_modify(obj, in, inlen, out, outlen); +#else + (void)obj; + (void)in; + (void)inlen; + (void)out; + (void)outlen; + return -ENOTSUP; +#endif +} + +static int +mlx5_glue_devx_general_cmd(struct ibv_context *ctx, + const void *in, size_t inlen, + void *out, size_t outlen) +{ +#ifdef HAVE_IBV_DEVX_OBJ + return mlx5dv_devx_general_cmd(ctx, in, inlen, out, outlen); +#else + (void)ctx; + (void)in; + (void)inlen; + (void)out; + (void)outlen; + return -ENOTSUP; +#endif +} =20 alignas(RTE_CACHE_LINE_SIZE) const struct mlx5_glue *mlx5_glue =3D &(const struct mlx5_glue){ @@ -557,4 +649,10 @@ mlx5_glue_dv_create_flow_action_packet_reformat, .dv_create_flow_action_modify_header =3D mlx5_glue_dv_create_flow_action_modify_header, + .dv_open_device =3D mlx5_glue_dv_open_device, + .devx_obj_create =3D mlx5_glue_devx_obj_create, + .devx_obj_destroy =3D mlx5_glue_devx_obj_destroy, + .devx_obj_query =3D mlx5_glue_devx_obj_query, + .devx_obj_modify =3D mlx5_glue_devx_obj_modify, + .devx_general_cmd =3D mlx5_glue_devx_general_cmd, }; diff --git a/drivers/net/mlx5/mlx5_glue.h b/drivers/net/mlx5/mlx5_glue.h index 9cfe836..b118960 100644 --- a/drivers/net/mlx5/mlx5_glue.h +++ b/drivers/net/mlx5/mlx5_glue.h @@ -55,6 +55,10 @@ enum mlx5dv_flow_table_type { flow_table_type =3D 0, }; #endif =20 +#ifndef HAVE_IBV_DEVX_OBJ +struct mlx5dv_devx_obj; +#endif + /* LIB_GLUE_VERSION must be updated every time this structure is modified.= */ struct mlx5_glue { const char *version; @@ -169,6 +173,21 @@ struct mlx5_glue { size_t actions_sz, uint64_t actions[], enum mlx5dv_flow_table_type ft_type); + struct ibv_context *(*dv_open_device)(struct ibv_device *device); + struct mlx5dv_devx_obj *(*devx_obj_create) + (struct ibv_context *ctx, + const void *in, size_t inlen, + void *out, size_t outlen); + int (*devx_obj_destroy)(struct mlx5dv_devx_obj *obj); + int (*devx_obj_query)(struct mlx5dv_devx_obj *obj, + const void *in, size_t inlen, + void *out, size_t outlen); + int (*devx_obj_modify)(struct mlx5dv_devx_obj *obj, + const void *in, size_t inlen, + void *out, size_t outlen); + int (*devx_general_cmd)(struct ibv_context *context, + const void *in, size_t inlen, + void *out, size_t outlen); }; =20 const struct mlx5_glue *mlx5_glue; --=20 1.8.3.1