From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20057.outbound.protection.outlook.com [40.107.2.57]) by dpdk.org (Postfix) with ESMTP id BDF5E1B200 for ; Tue, 25 Dec 2018 15:38:44 +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=viLrQocMj8diQct/ZHKs2tGACoCm1FNMcxm6ACTaJHw=; b=Q6GIrOYSv/sR/onndfMK38ED8e45QjN3QkZk+WnNHy2R4hFL0wJZMblo5tepqkmjgYSCOoYPQo+h/t+qPojLLNDp8WDVxBr3l6oMEfdr/cbS8ZTuwmwBFJ9xHb6ZPZIc6WD2szPjzqSfY6la34RH6ML4E6UYhxA8g2vzRqsxbCs= Received: from AM0PR05MB4435.eurprd05.prod.outlook.com (52.134.92.20) by AM0PR05MB5169.eurprd05.prod.outlook.com (20.178.18.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Tue, 25 Dec 2018 14:38:43 +0000 Received: from AM0PR05MB4435.eurprd05.prod.outlook.com ([fe80::c860:9e3d:3158:8ea]) by AM0PR05MB4435.eurprd05.prod.outlook.com ([fe80::c860:9e3d:3158:8ea%4]) with mapi id 15.20.1446.027; Tue, 25 Dec 2018 14:38:43 +0000 From: Mordechay Haimovsky To: "dev@dpdk.org" CC: Mordechay Haimovsky Thread-Topic: [PATCH v1 2/3] net/mlx5: add devx functions to glue Thread-Index: AQHUnF+J8WVmoKxUJUyn9O/JPwxxQg== Date: Tue, 25 Dec 2018 14:38:43 +0000 Message-ID: <1545748697-3385-3-git-send-email-motih@mellanox.com> References: <1545748697-3385-1-git-send-email-motih@mellanox.com> In-Reply-To: <1545748697-3385-1-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: CWLP265CA0157.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:52::25) To AM0PR05MB4435.eurprd05.prod.outlook.com (2603:10a6:208:5a::20) 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; AM0PR05MB5169; 6:OG3bmxsUF1lR2nvWrmIo3HWAhu2hZCg4Vm3IJ99dHiOWWxsPAGaLT+ZGWGZzCti7Jj155CiQugnfnc7J3SbXQyr1VH+529RsMLrCQOGgJT1Z5RlX+aPzv5vJNLJBGQo30c8TDFfFqM5fLuH9nkX8XQwZM+YYIQPpaPxy+biZI/gstuhKzmiNyOC9tvUtbrkMpi716DBhfVFiqKeiFvM8+lvYCtXc0UxGzfKTl9eZMzjL2rkxAzDIoNlsiUL2y91NUBTBhAnUrnGaOvNGG5crQG6RuD8GCAfsMWOYZvnQH9Wpfrkshb5O5/OjfnORknWzKbzp5SgSAL93xPXunPUsIXb3EkniT1ZV/ntrvyVkL4NF5my0aZhOjOmRQZ+/J3TrPA7FMVDniEsH1eAI/0C3SgjmWV9gno9akOU7HO/oQiOrH0Yw/fGGUvgBd+VIPyOnOMUbFY0u+qQbMLD78myytg==; 5:jbDAcSQf5x+Wr9rTtEDjMAYpGH/6Uo5TH6Yu2TAd5MCuQofaPfUgfgzKJZ3S93uvv6n6YJbUKmkl4ka7QBn+xh9O2/tOdy9rPo6OPoGsXbRp8n3d8TBZkeo0AosOpC38d56KGv95oXtslTrjgaM6ojk2lqA6kT1mm8JV0P6kEtg=; 7:jjvnTENsC8/wXgxKNF8dC4KY6FtghKed6MUMPj387YNg+gOUb3NojUbFzKcsUSUHoiEc4t/VB9V9GO5QnNn4M9DAv3uf14LB+ZooURvAUh19PDAIVgyv9HOf/BRMbVcqee5TsAADgCsxYBS0uM8QzA== x-ms-office365-filtering-correlation-id: ccf67272-75d1-4c7c-9467-08d66a76ab71 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB5169; x-ms-traffictypediagnostic: AM0PR05MB5169: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231475)(944501520)(52105112)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:AM0PR05MB5169; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB5169; x-forefront-prvs: 08978A8F5C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(366004)(376002)(39860400002)(396003)(189003)(199004)(6916009)(2906002)(102836004)(8936002)(8676002)(81166006)(1730700003)(81156014)(11346002)(386003)(36756003)(71200400001)(446003)(6506007)(6436002)(2616005)(476003)(66066001)(106356001)(105586002)(316002)(71190400001)(3846002)(486006)(2351001)(6116002)(6486002)(186003)(2501003)(5660300001)(26005)(99286004)(256004)(19627235002)(14454004)(6512007)(76176011)(5640700003)(107886003)(25786009)(86362001)(4326008)(52116002)(53936002)(305945005)(97736004)(478600001)(68736007)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB5169; H:AM0PR05MB4435.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: IKBnPPI9ntrMKPmtvHcLnVqwjP7Kc4yoezG9BxJnKI5tdpNzdCv5qdCENe+DPxCg3THHy6IWCN6ducJusTmMnDAYsFI8n8BbYHp/3ge1dvWgs6odgY4IoSJU9pa/BLEMdLfL75evGOFHswgsL49HmszOQmFuLIgxsjHxXto0RBpkDJMV6nuoLAXZEKZefk8HwilgNtHJHJIjs9hj1+LiK+vUhWR+RUcJVMJsgSTnOvIC73M02woCOqe2XtYH/ZtQ0YH3QniJC6JBj4w3ywhm+qbDFp1nNr6Hjh57zM0+xE/sLMGZKkAStVIwARHZU9CP 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: ccf67272-75d1-4c7c-9467-08d66a76ab71 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Dec 2018 14:38:43.7974 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5169 Subject: [dpdk-dev] [PATCH v1 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: Tue, 25 Dec 2018 14:38:45 -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 --- drivers/net/mlx5/Makefile | 5 +++ drivers/net/mlx5/meson.build | 2 + drivers/net/mlx5/mlx5_glue.c | 99 ++++++++++++++++++++++++++++++++++++++++= ++++ drivers/net/mlx5/mlx5_glue.h | 19 +++++++++ 4 files changed, 125 insertions(+) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 895cdfe..58e2d15 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 28938db..e323c3a 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 dd10ad6..7d3d9d3 100644 --- a/drivers/net/mlx5/mlx5_glue.c +++ b/drivers/net/mlx5/mlx5_glue.c @@ -479,6 +479,99 @@ #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 +} + alignas(RTE_CACHE_LINE_SIZE) const struct mlx5_glue *mlx5_glue =3D &(const struct mlx5_glue){ .version =3D MLX5_GLUE_VERSION, @@ -535,4 +628,10 @@ .dv_create_flow =3D mlx5_glue_dv_create_flow, .dv_create_flow_action_packet_reformat =3D mlx5_glue_dv_create_flow_action_packet_reformat, + .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 2d92ba8..a6cd2cd 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; @@ -164,6 +168,21 @@ struct mlx5_glue { void *data, enum mlx5dv_flow_action_packet_reformat_type reformat_type, 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