e1000e endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Al Viro 2007-12-11 19:50:34 +00:00 committed by David S. Miller
parent 439104b3a3
commit a39fe742e7
2 changed files with 47 additions and 47 deletions

View file

@ -423,35 +423,35 @@ enum e1000_smart_speed {
/* Receive Descriptor */ /* Receive Descriptor */
struct e1000_rx_desc { struct e1000_rx_desc {
u64 buffer_addr; /* Address of the descriptor's data buffer */ __le64 buffer_addr; /* Address of the descriptor's data buffer */
u16 length; /* Length of data DMAed into data buffer */ __le16 length; /* Length of data DMAed into data buffer */
u16 csum; /* Packet checksum */ __le16 csum; /* Packet checksum */
u8 status; /* Descriptor status */ u8 status; /* Descriptor status */
u8 errors; /* Descriptor Errors */ u8 errors; /* Descriptor Errors */
u16 special; __le16 special;
}; };
/* Receive Descriptor - Extended */ /* Receive Descriptor - Extended */
union e1000_rx_desc_extended { union e1000_rx_desc_extended {
struct { struct {
u64 buffer_addr; __le64 buffer_addr;
u64 reserved; __le64 reserved;
} read; } read;
struct { struct {
struct { struct {
u32 mrq; /* Multiple Rx Queues */ __le32 mrq; /* Multiple Rx Queues */
union { union {
u32 rss; /* RSS Hash */ __le32 rss; /* RSS Hash */
struct { struct {
u16 ip_id; /* IP id */ __le16 ip_id; /* IP id */
u16 csum; /* Packet Checksum */ __le16 csum; /* Packet Checksum */
} csum_ip; } csum_ip;
} hi_dword; } hi_dword;
} lower; } lower;
struct { struct {
u32 status_error; /* ext status/error */ __le32 status_error; /* ext status/error */
u16 length; __le16 length;
u16 vlan; /* VLAN tag */ __le16 vlan; /* VLAN tag */
} upper; } upper;
} wb; /* writeback */ } wb; /* writeback */
}; };
@ -461,49 +461,49 @@ union e1000_rx_desc_extended {
union e1000_rx_desc_packet_split { union e1000_rx_desc_packet_split {
struct { struct {
/* one buffer for protocol header(s), three data buffers */ /* one buffer for protocol header(s), three data buffers */
u64 buffer_addr[MAX_PS_BUFFERS]; __le64 buffer_addr[MAX_PS_BUFFERS];
} read; } read;
struct { struct {
struct { struct {
u32 mrq; /* Multiple Rx Queues */ __le32 mrq; /* Multiple Rx Queues */
union { union {
u32 rss; /* RSS Hash */ __le32 rss; /* RSS Hash */
struct { struct {
u16 ip_id; /* IP id */ __le16 ip_id; /* IP id */
u16 csum; /* Packet Checksum */ __le16 csum; /* Packet Checksum */
} csum_ip; } csum_ip;
} hi_dword; } hi_dword;
} lower; } lower;
struct { struct {
u32 status_error; /* ext status/error */ __le32 status_error; /* ext status/error */
u16 length0; /* length of buffer 0 */ __le16 length0; /* length of buffer 0 */
u16 vlan; /* VLAN tag */ __le16 vlan; /* VLAN tag */
} middle; } middle;
struct { struct {
u16 header_status; __le16 header_status;
u16 length[3]; /* length of buffers 1-3 */ __le16 length[3]; /* length of buffers 1-3 */
} upper; } upper;
u64 reserved; __le64 reserved;
} wb; /* writeback */ } wb; /* writeback */
}; };
/* Transmit Descriptor */ /* Transmit Descriptor */
struct e1000_tx_desc { struct e1000_tx_desc {
u64 buffer_addr; /* Address of the descriptor's data buffer */ __le64 buffer_addr; /* Address of the descriptor's data buffer */
union { union {
u32 data; __le32 data;
struct { struct {
u16 length; /* Data buffer length */ __le16 length; /* Data buffer length */
u8 cso; /* Checksum offset */ u8 cso; /* Checksum offset */
u8 cmd; /* Descriptor control */ u8 cmd; /* Descriptor control */
} flags; } flags;
} lower; } lower;
union { union {
u32 data; __le32 data;
struct { struct {
u8 status; /* Descriptor status */ u8 status; /* Descriptor status */
u8 css; /* Checksum start */ u8 css; /* Checksum start */
u16 special; __le16 special;
} fields; } fields;
} upper; } upper;
}; };
@ -511,49 +511,49 @@ struct e1000_tx_desc {
/* Offload Context Descriptor */ /* Offload Context Descriptor */
struct e1000_context_desc { struct e1000_context_desc {
union { union {
u32 ip_config; __le32 ip_config;
struct { struct {
u8 ipcss; /* IP checksum start */ u8 ipcss; /* IP checksum start */
u8 ipcso; /* IP checksum offset */ u8 ipcso; /* IP checksum offset */
u16 ipcse; /* IP checksum end */ __le16 ipcse; /* IP checksum end */
} ip_fields; } ip_fields;
} lower_setup; } lower_setup;
union { union {
u32 tcp_config; __le32 tcp_config;
struct { struct {
u8 tucss; /* TCP checksum start */ u8 tucss; /* TCP checksum start */
u8 tucso; /* TCP checksum offset */ u8 tucso; /* TCP checksum offset */
u16 tucse; /* TCP checksum end */ __le16 tucse; /* TCP checksum end */
} tcp_fields; } tcp_fields;
} upper_setup; } upper_setup;
u32 cmd_and_length; __le32 cmd_and_length;
union { union {
u32 data; __le32 data;
struct { struct {
u8 status; /* Descriptor status */ u8 status; /* Descriptor status */
u8 hdr_len; /* Header length */ u8 hdr_len; /* Header length */
u16 mss; /* Maximum segment size */ __le16 mss; /* Maximum segment size */
} fields; } fields;
} tcp_seg_setup; } tcp_seg_setup;
}; };
/* Offload data descriptor */ /* Offload data descriptor */
struct e1000_data_desc { struct e1000_data_desc {
u64 buffer_addr; /* Address of the descriptor's buffer address */ __le64 buffer_addr; /* Address of the descriptor's buffer address */
union { union {
u32 data; __le32 data;
struct { struct {
u16 length; /* Data buffer length */ __le16 length; /* Data buffer length */
u8 typ_len_ext; u8 typ_len_ext;
u8 cmd; u8 cmd;
} flags; } flags;
} lower; } lower;
union { union {
u32 data; __le32 data;
struct { struct {
u8 status; /* Descriptor status */ u8 status; /* Descriptor status */
u8 popts; /* Packet Options */ u8 popts; /* Packet Options */
u16 special; /* */ __le16 special; /* */
} fields; } fields;
} upper; } upper;
}; };

View file

@ -91,7 +91,7 @@ static int e1000_desc_unused(struct e1000_ring *ring)
static void e1000_receive_skb(struct e1000_adapter *adapter, static void e1000_receive_skb(struct e1000_adapter *adapter,
struct net_device *netdev, struct net_device *netdev,
struct sk_buff *skb, struct sk_buff *skb,
u8 status, u16 vlan) u8 status, __le16 vlan)
{ {
skb->protocol = eth_type_trans(skb, netdev); skb->protocol = eth_type_trans(skb, netdev);
@ -142,8 +142,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
/* Hardware complements the payload checksum, so we undo it /* Hardware complements the payload checksum, so we undo it
* and then put the value in host order for further stack use. * and then put the value in host order for further stack use.
*/ */
csum = ntohl(csum ^ 0xFFFF); __sum16 sum = (__force __sum16)htons(csum);
skb->csum = csum; skb->csum = csum_unfold(~sum);
skb->ip_summed = CHECKSUM_COMPLETE; skb->ip_summed = CHECKSUM_COMPLETE;
} }
adapter->hw_csum_good++; adapter->hw_csum_good++;
@ -248,7 +248,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
ps_page = &buffer_info->ps_pages[j]; ps_page = &buffer_info->ps_pages[j];
if (j >= adapter->rx_ps_pages) { if (j >= adapter->rx_ps_pages) {
/* all unused desc entries get hw null ptr */ /* all unused desc entries get hw null ptr */
rx_desc->read.buffer_addr[j+1] = ~0; rx_desc->read.buffer_addr[j+1] = ~cpu_to_le64(0);
continue; continue;
} }
if (!ps_page->page) { if (!ps_page->page) {
@ -941,7 +941,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
static int e1000_request_irq(struct e1000_adapter *adapter) static int e1000_request_irq(struct e1000_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
void (*handler) = &e1000_intr; irq_handler_t handler = e1000_intr;
int irq_flags = IRQF_SHARED; int irq_flags = IRQF_SHARED;
int err; int err;
@ -951,7 +951,7 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
"Unable to allocate MSI interrupt Error: %d\n", err); "Unable to allocate MSI interrupt Error: %d\n", err);
} else { } else {
adapter->flags |= FLAG_MSI_ENABLED; adapter->flags |= FLAG_MSI_ENABLED;
handler = &e1000_intr_msi; handler = e1000_intr_msi;
irq_flags = 0; irq_flags = 0;
} }