Commit 7680b8f1 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-dsa-warnings'

Andrew Lunn says:

====================
net: dsa: Fix C=1 W=1 warnings

Mostly not using __be16 when decoding packet contents.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents dbacfd8c 99bac53d
...@@ -77,7 +77,7 @@ struct dsa_slave_priv { ...@@ -77,7 +77,7 @@ struct dsa_slave_priv {
struct sk_buff * (*xmit)(struct sk_buff *skb, struct sk_buff * (*xmit)(struct sk_buff *skb,
struct net_device *dev); struct net_device *dev);
struct pcpu_sw_netstats *stats64; struct pcpu_sw_netstats __percpu *stats64;
struct gro_cells gcells; struct gro_cells gcells;
......
...@@ -156,8 +156,9 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, ...@@ -156,8 +156,9 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
{ {
struct dsa_port *dp = dsa_slave_to_port(dev); struct dsa_port *dp = dsa_slave_to_port(dev);
struct sk_buff *nskb; struct sk_buff *nskb;
u16 *tag; __be16 *tag;
u8 *addr; u8 *addr;
u16 val;
nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN); nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN);
if (!nskb) if (!nskb)
...@@ -167,12 +168,12 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, ...@@ -167,12 +168,12 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
tag = skb_put(nskb, KSZ9477_INGRESS_TAG_LEN); tag = skb_put(nskb, KSZ9477_INGRESS_TAG_LEN);
addr = skb_mac_header(nskb); addr = skb_mac_header(nskb);
*tag = BIT(dp->index); val = BIT(dp->index);
if (is_link_local_ether_addr(addr)) if (is_link_local_ether_addr(addr))
*tag |= KSZ9477_TAIL_TAG_OVERRIDE; val |= KSZ9477_TAIL_TAG_OVERRIDE;
*tag = cpu_to_be16(*tag); *tag = cpu_to_be16(val);
return nskb; return nskb;
} }
......
...@@ -55,7 +55,8 @@ static int lan9303_xmit_use_arl(struct dsa_port *dp, u8 *dest_addr) ...@@ -55,7 +55,8 @@ static int lan9303_xmit_use_arl(struct dsa_port *dp, u8 *dest_addr)
static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct dsa_port *dp = dsa_slave_to_port(dev); struct dsa_port *dp = dsa_slave_to_port(dev);
u16 *lan9303_tag; __be16 *lan9303_tag;
u16 tag;
/* insert a special VLAN tag between the MAC addresses /* insert a special VLAN tag between the MAC addresses
* and the current ethertype field. * and the current ethertype field.
...@@ -72,12 +73,12 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -72,12 +73,12 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
/* make room between MACs and Ether-Type */ /* make room between MACs and Ether-Type */
memmove(skb->data, skb->data + LAN9303_TAG_LEN, 2 * ETH_ALEN); memmove(skb->data, skb->data + LAN9303_TAG_LEN, 2 * ETH_ALEN);
lan9303_tag = (u16 *)(skb->data + 2 * ETH_ALEN); lan9303_tag = (__be16 *)(skb->data + 2 * ETH_ALEN);
lan9303_tag[0] = htons(ETH_P_8021Q); tag = lan9303_xmit_use_arl(dp, skb->data) ?
lan9303_tag[1] = lan9303_xmit_use_arl(dp, skb->data) ?
LAN9303_TAG_TX_USE_ALR : LAN9303_TAG_TX_USE_ALR :
dp->index | LAN9303_TAG_TX_STP_OVERRIDE; dp->index | LAN9303_TAG_TX_STP_OVERRIDE;
lan9303_tag[1] = htons(lan9303_tag[1]); lan9303_tag[0] = htons(ETH_P_8021Q);
lan9303_tag[1] = htons(tag);
return skb; return skb;
} }
...@@ -85,7 +86,7 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -85,7 +86,7 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt) struct packet_type *pt)
{ {
u16 *lan9303_tag; __be16 *lan9303_tag;
u16 lan9303_tag1; u16 lan9303_tag1;
unsigned int source_port; unsigned int source_port;
...@@ -101,7 +102,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -101,7 +102,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
* ^ * ^
* ->data * ->data
*/ */
lan9303_tag = (u16 *)(skb->data - 2); lan9303_tag = (__be16 *)(skb->data - 2);
if (lan9303_tag[0] != htons(ETH_P_8021Q)) { if (lan9303_tag[0] != htons(ETH_P_8021Q)) {
dev_warn_ratelimited(&dev->dev, "Dropping packet due to invalid VLAN marker\n"); dev_warn_ratelimited(&dev->dev, "Dropping packet due to invalid VLAN marker\n");
......
...@@ -67,8 +67,9 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, ...@@ -67,8 +67,9 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt) struct packet_type *pt)
{ {
u16 hdr;
int port; int port;
__be16 *phdr, hdr; __be16 *phdr;
unsigned char *dest = eth_hdr(skb)->h_dest; unsigned char *dest = eth_hdr(skb)->h_dest;
bool is_multicast_skb = is_multicast_ether_addr(dest) && bool is_multicast_skb = is_multicast_ether_addr(dest) &&
!is_broadcast_ether_addr(dest); !is_broadcast_ether_addr(dest);
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct dsa_port *dp = dsa_slave_to_port(dev); struct dsa_port *dp = dsa_slave_to_port(dev);
u16 *phdr, hdr; __be16 *phdr;
u16 hdr;
if (skb_cow_head(skb, QCA_HDR_LEN) < 0) if (skb_cow_head(skb, QCA_HDR_LEN) < 0)
return NULL; return NULL;
...@@ -39,7 +40,7 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -39,7 +40,7 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
skb_push(skb, QCA_HDR_LEN); skb_push(skb, QCA_HDR_LEN);
memmove(skb->data, skb->data + QCA_HDR_LEN, 2 * ETH_ALEN); memmove(skb->data, skb->data + QCA_HDR_LEN, 2 * ETH_ALEN);
phdr = (u16 *)(skb->data + 2 * ETH_ALEN); phdr = (__be16 *)(skb->data + 2 * ETH_ALEN);
/* Set the version field, and set destination port information */ /* Set the version field, and set destination port information */
hdr = QCA_HDR_VERSION << QCA_HDR_XMIT_VERSION_S | hdr = QCA_HDR_VERSION << QCA_HDR_XMIT_VERSION_S |
...@@ -54,8 +55,9 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -54,8 +55,9 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt) struct packet_type *pt)
{ {
u8 ver; u8 ver;
u16 hdr;
int port; int port;
__be16 *phdr, hdr; __be16 *phdr;
if (unlikely(!pskb_may_pull(skb, QCA_HDR_LEN))) if (unlikely(!pskb_may_pull(skb, QCA_HDR_LEN)))
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment