gianfar: Make FCB access endian safe
Use conversion macros to correctly access the BE fields of the Rx and Tx Frame Control Block on LE CPUs. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a7312d5803
commit
26eb9374f8
|
@ -2169,16 +2169,16 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb,
|
||||||
*/
|
*/
|
||||||
if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
|
if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
|
||||||
flags |= TXFCB_UDP;
|
flags |= TXFCB_UDP;
|
||||||
fcb->phcs = udp_hdr(skb)->check;
|
fcb->phcs = (__force __be16)(udp_hdr(skb)->check);
|
||||||
} else
|
} else
|
||||||
fcb->phcs = tcp_hdr(skb)->check;
|
fcb->phcs = (__force __be16)(tcp_hdr(skb)->check);
|
||||||
|
|
||||||
/* l3os is the distance between the start of the
|
/* l3os is the distance between the start of the
|
||||||
* frame (skb->data) and the start of the IP hdr.
|
* frame (skb->data) and the start of the IP hdr.
|
||||||
* l4os is the distance between the start of the
|
* l4os is the distance between the start of the
|
||||||
* l3 hdr and the l4 hdr
|
* l3 hdr and the l4 hdr
|
||||||
*/
|
*/
|
||||||
fcb->l3os = (u16)(skb_network_offset(skb) - fcb_length);
|
fcb->l3os = (u8)(skb_network_offset(skb) - fcb_length);
|
||||||
fcb->l4os = skb_network_header_len(skb);
|
fcb->l4os = skb_network_header_len(skb);
|
||||||
|
|
||||||
fcb->flags = flags;
|
fcb->flags = flags;
|
||||||
|
@ -2187,7 +2187,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb,
|
||||||
void inline gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)
|
void inline gfar_tx_vlan(struct sk_buff *skb, struct txfcb *fcb)
|
||||||
{
|
{
|
||||||
fcb->flags |= TXFCB_VLN;
|
fcb->flags |= TXFCB_VLN;
|
||||||
fcb->vlctl = skb_vlan_tag_get(skb);
|
fcb->vlctl = cpu_to_be16(skb_vlan_tag_get(skb));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct txbd8 *skip_txbd(struct txbd8 *bdp, int stride,
|
static inline struct txbd8 *skip_txbd(struct txbd8 *bdp, int stride,
|
||||||
|
@ -2812,13 +2812,13 @@ static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb)
|
||||||
* were verified, then we tell the kernel that no
|
* were verified, then we tell the kernel that no
|
||||||
* checksumming is necessary. Otherwise, it is [FIXME]
|
* checksumming is necessary. Otherwise, it is [FIXME]
|
||||||
*/
|
*/
|
||||||
if ((fcb->flags & RXFCB_CSUM_MASK) == (RXFCB_CIP | RXFCB_CTU))
|
if ((be16_to_cpu(fcb->flags) & RXFCB_CSUM_MASK) ==
|
||||||
|
(RXFCB_CIP | RXFCB_CTU))
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
else
|
else
|
||||||
skb_checksum_none_assert(skb);
|
skb_checksum_none_assert(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* gfar_process_frame() -- handle one incoming packet if skb isn't NULL. */
|
/* gfar_process_frame() -- handle one incoming packet if skb isn't NULL. */
|
||||||
static void gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
|
static void gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
|
||||||
int amount_pull, struct napi_struct *napi)
|
int amount_pull, struct napi_struct *napi)
|
||||||
|
@ -2860,8 +2860,9 @@ static void gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
|
||||||
* RXFCB_VLN is pseudo randomly set.
|
* RXFCB_VLN is pseudo randomly set.
|
||||||
*/
|
*/
|
||||||
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX &&
|
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX &&
|
||||||
fcb->flags & RXFCB_VLN)
|
be16_to_cpu(fcb->flags) & RXFCB_VLN)
|
||||||
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), fcb->vlctl);
|
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
|
||||||
|
be16_to_cpu(fcb->vlctl));
|
||||||
|
|
||||||
/* Send the packet up the stack */
|
/* Send the packet up the stack */
|
||||||
napi_gro_receive(napi, skb);
|
napi_gro_receive(napi, skb);
|
||||||
|
|
|
@ -557,8 +557,8 @@ struct txfcb {
|
||||||
u8 ptp; /* Flag to enable tx timestamping */
|
u8 ptp; /* Flag to enable tx timestamping */
|
||||||
u8 l4os; /* Level 4 Header Offset */
|
u8 l4os; /* Level 4 Header Offset */
|
||||||
u8 l3os; /* Level 3 Header Offset */
|
u8 l3os; /* Level 3 Header Offset */
|
||||||
u16 phcs; /* Pseudo-header Checksum */
|
__be16 phcs; /* Pseudo-header Checksum */
|
||||||
u16 vlctl; /* VLAN control word */
|
__be16 vlctl; /* VLAN control word */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rxbd8
|
struct rxbd8
|
||||||
|
@ -574,11 +574,11 @@ struct rxbd8
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rxfcb {
|
struct rxfcb {
|
||||||
u16 flags;
|
__be16 flags;
|
||||||
u8 rq; /* Receive Queue index */
|
u8 rq; /* Receive Queue index */
|
||||||
u8 pro; /* Layer 4 Protocol */
|
u8 pro; /* Layer 4 Protocol */
|
||||||
u16 reserved;
|
u16 reserved;
|
||||||
u16 vlctl; /* VLAN control word */
|
__be16 vlctl; /* VLAN control word */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gianfar_skb_cb {
|
struct gianfar_skb_cb {
|
||||||
|
|
Loading…
Reference in New Issue