DPDK patches and discussions
 help / color / mirror / Atom feed
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
To: dev <dev@dpdk.org>,
	 Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>,
	Chao Zhu <chaozhu@linux.vnet.ibm.com>
Cc: Luca Boccassi <bluca@debian.org>, Thomas Monjalon <thomasm@mellanox.com>
Subject: Re: [dpdk-dev] 18.08 build error on ppc64el - bool as vector type
Date: Wed, 22 Aug 2018 17:11:41 +0200	[thread overview]
Message-ID: <CAATJJ0LP=u_QufpZJv-Q96+vWm_NA_Nneh7hqOorZQ_=O=2+sg@mail.gmail.com> (raw)
In-Reply-To: <CAATJJ0Ld_3o7FzZaoRO_eK2qWDpBuYg6QtKDCVjEUh22V_7k=w@mail.gmail.com>

Just FYI the simple change hits similar issues later on.

The (not really) proposed patch would have to be extended to be as
following.
We really need a better solution (or somebody has to convince me that my
change is better than a band aid).


Description: Fix ppc64le build error between altivec and bool

We really hope there will eventually be a better fix for this, but
currently
we have to unbreak building this code so until something better is
available
let's use this modification.

Forwarded: yes
Forward-info: http://mails.dpdk.org/archives/dev/2018-August/109926.html
Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Last-Update: 2018-08-22
--- a/drivers/net/mlx5/mlx5_nl.c
+++ b/drivers/net/mlx5/mlx5_nl.c
@@ -834,8 +834,8 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *
               .switch_id = 0,
       };
       size_t off = NLMSG_LENGTH(sizeof(struct ifinfomsg));
-       bool port_name_set = false;
-       bool switch_id_set = false;
+       int port_name_set = 0;
+       int switch_id_set = 0;

       if (nh->nlmsg_type != RTM_NEWLINK)
               goto error;
@@ -854,7 +854,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *
                       if (errno ||
                           (size_t)(end - (char *)payload) !=
strlen(payload))
                               goto error;
-                       port_name_set = true;
+                       port_name_set = 1;
                       break;
               case IFLA_PHYS_SWITCH_ID:
                       info.switch_id = 0;
@@ -862,7 +862,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *
                               info.switch_id <<= 8;
                               info.switch_id |= ((uint8_t *)payload)[i];
                       }
-                       switch_id_set = true;
+                       switch_id_set = 1;
                       break;
               }
               off += RTA_ALIGN(ra->rta_len);
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1335,8 +1335,8 @@ mlx5_sysfs_switch_info(unsigned int ifin
       char ifname[IF_NAMESIZE];
       FILE *file;
       struct mlx5_switch_info data = { .master = 0, };
-       bool port_name_set = false;
-       bool port_switch_id_set = false;
+       int port_name_set = 0;
+       int port_switch_id_set = 0;
       char c;

       if (!if_indextoname(ifindex, ifname)) {
--- a/drivers/net/mlx5/mlx5_nl_flow.c
+++ b/drivers/net/mlx5/mlx5_nl_flow.c
@@ -385,11 +385,11 @@ mlx5_nl_flow_transpose(void *buf,
       const struct rte_flow_action *action;
       unsigned int n;
       uint32_t act_index_cur;
-       bool in_port_id_set;
-       bool eth_type_set;
-       bool vlan_present;
-       bool vlan_eth_type_set;
-       bool ip_proto_set;
+       int in_port_id_set;
+       int eth_type_set;
+       int vlan_present;
+       int vlan_eth_type_set;
+       int ip_proto_set;
       struct nlattr *na_flower;
       struct nlattr *na_flower_act;
       struct nlattr *na_vlan_id;
@@ -404,11 +404,11 @@ init:
       action = actions;
       n = 0;
       act_index_cur = 0;
-       in_port_id_set = false;
-       eth_type_set = false;
-       vlan_present = false;
-       vlan_eth_type_set = false;
-       ip_proto_set = false;
+       in_port_id_set = 0;
+       eth_type_set = 0;
+       vlan_present = 0;
+       vlan_eth_type_set = 0;
+       ip_proto_set = 0;
       na_flower = NULL;
       na_flower_act = NULL;
       na_vlan_id = NULL;


On Tue, Aug 21, 2018 at 4:19 PM Christian Ehrhardt <
christian.ehrhardt@canonical.com> wrote:

> Hi,
> Debian and Ubuntu face a build error with 18.08 on ppc64el.
> It looks like that:
>
> Full log:
>
> https://buildd.debian.org/status/fetch.php?pkg=dpdk&arch=ppc64el&ver=18.08-1&stamp=1534520196&raw=0
>
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c: In function
> 'mlx5_nl_switch_info_cb':
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:837:23: error: incompatible
> types when initializing type '__vector __bool int' {aka '__vector(4) __bool
> int'} using type 'int'
>   bool port_name_set = false;
>                        ^~~~~
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:838:23: error: incompatible
> types when initializing type '__vector __bool int' {aka '__vector(4) __bool
> int'} using type 'int'
>   bool switch_id_set = false;
>                        ^~~~~
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:857:18: error: incompatible
> types when assigning to type '__vector __bool int' {aka '__vector(4) __bool
> int'} from type 'int'
>     port_name_set = true;
>                   ^
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:865:18: error: incompatible
> types when assigning to type '__vector __bool int' {aka '__vector(4) __bool
> int'} from type 'int'
>     switch_id_set = true;
>                   ^
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:870:16: error: used vector
> type where scalar is required
>   info.master = switch_id_set && !port_name_set;
>                 ^~~~~~~~~~~~~
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:870:33: error: wrong type
> argument to unary exclamation mark
>   info.master = switch_id_set && !port_name_set;
>                                  ^
> /<<PKGBUILDDIR>>/drivers/net/mlx5/mlx5_nl.c:871:21: error: used vector
> type where scalar is required
>   info.representor = switch_id_set && port_name_set;
>
>
> Now I checked and the reason seems to be some combination of altivec and
> MLX headers and the use of bool - probably stdbool vs altivec bool.
>
> If built with gcc -E I see it the bool variables become:
>    __attribute__((altivec(bool__))) unsigned port_name_set =
>
> I have found a strawmans approach to it, but I'm sure people with
> experience on the matter will come up with something better.
>
> My current change looks like that and would work:
> $ git diff
> diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c
> index d61826aea..2cc8f49c5 100644
> --- a/drivers/net/mlx5/mlx5_nl.c
> +++ b/drivers/net/mlx5/mlx5_nl.c
> @@ -834,8 +834,8 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void
> *arg)
>                .switch_id = 0,
>        };
>        size_t off = NLMSG_LENGTH(sizeof(struct ifinfomsg));
> -       bool port_name_set = false;
> -       bool switch_id_set = false;
> +       int port_name_set = 0;
> +       int switch_id_set = 0;
>
>        if (nh->nlmsg_type != RTM_NEWLINK)
>                goto error;
> @@ -854,7 +854,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void
> *arg)
>                        if (errno ||
>                            (size_t)(end - (char *)payload) !=
> strlen(payload))
>                                goto error;
> -                       port_name_set = true;
> +                       port_name_set = 1;
>                        break;
>                case IFLA_PHYS_SWITCH_ID:
>                        info.switch_id = 0;
> @@ -862,7 +862,7 @@ mlx5_nl_switch_info_cb(struct nlmsghdr *nh, void
> *arg)
>                                info.switch_id <<= 8;
>                                info.switch_id |= ((uint8_t *)payload)[i];
>                        }
> -                       switch_id_set = true;
> +                       switch_id_set = 1;
>                        break;
>                }
>                off += RTA_ALIGN(ra->rta_len);
>
>
>
>
> --
> Christian Ehrhardt
> Software Engineer, Ubuntu Server
> Canonical Ltd
>


-- 
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd

  reply	other threads:[~2018-08-22 15:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 14:19 Christian Ehrhardt
2018-08-22 15:11 ` Christian Ehrhardt [this message]
2018-08-27 12:22   ` Adrien Mazarguil
2018-08-28 11:30     ` Christian Ehrhardt
2018-08-28 11:44       ` Adrien Mazarguil
2018-08-28 12:38         ` Christian Ehrhardt
2018-08-28 15:02           ` Adrien Mazarguil
2018-08-29  8:27             ` Christian Ehrhardt
2018-08-29 13:16               ` Adrien Mazarguil
2018-08-29 14:37                 ` Christian Ehrhardt
2018-08-30  8:36                   ` Thomas Monjalon
2018-08-30 11:22                     ` Alfredo Mendoza
2018-08-31  3:44                     ` Chao Zhu
2018-09-27 14:11                       ` Christian Ehrhardt
2018-08-30  9:48                   ` Christian Ehrhardt
2018-08-30 10:00                     ` [dpdk-dev] [PATCH] ppc64: fix compilation of when AltiVec is enabled Christian Ehrhardt
2018-08-30 10:52                     ` Takeshi T Yoshimura
2018-08-30 11:58                       ` Christian Ehrhardt
2018-11-05 14:15                         ` Thomas Monjalon
2018-11-05 21:20                           ` Pradeep Satyanarayana
2018-11-07 10:03                             ` Thomas Monjalon
2018-11-07 18:58                               ` dwilder
2018-11-07 21:21                                 ` Thomas Monjalon
2018-11-07 23:53                                   ` Pradeep Satyanarayana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAATJJ0LP=u_QufpZJv-Q96+vWm_NA_Nneh7hqOorZQ_=O=2+sg@mail.gmail.com' \
    --to=christian.ehrhardt@canonical.com \
    --cc=bluca@debian.org \
    --cc=chaozhu@linux.vnet.ibm.com \
    --cc=dev@dpdk.org \
    --cc=gowrishankar.m@linux.vnet.ibm.com \
    --cc=thomasm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).