Re: [PATCH net-next v3 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

From: kbuild test robot
Date: Sun Apr 02 2017 - 21:18:08 EST


Hi Sean,

[auto build test ERROR on net-next/master]

url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/net-next-dsa-add-Mediatek-MT7530-support/20170330-135532
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

In file included from net/dsa/tag_mtk.c:16:0:
net/dsa/dsa_priv.h:50:30: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
^~~~~~~~~~
net/dsa/dsa_priv.h:54:39: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
^~~~~~~~~~
net/dsa/dsa_priv.h:55:42: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
^~~~~~~~~~
net/dsa/dsa_priv.h:59:36: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
void dsa_slave_mii_bus_init(struct dsa_switch *ds);
^~~~~~~~~~
net/dsa/dsa_priv.h:61:29: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
^~~~~~~~~~
net/dsa/dsa_priv.h:70:41: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
int dsa_switch_register_notifier(struct dsa_switch *ds);
^~~~~~~~~~
net/dsa/dsa_priv.h:71:44: warning: 'struct dsa_switch' declared inside parameter list will not be visible outside of this definition or declaration
void dsa_switch_unregister_notifier(struct dsa_switch *ds);
^~~~~~~~~~
net/dsa/tag_mtk.c: In function 'mtk_tag_xmit':
>> net/dsa/tag_mtk.c:38:26: error: dereferencing pointer to incomplete type 'struct dsa_port'
mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
^~
net/dsa/tag_mtk.c: In function 'mtk_tag_rcv':
>> net/dsa/tag_mtk.c:85:10: error: dereferencing pointer to incomplete type 'struct dsa_switch_tree'
ds = dst->ds[0];
^~
>> net/dsa/tag_mtk.c:91:9: error: dereferencing pointer to incomplete type 'struct dsa_switch'
if (!ds->ports[port].netdev)
^~

vim +91 net/dsa/tag_mtk.c

2faad9d7 Sean Wang 2017-03-29 32
2faad9d7 Sean Wang 2017-03-29 33 memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
2faad9d7 Sean Wang 2017-03-29 34
2faad9d7 Sean Wang 2017-03-29 35 /* Build the tag after the MAC Source Address */
2faad9d7 Sean Wang 2017-03-29 36 mtk_tag = skb->data + 2 * ETH_ALEN;
2faad9d7 Sean Wang 2017-03-29 37 mtk_tag[0] = 0;
2faad9d7 Sean Wang 2017-03-29 @38 mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
2faad9d7 Sean Wang 2017-03-29 39 mtk_tag[2] = 0;
2faad9d7 Sean Wang 2017-03-29 40 mtk_tag[3] = 0;
2faad9d7 Sean Wang 2017-03-29 41
2faad9d7 Sean Wang 2017-03-29 42 return skb;
2faad9d7 Sean Wang 2017-03-29 43
2faad9d7 Sean Wang 2017-03-29 44 out_free:
2faad9d7 Sean Wang 2017-03-29 45 kfree_skb(skb);
2faad9d7 Sean Wang 2017-03-29 46 return NULL;
2faad9d7 Sean Wang 2017-03-29 47 }
2faad9d7 Sean Wang 2017-03-29 48
2faad9d7 Sean Wang 2017-03-29 49 static int mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
2faad9d7 Sean Wang 2017-03-29 50 struct packet_type *pt, struct net_device *orig_dev)
2faad9d7 Sean Wang 2017-03-29 51 {
2faad9d7 Sean Wang 2017-03-29 52 struct dsa_switch_tree *dst = dev->dsa_ptr;
2faad9d7 Sean Wang 2017-03-29 53 struct dsa_switch *ds;
2faad9d7 Sean Wang 2017-03-29 54 int port;
2faad9d7 Sean Wang 2017-03-29 55 __be16 *phdr, hdr;
2faad9d7 Sean Wang 2017-03-29 56
2faad9d7 Sean Wang 2017-03-29 57 if (unlikely(!dst))
2faad9d7 Sean Wang 2017-03-29 58 goto out_drop;
2faad9d7 Sean Wang 2017-03-29 59
2faad9d7 Sean Wang 2017-03-29 60 skb = skb_unshare(skb, GFP_ATOMIC);
2faad9d7 Sean Wang 2017-03-29 61 if (!skb)
2faad9d7 Sean Wang 2017-03-29 62 goto out;
2faad9d7 Sean Wang 2017-03-29 63
2faad9d7 Sean Wang 2017-03-29 64 if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
2faad9d7 Sean Wang 2017-03-29 65 goto out_drop;
2faad9d7 Sean Wang 2017-03-29 66
2faad9d7 Sean Wang 2017-03-29 67 /* The MTK header is added by the switch between src addr
2faad9d7 Sean Wang 2017-03-29 68 * and ethertype at this point, skb->data points to 2 bytes
2faad9d7 Sean Wang 2017-03-29 69 * after src addr so header should be 2 bytes right before.
2faad9d7 Sean Wang 2017-03-29 70 */
2faad9d7 Sean Wang 2017-03-29 71 phdr = (__be16 *)(skb->data - 2);
2faad9d7 Sean Wang 2017-03-29 72 hdr = ntohs(*phdr);
2faad9d7 Sean Wang 2017-03-29 73
2faad9d7 Sean Wang 2017-03-29 74 /* Remove MTK tag and recalculate checksum. */
2faad9d7 Sean Wang 2017-03-29 75 skb_pull_rcsum(skb, MTK_HDR_LEN);
2faad9d7 Sean Wang 2017-03-29 76
2faad9d7 Sean Wang 2017-03-29 77 memmove(skb->data - ETH_HLEN,
2faad9d7 Sean Wang 2017-03-29 78 skb->data - ETH_HLEN - MTK_HDR_LEN,
2faad9d7 Sean Wang 2017-03-29 79 2 * ETH_ALEN);
2faad9d7 Sean Wang 2017-03-29 80
2faad9d7 Sean Wang 2017-03-29 81 /* This protocol doesn't support cascading multiple
2faad9d7 Sean Wang 2017-03-29 82 * switches so it's safe to assume the switch is first
2faad9d7 Sean Wang 2017-03-29 83 * in the tree.
2faad9d7 Sean Wang 2017-03-29 84 */
2faad9d7 Sean Wang 2017-03-29 @85 ds = dst->ds[0];
2faad9d7 Sean Wang 2017-03-29 86 if (!ds)
2faad9d7 Sean Wang 2017-03-29 87 goto out_drop;
2faad9d7 Sean Wang 2017-03-29 88
2faad9d7 Sean Wang 2017-03-29 89 /* Get source port information */
2faad9d7 Sean Wang 2017-03-29 90 port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);
2faad9d7 Sean Wang 2017-03-29 @91 if (!ds->ports[port].netdev)
2faad9d7 Sean Wang 2017-03-29 92 goto out_drop;
2faad9d7 Sean Wang 2017-03-29 93
2faad9d7 Sean Wang 2017-03-29 94 /* Update skb & forward the frame accordingly */

:::::: The code at line 91 was first introduced by commit
:::::: 2faad9d71e4c0544e3cf43b24439517c95df301f net-next: dsa: add Mediatek tag RX/TX handler

:::::: TO: Sean Wang <sean.wang@xxxxxxxxxxxx>
:::::: CC: 0day robot <fengguang.wu@xxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip