From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41F02A0588; Wed, 8 Apr 2020 01:07:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A6481C068; Wed, 8 Apr 2020 01:06:59 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 8EE631C042; Wed, 8 Apr 2020 01:06:57 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 43C755C0195; Tue, 7 Apr 2020 19:06:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 07 Apr 2020 19:06:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=jfp74W63lk aZMLVqxHo7NW144BbizGwH55IBTdCSyi0=; b=KisXJJkwugmRR8bxotuqbt/9t7 OcRK7hhNSjlEvvyW9kKQvNyVrZ3x342zcx75H9iJ45RsNFqxwTr7y0KYzy/pZQqd FIvwWhTzZEnx8TFUK/Bj00GBAyu4k4nYhXzSYxF7hvQKFsROdXkYqCJMn1S8sJx4 7+nQG/zRO4doTZWig= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=jfp74W63lkaZMLVqxHo7NW144BbizGwH55IBTdCSyi0=; b=k5wbM5DR fMOSJzCNsxZHX+Jr0aZUbEI0gIBgeDcypXTUPIEn+zNDreLZFWOx9ofBZjETA7us ZHexMt5yUWCB280/PZuoIfizlVr/hQ3eqY1awRw3cN8bh+n5Sj0DVDAftkuEsh5G dkBAkmTDhogf1UHuCfS4o5NUwFGznWoB30I4Flu1/IKxBOu4qb5gJch8z+ROqR+I MthDrAtneGXK1oVMiufQRZz5KN/aYN0KyPXTU/8R7vtMEWEMTrRa8R8btpO9qaoR UPt3kerkKgEuBGJBTFfnd4EzH8Al1kkD20RVF/ZoqLe826WHw/e2m0w2OWpGNMJG 0cDAL6QBSQQGwA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeigddujecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 7B8E9306D60D; Tue, 7 Apr 2020 19:06:56 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: stable@dpdk.org, Matan Azrad , Shahaf Shuler Date: Wed, 8 Apr 2020 01:06:47 +0200 Message-Id: <20200407230647.59478-4-thomas@monjalon.net> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407230647.59478-1-thomas@monjalon.net> References: <20200210103216.1168439-1-thomas@monjalon.net> <20200407230647.59478-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/3] net/mlx4: fix build with -fno-common 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The variable storages of the same name are merged together if compiled with -fcommon. This is the default. This default behaviour allows to declare a variable in a header file and share the variable in every .o binaries thanks to merge at link-time. In the case of dlopen linking of the glue library, the pointer mlx4_glue is referencing the glue functions struct and is set after calling dlopen. If compiling with -fno-common (default in GCC 10), the variables must be declared as extern to avoid multiple re-definitions. In case the glue layer is split in glue library, the variable mlx4_glue needs to have its own storage for the rest of the PMD. Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Acked-by: Matan Azrad --- drivers/net/mlx4/mlx4.c | 4 ++++ drivers/net/mlx4/mlx4_glue.h | 2 +- drivers/net/mlx4/mlx4_rxtx.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 339a4d3ab6..ee15f28dff 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -49,6 +49,10 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" +#ifdef MLX4_GLUE +const struct mlx4_glue *mlx4_glue; +#endif + static const char *MZ_MLX4_PMD_SHARED_DATA = "mlx4_pmd_shared_data"; /* Shared memory between primary and secondary processes. */ diff --git a/drivers/net/mlx4/mlx4_glue.h b/drivers/net/mlx4/mlx4_glue.h index 668ca86700..5d9e985495 100644 --- a/drivers/net/mlx4/mlx4_glue.h +++ b/drivers/net/mlx4/mlx4_glue.h @@ -84,6 +84,6 @@ struct mlx4_glue { void *attr); }; -const struct mlx4_glue *mlx4_glue; +extern const struct mlx4_glue *mlx4_glue; #endif /* MLX4_GLUE_H_ */ diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h index 8baf33fa94..9de6c59411 100644 --- a/drivers/net/mlx4/mlx4_rxtx.h +++ b/drivers/net/mlx4/mlx4_rxtx.h @@ -124,7 +124,7 @@ struct txq { /* mlx4_rxq.c */ -uint8_t mlx4_rss_hash_key_default[MLX4_RSS_HASH_KEY_SIZE]; +extern uint8_t mlx4_rss_hash_key_default[MLX4_RSS_HASH_KEY_SIZE]; int mlx4_rss_init(struct mlx4_priv *priv); void mlx4_rss_deinit(struct mlx4_priv *priv); struct mlx4_rss *mlx4_rss_get(struct mlx4_priv *priv, uint64_t fields, -- 2.26.0