net-next build failure due to 16e5cc64?
Subsystems (8)
John,
I'm getting a failure when I try to build the latest net-next. I see
net/sched/sch_mqprio.c: In function `mqprio_init':net/sched/sch_mqprio.c:145: error: unknown field tc' specified in initializer net/sched/sch_mqprio.c:145: warning: missing braces around initializer net/sched/sch_mqprio.c:145: warning: (near initialization for tc.<anonymous>') make[2]: *** [net/sched/sch_mqprio.o] Error 1
I'm not sure why this wasn't noticed before, but in case this is due to my compiler version:
# gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16) Copyright (C) 2010 Free Software Foundation, Inc.
I'm finding that the minimum fix to avoid this error should be something like
include/linux/netdevice.h +1 -1
@@ -794,7 +794,7 @@ struct tc_to_netdev {union {u8 tc;struct tc_cls_u32_offload *cls_u32; - }; + } tc_u; };
But then all the users of this structure would need to be changed, which results in this patch below. Should I submit this to net-next, or is it addressed elsewhere?
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
@@ -4277,7 +4277,7 @@ int __bnx2x_setup_tc(struct net_device *dev, u32 handle, __be16 proto, {if (handle !=TC_H_ROOT || tc->type !=TC_SETUP_MQPRIO )return -EINVAL ; -return bnx2x_setup_tc (dev, tc->tc); +return bnx2x_setup_tc (dev, tc->tc_u.tc); }/* called with rtnl_lock */
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -6
@@ -8403,20 +8403,20 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto,if (!(dev->features &NETIF_F_HW_TC ))return -EINVAL ; -switch (tc->cls_u32->command) { +switch (tc->tc_u.cls_u32->command) {case TC_CLSU32_NEW_KNODE :case TC_CLSU32_REPLACE_KNODE :return ixgbe_configure_clsu32 (adapter, - proto, tc->cls_u32); + proto, tc->tc_u.cls_u32);case TC_CLSU32_DELETE_KNODE : -return ixgbe_delete_clsu32 (adapter, tc->cls_u32); +return ixgbe_delete_clsu32 (adapter, tc->tc_u.cls_u32);case TC_CLSU32_NEW_HNODE :case TC_CLSU32_REPLACE_HNODE :return ixgbe_configure_clsu32_add_hnode (adapter, proto, - tc->cls_u32); + tc->tc_u.cls_u32);case TC_CLSU32_DELETE_HNODE :return ixgbe_configure_clsu32_del_hnode (adapter, - tc->cls_u32); + tc->tc_u.cls_u32);default :return -EINVAL ; }
@@ -8425,7 +8425,7 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto,if (handle !=TC_H_ROOT || tc->type !=TC_SETUP_MQPRIO )return -EINVAL ; -return ixgbe_setup_tc (dev, tc->tc); +return ixgbe_setup_tc (dev, tc->tc_u.tc); }#ifdef CONFIG_PCI_IOV
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -75,7 +75,7 @@ static int __mlx4_en_setup_tc(struct net_device *dev, u32 handle, __be16 proto,if (handle !=TC_H_ROOT || tc->type !=TC_SETUP_MQPRIO )return -EINVAL ; -return mlx4_en_setup_tc (dev, tc->tc); +return mlx4_en_setup_tc (dev, tc->tc_u.tc); }#ifdef CONFIG_RFS_ACCEL
drivers/net/ethernet/sfc/tx.c +1 -1
@@ -574,7 +574,7 @@ int efx_setup_tc(struct net_device *net_dev, u32 handle, __be16 proto,if (handle !=TC_H_ROOT || ntc->type !=TC_SETUP_MQPRIO )return -EINVAL ; - num_tc = ntc->tc; + num_tc = ntc->tc_u.tc;if (efx_nic_rev (efx) <EFX_REV_FALCON_B0 || num_tc >EFX_MAX_TX_TC )return -EINVAL ;
include/linux/netdevice.h +1 -1
@@ -794,7 +794,7 @@ struct tc_to_netdev {union {u8 tc;struct tc_cls_u32_offload *cls_u32; - }; + } tc_u; };
net/sched/cls_u32.c +24 -24
84 lines not on this page · raw message
net/sched/sch_mqprio.c +1 -1
@@ -142,7 +142,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)*/ if (qopt->hw) {struct tc_to_netdev tc = {.type =TC_SETUP_MQPRIO , - .tc = qopt->num_tc}; + .tc_u.tc = qopt->num_tc}; priv->hw_owned =1 ; err = dev->netdev_ops->ndo_setup_tc (dev, sch->handle,0 , &tc);
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -5330,7 +5330,7 @@ static int __i40e_setup_tc(struct net_device *netdev, u32 handle, __be16 proto, {if (handle !=TC_H_ROOT || tc->type !=TC_SETUP_MQPRIO )return -EINVAL ; -return i40e_setup_tc (netdev, tc->tc); +return i40e_setup_tc (netdev, tc->tc_u.tc); }/**
Quoted 11 lines · Sowmini Varadhan
John,
I'm getting a failure when I try to build the latest net-next. I see
net/sched/sch_mqprio.c: In function `mqprio_init':net/sched/sch_mqprio.c:145: error: unknown fieldtc' specified in initializer net/sched/sch_mqprio.c:145: warning: missing braces around initializer net/sched/sch_mqprio.c:145: warning: (near initialization fortc.<anonymous>') make[2]: *** [net/sched/sch_mqprio.o] Error 1
Quoted 8 lines
I'm not sure why this wasn't noticed before, but in case this is due to my compiler version:
# gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16) Copyright (C) 2010 Free Software Foundation, Inc.I'm finding that the minimum fix to avoid this error should be something like
Why not just initialize these fields explicitly? For example,
net/sched/sch_mqprio.c +2 -1
@@ -28,7 +28,7 @@ static void mqprio_destroy(struct Qdisc *sch) {struct net_device *dev =qdisc_dev (sch);struct mqprio_sched *priv =qdisc_priv (sch); -struct tc_to_netdev tc = {.type =TC_SETUP_MQPRIO }; +struct tc_to_netdev tc;unsigned int ntx;if (priv->qdiscs) {
@@ -39,6 +39,7 @@ static void mqprio_destroy(struct Qdisc *sch)kfree (priv->qdiscs); } + tc.type =TC_SETUP_MQPRIO ;if (priv->hw_owned && dev->netdev_ops->ndo_setup_tc) dev->netdev_ops->ndo_setup_tc (dev, sch->handle,0 , &tc);else
Quoted 38 lines · Cong Wang
Quoted 11 lines · Sowmini Varadhan
John,
I'm getting a failure when I try to build the latest net-next. I see
net/sched/sch_mqprio.c: In function `mqprio_init':net/sched/sch_mqprio.c:145: error: unknown fieldtc' specified in initializer net/sched/sch_mqprio.c:145: warning: missing braces around initializer net/sched/sch_mqprio.c:145: warning: (near initialization fortc.<anonymous>') make[2]: *** [net/sched/sch_mqprio.o] Error 1Quoted 8 lines
I'm not sure why this wasn't noticed before, but in case this is due to my compiler version:
# gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16) Copyright (C) 2010 Free Software Foundation, Inc.I'm finding that the minimum fix to avoid this error should be something like
Why not just initialize these fields explicitly? For example,
net/sched/sch_mqprio.c +1
-1@@ -28,7 +28,7 @@ static void mqprio_destroy(struct Qdisc *sch) {struct net_device *dev =qdisc_dev (sch);struct mqprio_sched *priv =qdisc_priv (sch); -struct tc_to_netdev tc = {.type =TC_SETUP_MQPRIO }; +struct tc_to_netdev tc;unsigned int ntx;if (priv->qdiscs) {
net/sched/sch_mqprio.c static void mqprio_destroy(struct Qdisc *sch) · line 42
Quoted 4 lines
net/sched/sch_mqprio.c +1
-0@@ -39,6 +39,7 @@ static void mqprio_destroy(struct Qdisc *sch)kfree (priv->qdiscs); } + tc.type =TC_SETUP_MQPRIO ;
And also set the rest to zero...
Quoted 3 lines
net/sched/sch_mqprio.c +0
-0if (priv->hw_owned && dev->netdev_ops->ndo_setup_tc) dev->netdev_ops->ndo_setup_tc (dev, sch->handle,0 , &tc);else
Quoted 2 lines · Cong Wang
Quoted 2 lines
net/sched/sch_mqprio.c: In function `mqprio_init':net/sched/sch_mqprio.c:145: error: unknown field `tc' specified in initializer
:
Quoted 3 lines
Why not just initialize these fields explicitly? For example,
+ struct
tc_to_netdevtc;
:
Quoted 1 line
+ tc.type =
TC_SETUP_MQPRIO;
The compiler error is for fields within the union which lacks both a tag and a union-name. So I'm not sure how the above will help.
--Sowmini
Quoted 6 lines · Sowmini Varadhan
Quoted 2 lines · Cong Wang
Quoted 2 lines
net/sched/sch_mqprio.c: In function `mqprio_init':net/sched/sch_mqprio.c:145: error: unknown field `tc' specified in initializer:Quoted 2 lines
Why not just initialize these fields explicitly? For example,
Quoted 8 lines
Quoted 1 line
+ struct
tc_to_netdevtc;:Quoted 1 line
+ tc.type =
TC_SETUP_MQPRIO;The compiler error is for fields within the union which lacks both a tag and a union-name. So I'm not sure how the above will help.
Come on.. we have plenty of such anonymous unions in skbuff.h...
Quoted 6 lines · Cong Wang
Quoted 4 lines
The compiler error is for fields within the union which lacks both a tag and a union-name. So I'm not sure how the above will help.
Come on.. we have plenty of such anonymous unions in
skbuff.h...
I realize that, even netdevice.h itself has other instances. Thus I dont understand why this one generated a compiler error for me. Thus I was wondering why others had not run into this and not suggesting it should be patched.
However, changing the way we set up type etc. doesnt seem relevant to what the compiler is flagging.
--Sowmini
Quoted 8 lines · Sowmini Varadhan
Quoted 6 lines · Cong Wang
Quoted 4 lines
The compiler error is for fields within the union which lacks both a tag and a union-name. So I'm not sure how the above will help.
Come on.. we have plenty of such anonymous unions in
skbuff.h...
Quoted 8 lines
I realize that, even
netdevice.hitself has other instances. Thus I dont understand why this one generated a compiler error for me. Thus I was wondering why others had not run into this and not suggesting it should be patched.However, changing the way we set up type etc. doesnt seem relevant to what the compiler is flagging.
Clearly the compiler indicates something is wrong in the initializer.
I don't know why you don't want to try the way I suggest or maybe the following:
net/sched/sch_mqprio.c +0 -0
@@ -142,7 +142,7 @@ static int mqprio_init(struct Qdisc *sch, struct
nlattr *opt)
*/
if (qopt->hw) {
struct tc_to_netdev tc = {.type = TC_SETUP_MQPRIO,- .tc = qopt->num_tc};
+ {.tc = qopt->num_tc} };
priv->hw_owned = 1;
err = dev->netdev_ops->ndo_setup_tc(dev, sch->handle, 0, &tc);net/sched/sch_mqprio.c static int mqprio_init(struct Qdisc *sch, struct · line 147
Quoted 10 lines · Cong Wang
net/sched/sch_mqprio.c +1
-1@@ -142,7 +142,7 @@ static int mqprio_init(struct Qdisc *sch, structnlattr *opt) */ if (qopt->hw) {struct tc_to_netdev tc = {.type =TC_SETUP_MQPRIO , - .tc = qopt->num_tc}; + {.tc = qopt->num_tc} };
this fix works.
The first suggestion had no effect (needs changes to a lot of files I suspect).
BTW, I remain surprised that no one else has noticed this. It did not take me any effort to reproduce it on an x86.
--Sowmini
Quoted 14 lines · Sowmini Varadhan
net/sched/sch_mqprio.c static int mqprio_init(struct Qdisc *sch, struct · line 147
Quoted 10 lines · Cong Wang
net/sched/sch_mqprio.c +1
-1@@ -142,7 +142,7 @@ static int mqprio_init(struct Qdisc *sch, structnlattr *opt) */ if (qopt->hw) {struct tc_to_netdev tc = {.type =TC_SETUP_MQPRIO , - .tc = qopt->num_tc}; + {.tc = qopt->num_tc} };this fix works.
Quoted 3 lines
The first suggestion had no effect (needs changes to a lot of files I suspect).
It must work, you just didn't try it hard.
Quoted 2 lines
BTW, I remain surprised that no one else has noticed this. It did not take me any effort to reproduce it on an x86.
I think that is probably because most people use newer gcc, at least I don't see any compile error with gcc 4.9.2.