From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20064.outbound.protection.outlook.com [40.107.2.64]) by dpdk.org (Postfix) with ESMTP id 2D5915398 for ; Thu, 27 Dec 2018 09:13:00 +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=hqINsuoarZl88FOAdL7FYyfu8M2lSyNGtbcXm5B1stk=; b=P9Oq8PPBVKTWYTA+9fD+4Sx6fU526LCJMxKb9ZafZk8y+50VHesX3Q14Cz2DNY75DxUCorx9CMQMS3DXAfCnzjEJLf+DYRNsZl6C0BuayeY/oo2YtTewsKuihMvkI+Xn+FiscbtIfNY1xm3EmakhmtDnImVAJWwQzcSFG5zPDHs= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB5559.eurprd05.prod.outlook.com (20.177.193.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.25; Thu, 27 Dec 2018 08:12:58 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::b0a0:72a4:7547:1c3c]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::b0a0:72a4:7547:1c3c%4]) with mapi id 15.20.1471.019; Thu, 27 Dec 2018 08:12:58 +0000 From: Shahaf Shuler To: Mordechay Haimovsky , "dev@dpdk.org" CC: Mordechay Haimovsky , Dekel Peled Thread-Topic: [PATCH v1 2/3] net/mlx5: add devx functions to glue Thread-Index: AQHUnF+ZBWuPiGSXaUa23Lbg67omd6WSOWkQ Date: Thu, 27 Dec 2018 08:12:58 +0000 Message-ID: References: <1545748697-3385-1-git-send-email-motih@mellanox.com> <1545748697-3385-3-git-send-email-motih@mellanox.com> In-Reply-To: <1545748697-3385-3-git-send-email-motih@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; DB7PR05MB5559; 6:ai+ecfHg12TkGPEuvr/nYt8jNMRY6cg95lAn6DGRcSEgJKOPACnHETL0o7oDFETtlFnKi7MbjJD5prPzUlitllUvUDWfIV684nvzoDMji8CMq1n65WfqMKQkSuktadar/M/2ML8jkqa+hBWaTtumJXPAKi/vOG7At7WbDlEGaGarONuqNdQGcpa0td89PQ3pHkpUXEt0xypv81DCLZJCfsTL0XSA/kbaZO6V/wXdVc7ECsvVsn6bBH0ewn6IE38mQBVaZmS0hPyoe5Chuzk/vkt9jdsNq8gleaD84sy3+jtega4jeEoKxgS00cq7A3WmLqvw4cI/U3RMvikECSCRsdmUUyybGSERfIflbH8S3rWrOvos0RaM4dBD0ANoNO/26yt4Dp6gicVnKqDmOvWrlU5mVe3o9pEboG1fO/Lg6jG1OITqt2iaVRmsR3q7mzFMvCAWfIY0V5jVRmrh85WNEQ==; 5:S+KWiwoOOjyjB/B+wCvpNdnjkz7EG3B4Gol3fpYSYIktlbcs7oOIQEL16v2pMZUmPSiP7yjngQKfvFS9ffc8oA5Z7K8q/J7/wNj1TY+6npIByBjjyeDzmX4h4hSFw9PvXFG0v2Ydbq4ElT7OpxqFdyidM3/cD47f52kwFpKbs1o=; 7:8orR/rsffPoyx0pZjhSgR6bNyUMKA8R7qG26Ga12UAV+E2UbM110nwDx8dxw8MN5ycxnksPXENhQl+pq7ZuUQx6qYpSASeyo1/zKCDAO6PwtuEVIsvhjiuAmMI1Yx3oiMO4WnGeZPHYv+7MCWbt6LQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 33a67993-06b1-4bfc-abe0-08d66bd31d07 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:DB7PR05MB5559; x-ms-traffictypediagnostic: DB7PR05MB5559: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(3231475)(944501520)(52105112)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB5559; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB5559; x-forefront-prvs: 0899B47777 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(376002)(346002)(39860400002)(199004)(189003)(74316002)(4326008)(106356001)(55016002)(68736007)(66066001)(486006)(105586002)(2906002)(8676002)(7696005)(71190400001)(229853002)(19627235002)(71200400001)(6506007)(6436002)(256004)(2501003)(25786009)(76176011)(97736004)(33656002)(81166006)(102836004)(446003)(26005)(316002)(107886003)(86362001)(8936002)(6116002)(3846002)(476003)(7736002)(186003)(110136005)(6246003)(99286004)(5660300001)(305945005)(81156014)(53936002)(478600001)(54906003)(11346002)(9686003)(966005)(14454004)(6306002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5559; 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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: UBP53j8zJEAYrfAcujZwFnZMPTOJwCXUekJi/Wv/DdE8920LgXASJZ4Jit3SOa5yaxUyCmGdh+RQYLiZi5B2hzm6YMYrjDftzCazV9U01qpXEAZR5Vh9nqYIzT//v5IFwC+g3iLoPVPuJWU+fyG4Cbs5mSFBu6GZyvyoQVe8/EjtQBncT9aIklbk9Cq5ARVeZbMXM42h/Ej57hdxxvrGxe6RjtAjw8fjZ+lFH567KEmTHPzomRmm7uJimEI2bpXFTT6xOPH9zTb9FHAL8D6WTfbQEXiBbTx/pweWX73chM4zfzysmh+CuaZVCGbijjHz 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: 33a67993-06b1-4bfc-abe0-08d66bd31d07 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2018 08:12:58.7366 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5559 Subject: Re: [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: Thu, 27 Dec 2018 08:13:00 -0000 Tuesday, December 25, 2018 4:39 PM, Mordechay Haimovsky: > Subject: [dpdk-dev] [PATCH v1 2/3] net/mlx5: add devx functions to glue >=20 > 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. >=20 > Signed-off-by: Moti Haimovsky Acked-by: Shahaf Shuler Note in general you need also the bump the LIB_GLUE version, but there is a= commit which do it already: https://patches.dpdk.org/patch/49277/ Please make sure you rebase on top of it.=20 > --- > 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(+) >=20 > 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 modifie= d. > */ 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; > -- > 1.8.3.1