From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2DC18A32A2
	for <public@inbox.dpdk.org>; Thu, 24 Oct 2019 16:53:42 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 02A0C1EB30;
	Thu, 24 Oct 2019 16:53:42 +0200 (CEST)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
 [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id B56A31EB2F
 for <dev@dpdk.org>; Thu, 24 Oct 2019 16:53:40 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1571928820;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=/GkO1xa5dGZGc/T32xasv51IUJ6KNvI/FfhFUQjIgOk=;
 b=GCCX1yoO0AUwWck0oGPTDBkqPKsPn4Vy83T8PiYFWGfvSzQZ8xz4i7Mz7GUy3uQNZbPGLG
 KfQtz6wdfHyHOGanuD+xKITkQBVXfsVO/ixWLGLrI/UgAWmrbcNf2dc95UexgC/m2+gzrQ
 SdWgM9ZPw9ugQ/pWtekOwpt5FokVmjI=
Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com
 [209.85.221.199]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-280-7n-1ymgMPAatAqypmI97zQ-1; Thu, 24 Oct 2019 10:53:35 -0400
Received: by mail-vk1-f199.google.com with SMTP id q187so10841233vkq.4
 for <dev@dpdk.org>; Thu, 24 Oct 2019 07:53:34 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=/GkO1xa5dGZGc/T32xasv51IUJ6KNvI/FfhFUQjIgOk=;
 b=g2jcDbClJ/L35Afn+i6C/SWH2ujW/IGIxlftO28XxU4RKm+6dcF7e2boLeuNqT/pqq
 g+vFNGoOqmsPWFcb0HStK/lim9CfKmYmvJHBDApqIRriomHVn7/4aS6Ey5ks/NywgIHX
 gGtIymw+KFYeyBpaHhZvtoRedfXar+bl66/NmJj4RkzWSEDdbQb5KxLPGLHMADDZV09p
 tRMwBKlY5F6fRmeUjwqKRs3vXyb5rlu3X2aPHZWDWMVWETWfBjXa5W98y7bKZg3LgyLb
 JHBaGnzQelM4LkknX3NUjgg/jMfTUmexAlFuRlVHpKbgNKhcyUvL1juJ2C4HeXLPAPjx
 zQrw==
X-Gm-Message-State: APjAAAUe41GYjt/KAm2pQGu93+LZ1XTpParXszrTiXB/TQKIZaf63ceV
 sec9KuEIhkE0+ea1ua1q8sJjC6RwfRtSnLUUxgl0gzttwUEWZfms1SOcyA9raJrW3zgoT7h+WwG
 XGBSGrNvY92J5NohdpqE=
X-Received: by 2002:a67:e88b:: with SMTP id x11mr8961453vsn.180.1571928813734; 
 Thu, 24 Oct 2019 07:53:33 -0700 (PDT)
X-Google-Smtp-Source: APXvYqycVyB8F2KzDyvnuyYYT1c3DMykRbr4gSYOcm2uf14s5DkOVlfiuG25ZWQgk7guVl/DWUBwv2KyFregJ6/rupE=
X-Received: by 2002:a67:e88b:: with SMTP id x11mr8961432vsn.180.1571928813231; 
 Thu, 24 Oct 2019 07:53:33 -0700 (PDT)
MIME-Version: 1.0
References: <20190905145315.19395-1-ferruh.yigit@intel.com>
 <20190905145315.19395-6-ferruh.yigit@intel.com>
In-Reply-To: <20190905145315.19395-6-ferruh.yigit@intel.com>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 24 Oct 2019 16:53:22 +0200
Message-ID: <CAJFAV8x_04FRrhgai6G4d72QqHN82hd0qtpVo3HzY9scYicGfg@mail.gmail.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Gagandeep Singh <g.singh@nxp.com>, Hemant Agrawal <hemant.agrawal@nxp.com>,
 Akhil Goyal <akhil.goyal@nxp.com>, dev <dev@dpdk.org>,
 dpdk stable <stable@dpdk.org>
X-MC-Unique: 7n-1ymgMPAatAqypmI97zQ-1
X-Mimecast-Spam-Score: 0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH 05/10] crypto/dpaa2_sec: fix
 global variable multiple definitions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Thu, Sep 5, 2019 at 4:54 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> 'rta_sec_era' global variable is defined in 'crypto/dpaa2_sec',
> 'crypto/caam_jr' & 'crypto/dpaa_sec' PMDs with the same name. This means
> they share same storage when application linked with static DPDK
> library, which is not the intention. Three differing drivers sharing
> same global variable is a defect.
>
> Variable has been used by multiple header files in static inline
> functions and these header files are shared by all three PMDs, this
> forces using same variable name in three PMDs.
>
> Since the variable is used only single .c file in 'crypto/dpaa2_sec' &
> 'crypto/dpaa_sec' converting global variable to 'static', this requires
> removing 'extern' definition from header files, and this requires moving
> the global variable definition before including those headers in .c
> files.
>
> For 'crypto/caam_jr' multiple .c files exists and includes these
> headers which prevent making variable static, so only one file has the
> global variable and others has 'extern' keyword on .c files.
>
> This change should let all three drivers have their own storage for the
> 'rta_sec_era' global variable without multiple definitions.
>
> Fixes: 1d678de329ab ("crypto/caam_jr: add basic job ring routines")
> Fixes: c3e85bdcc6e6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA pla=
tform")
> Cc: stable@dpdk.org

Hit a build issue, with gcc, static build:

../drivers/crypto/dpaa_sec/dpaa_sec.c:33:25: error: static declaration
of =E2=80=98rta_sec_era=E2=80=99 follows non-static declaration
   33 | static enum rta_sec_era rta_sec_era;
      |                         ^~~~~~~~~~~
In file included from
../drivers/crypto/dpaa_sec/../dpaa2_sec/hw/rta/sec_run_time_asm.h:10,
                 from ../drivers/crypto/dpaa_sec/dpaa_sec.c:32:
../drivers/crypto/dpaa_sec/../dpaa2_sec/hw/desc.h:21:25: note:
previous declaration of =E2=80=98rta_sec_era=E2=80=99 was here
   21 | extern enum rta_sec_era rta_sec_era;
      |                         ^~~~~~~~~~~

And

../drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c:33:25: error: static
declaration of =E2=80=98rta_sec_era=E2=80=99 follows non-static declaration
   33 | static enum rta_sec_era rta_sec_era =3D RTA_SEC_ERA_8;
      |                         ^~~~~~~~~~~
In file included from ../drivers/crypto/dpaa2_sec/hw/rta/sec_run_time_asm.h=
:10,
                 from ../drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c:32:
../drivers/crypto/dpaa2_sec/hw/desc.h:21:25: note: previous
declaration of =E2=80=98rta_sec_era=E2=80=99 was here
   21 | extern enum rta_sec_era rta_sec_era;
      |                         ^~~~~~~~~~~
[5/86] Compiling C object
'drivers/a715181@@tmp_rte_pmd_caam_jr@sta/crypto_caam_jr_caam_jr.c.o'.



--=20
David Marchand