Commit 31c221c4 authored by Harvey Harrison's avatar Harvey Harrison Committed by David S. Miller

net: jme.c rxdesc.flags is __le16, other missing endian swaps

This is the minimal patch to fix endian mismatches.  These are
probably bugs on big-endian arches, noops on little endian.

jme_rxsum_ok could be improved to directly take a __le16 and
change all of the masks/sets to be in little-endian, but
has not been done here to keep the patch small.
Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d6ada9f
...@@ -912,23 +912,23 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx) ...@@ -912,23 +912,23 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
skb_put(skb, framesize); skb_put(skb, framesize);
skb->protocol = eth_type_trans(skb, jme->dev); skb->protocol = eth_type_trans(skb, jme->dev);
if (jme_rxsum_ok(jme, rxdesc->descwb.flags)) if (jme_rxsum_ok(jme, le16_to_cpu(rxdesc->descwb.flags)))
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
else else
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
if (rxdesc->descwb.flags & RXWBFLAG_TAGON) { if (rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_TAGON)) {
if (jme->vlgrp) { if (jme->vlgrp) {
jme->jme_vlan_rx(skb, jme->vlgrp, jme->jme_vlan_rx(skb, jme->vlgrp,
le32_to_cpu(rxdesc->descwb.vlan)); le16_to_cpu(rxdesc->descwb.vlan));
NET_STAT(jme).rx_bytes += 4; NET_STAT(jme).rx_bytes += 4;
} }
} else { } else {
jme->jme_rx(skb); jme->jme_rx(skb);
} }
if ((le16_to_cpu(rxdesc->descwb.flags) & RXWBFLAG_DEST) == if ((rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_DEST)) ==
RXWBFLAG_DEST_MUL) cpu_to_le16(RXWBFLAG_DEST_MUL))
++(NET_STAT(jme).multicast); ++(NET_STAT(jme).multicast);
jme->dev->last_rx = jiffies; jme->dev->last_rx = jiffies;
...@@ -961,7 +961,7 @@ jme_process_receive(struct jme_adapter *jme, int limit) ...@@ -961,7 +961,7 @@ jme_process_receive(struct jme_adapter *jme, int limit)
rxdesc = rxring->desc; rxdesc = rxring->desc;
rxdesc += i; rxdesc += i;
if ((rxdesc->descwb.flags & RXWBFLAG_OWN) || if ((rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) ||
!(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL)) !(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL))
goto out; goto out;
...@@ -1763,10 +1763,9 @@ jme_expand_header(struct jme_adapter *jme, struct sk_buff *skb) ...@@ -1763,10 +1763,9 @@ jme_expand_header(struct jme_adapter *jme, struct sk_buff *skb)
} }
static int static int
jme_tx_tso(struct sk_buff *skb, jme_tx_tso(struct sk_buff *skb, __le16 *mss, u8 *flags)
u16 *mss, u8 *flags)
{ {
*mss = skb_shinfo(skb)->gso_size << TXDESC_MSS_SHIFT; *mss = cpu_to_le16(skb_shinfo(skb)->gso_size << TXDESC_MSS_SHIFT);
if (*mss) { if (*mss) {
*flags |= TXFLAG_LSEN; *flags |= TXFLAG_LSEN;
...@@ -1826,11 +1825,11 @@ jme_tx_csum(struct jme_adapter *jme, struct sk_buff *skb, u8 *flags) ...@@ -1826,11 +1825,11 @@ jme_tx_csum(struct jme_adapter *jme, struct sk_buff *skb, u8 *flags)
} }
static inline void static inline void
jme_tx_vlan(struct sk_buff *skb, u16 *vlan, u8 *flags) jme_tx_vlan(struct sk_buff *skb, __le16 *vlan, u8 *flags)
{ {
if (vlan_tx_tag_present(skb)) { if (vlan_tx_tag_present(skb)) {
*flags |= TXFLAG_TAGON; *flags |= TXFLAG_TAGON;
*vlan = vlan_tx_tag_get(skb); *vlan = cpu_to_le16(vlan_tx_tag_get(skb));
} }
} }
......
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