提交 40f6cff5 编写于 作者: A Al Viro

[PATCH] myri10ge annotations

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 bffa2154
...@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual BSD/GPL"); ...@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual BSD/GPL");
#define MYRI10GE_EEPROM_STRINGS_SIZE 256 #define MYRI10GE_EEPROM_STRINGS_SIZE 256
#define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2) #define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2)
#define MYRI10GE_NO_CONFIRM_DATA 0xffffffff #define MYRI10GE_NO_CONFIRM_DATA htonl(0xffffffff)
#define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff #define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff
struct myri10ge_rx_buffer_state { struct myri10ge_rx_buffer_state {
...@@ -156,8 +156,8 @@ struct myri10ge_priv { ...@@ -156,8 +156,8 @@ struct myri10ge_priv {
int sram_size; int sram_size;
unsigned long board_span; unsigned long board_span;
unsigned long iomem_base; unsigned long iomem_base;
u32 __iomem *irq_claim; __be32 __iomem *irq_claim;
u32 __iomem *irq_deassert; __be32 __iomem *irq_deassert;
char *mac_addr_string; char *mac_addr_string;
struct mcp_cmd_response *cmd; struct mcp_cmd_response *cmd;
dma_addr_t cmd_bus; dma_addr_t cmd_bus;
...@@ -165,10 +165,10 @@ struct myri10ge_priv { ...@@ -165,10 +165,10 @@ struct myri10ge_priv {
dma_addr_t fw_stats_bus; dma_addr_t fw_stats_bus;
struct pci_dev *pdev; struct pci_dev *pdev;
int msi_enabled; int msi_enabled;
unsigned int link_state; __be32 link_state;
unsigned int rdma_tags_available; unsigned int rdma_tags_available;
int intr_coal_delay; int intr_coal_delay;
u32 __iomem *intr_coal_delay_ptr; __be32 __iomem *intr_coal_delay_ptr;
int mtrr; int mtrr;
int wake_queue; int wake_queue;
int stop_queue; int stop_queue;
...@@ -273,6 +273,11 @@ MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)"); ...@@ -273,6 +273,11 @@ MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)");
#define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) #define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8)
static inline void put_be32(__be32 val, __be32 __iomem *p)
{
__raw_writel((__force __u32)val, (__force void __iomem *)p);
}
static int static int
myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
struct myri10ge_cmd *data, int atomic) struct myri10ge_cmd *data, int atomic)
...@@ -296,7 +301,7 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, ...@@ -296,7 +301,7 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
buf->response_addr.low = htonl(dma_low); buf->response_addr.low = htonl(dma_low);
buf->response_addr.high = htonl(dma_high); buf->response_addr.high = htonl(dma_high);
response->result = MYRI10GE_NO_RESPONSE_RESULT; response->result = htonl(MYRI10GE_NO_RESPONSE_RESULT);
mb(); mb();
myri10ge_pio_copy(cmd_addr, buf, sizeof(*buf)); myri10ge_pio_copy(cmd_addr, buf, sizeof(*buf));
...@@ -311,14 +316,14 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, ...@@ -311,14 +316,14 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
* (1ms will be enough for those commands) */ * (1ms will be enough for those commands) */
for (sleep_total = 0; for (sleep_total = 0;
sleep_total < 1000 sleep_total < 1000
&& response->result == MYRI10GE_NO_RESPONSE_RESULT; && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
sleep_total += 10) sleep_total += 10)
udelay(10); udelay(10);
} else { } else {
/* use msleep for most command */ /* use msleep for most command */
for (sleep_total = 0; for (sleep_total = 0;
sleep_total < 15 sleep_total < 15
&& response->result == MYRI10GE_NO_RESPONSE_RESULT; && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
sleep_total++) sleep_total++)
msleep(1); msleep(1);
} }
...@@ -393,7 +398,7 @@ static int myri10ge_read_mac_addr(struct myri10ge_priv *mgp) ...@@ -393,7 +398,7 @@ static int myri10ge_read_mac_addr(struct myri10ge_priv *mgp)
static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
{ {
char __iomem *submit; char __iomem *submit;
u32 buf[16]; __be32 buf[16];
u32 dma_low, dma_high; u32 dma_low, dma_high;
int i; int i;
...@@ -410,7 +415,7 @@ static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) ...@@ -410,7 +415,7 @@ static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
buf[0] = htonl(dma_high); /* confirm addr MSW */ buf[0] = htonl(dma_high); /* confirm addr MSW */
buf[1] = htonl(dma_low); /* confirm addr LSW */ buf[1] = htonl(dma_low); /* confirm addr LSW */
buf[2] = htonl(MYRI10GE_NO_CONFIRM_DATA); /* confirm data */ buf[2] = MYRI10GE_NO_CONFIRM_DATA; /* confirm data */
buf[3] = htonl(dma_high); /* dummy addr MSW */ buf[3] = htonl(dma_high); /* dummy addr MSW */
buf[4] = htonl(dma_low); /* dummy addr LSW */ buf[4] = htonl(dma_low); /* dummy addr LSW */
buf[5] = htonl(enable); /* enable? */ buf[5] = htonl(enable); /* enable? */
...@@ -479,7 +484,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size) ...@@ -479,7 +484,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
} }
/* check id */ /* check id */
hdr_offset = ntohl(*(u32 *) (fw->data + MCP_HEADER_PTR_OFFSET)); hdr_offset = ntohl(*(__be32 *) (fw->data + MCP_HEADER_PTR_OFFSET));
if ((hdr_offset & 3) || hdr_offset + sizeof(*hdr) > fw->size) { if ((hdr_offset & 3) || hdr_offset + sizeof(*hdr) > fw->size) {
dev_err(dev, "Bad firmware file\n"); dev_err(dev, "Bad firmware file\n");
status = -EINVAL; status = -EINVAL;
...@@ -550,7 +555,7 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp) ...@@ -550,7 +555,7 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp)
static int myri10ge_load_firmware(struct myri10ge_priv *mgp) static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
{ {
char __iomem *submit; char __iomem *submit;
u32 buf[16]; __be32 buf[16];
u32 dma_low, dma_high, size; u32 dma_low, dma_high, size;
int status, i; int status, i;
...@@ -600,7 +605,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp) ...@@ -600,7 +605,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
buf[0] = htonl(dma_high); /* confirm addr MSW */ buf[0] = htonl(dma_high); /* confirm addr MSW */
buf[1] = htonl(dma_low); /* confirm addr LSW */ buf[1] = htonl(dma_low); /* confirm addr LSW */
buf[2] = htonl(MYRI10GE_NO_CONFIRM_DATA); /* confirm data */ buf[2] = MYRI10GE_NO_CONFIRM_DATA; /* confirm data */
/* FIX: All newest firmware should un-protect the bottom of /* FIX: All newest firmware should un-protect the bottom of
* the sram before handoff. However, the very first interfaces * the sram before handoff. However, the very first interfaces
...@@ -705,21 +710,21 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) ...@@ -705,21 +710,21 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
status |= status |=
myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0); myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0);
mgp->irq_claim = (__iomem u32 *) (mgp->sram + cmd.data0); mgp->irq_claim = (__iomem __be32 *) (mgp->sram + cmd.data0);
if (!mgp->msi_enabled) { if (!mgp->msi_enabled) {
status |= myri10ge_send_cmd status |= myri10ge_send_cmd
(mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, &cmd, 0); (mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, &cmd, 0);
mgp->irq_deassert = (__iomem u32 *) (mgp->sram + cmd.data0); mgp->irq_deassert = (__iomem __be32 *) (mgp->sram + cmd.data0);
} }
status |= myri10ge_send_cmd status |= myri10ge_send_cmd
(mgp, MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, &cmd, 0); (mgp, MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, &cmd, 0);
mgp->intr_coal_delay_ptr = (__iomem u32 *) (mgp->sram + cmd.data0); mgp->intr_coal_delay_ptr = (__iomem __be32 *) (mgp->sram + cmd.data0);
if (status != 0) { if (status != 0) {
dev_err(&mgp->pdev->dev, "failed set interrupt parameters\n"); dev_err(&mgp->pdev->dev, "failed set interrupt parameters\n");
return status; return status;
} }
__raw_writel(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr);
/* Run a small DMA test. /* Run a small DMA test.
* The magic multipliers to the length tell the firmware * The magic multipliers to the length tell the firmware
...@@ -786,14 +791,14 @@ static inline void ...@@ -786,14 +791,14 @@ static inline void
myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst,
struct mcp_kreq_ether_recv *src) struct mcp_kreq_ether_recv *src)
{ {
u32 low; __be32 low;
low = src->addr_low; low = src->addr_low;
src->addr_low = DMA_32BIT_MASK; src->addr_low = htonl(DMA_32BIT_MASK);
myri10ge_pio_copy(dst, src, 8 * sizeof(*src)); myri10ge_pio_copy(dst, src, 8 * sizeof(*src));
mb(); mb();
src->addr_low = low; src->addr_low = low;
__raw_writel(low, &dst->addr_low); put_be32(low, &dst->addr_low);
mb(); mb();
} }
...@@ -939,11 +944,11 @@ myri10ge_getbuf(struct myri10ge_rx_buf *rx, struct myri10ge_priv *mgp, ...@@ -939,11 +944,11 @@ myri10ge_getbuf(struct myri10ge_rx_buf *rx, struct myri10ge_priv *mgp,
return retval; return retval;
} }
static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum) static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, __wsum hw_csum)
{ {
struct vlan_hdr *vh = (struct vlan_hdr *)(skb->data); struct vlan_hdr *vh = (struct vlan_hdr *)(skb->data);
if ((skb->protocol == ntohs(ETH_P_8021Q)) && if ((skb->protocol == htons(ETH_P_8021Q)) &&
(vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) || (vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) ||
vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) { vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) {
skb->csum = hw_csum; skb->csum = hw_csum;
...@@ -953,7 +958,7 @@ static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum) ...@@ -953,7 +958,7 @@ static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum)
static inline unsigned long static inline unsigned long
myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
int bytes, int len, int csum) int bytes, int len, __wsum csum)
{ {
dma_addr_t bus; dma_addr_t bus;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -986,12 +991,12 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, ...@@ -986,12 +991,12 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
skb->protocol = eth_type_trans(skb, mgp->dev); skb->protocol = eth_type_trans(skb, mgp->dev);
if (mgp->csum_flag) { if (mgp->csum_flag) {
if ((skb->protocol == ntohs(ETH_P_IP)) || if ((skb->protocol == htons(ETH_P_IP)) ||
(skb->protocol == ntohs(ETH_P_IPV6))) { (skb->protocol == htons(ETH_P_IPV6))) {
skb->csum = ntohs((u16) csum); skb->csum = csum;
skb->ip_summed = CHECKSUM_COMPLETE; skb->ip_summed = CHECKSUM_COMPLETE;
} else } else
myri10ge_vlan_ip_csum(skb, ntohs((u16) csum)); myri10ge_vlan_ip_csum(skb, csum);
} }
netif_receive_skb(skb); netif_receive_skb(skb);
...@@ -1060,12 +1065,12 @@ static inline void myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int *limit) ...@@ -1060,12 +1065,12 @@ static inline void myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int *limit)
int idx = rx_done->idx; int idx = rx_done->idx;
int cnt = rx_done->cnt; int cnt = rx_done->cnt;
u16 length; u16 length;
u16 checksum; __wsum checksum;
while (rx_done->entry[idx].length != 0 && *limit != 0) { while (rx_done->entry[idx].length != 0 && *limit != 0) {
length = ntohs(rx_done->entry[idx].length); length = ntohs(rx_done->entry[idx].length);
rx_done->entry[idx].length = 0; rx_done->entry[idx].length = 0;
checksum = ntohs(rx_done->entry[idx].checksum); checksum = csum_unfold(rx_done->entry[idx].checksum);
if (length <= mgp->small_bytes) if (length <= mgp->small_bytes)
rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small, rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small,
mgp->small_bytes, mgp->small_bytes,
...@@ -1142,7 +1147,7 @@ static int myri10ge_poll(struct net_device *netdev, int *budget) ...@@ -1142,7 +1147,7 @@ static int myri10ge_poll(struct net_device *netdev, int *budget)
if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) {
netif_rx_complete(netdev); netif_rx_complete(netdev);
__raw_writel(htonl(3), mgp->irq_claim); put_be32(htonl(3), mgp->irq_claim);
return 0; return 0;
} }
return 1; return 1;
...@@ -1166,7 +1171,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg) ...@@ -1166,7 +1171,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
netif_rx_schedule(mgp->dev); netif_rx_schedule(mgp->dev);
if (!mgp->msi_enabled) { if (!mgp->msi_enabled) {
__raw_writel(0, mgp->irq_deassert); put_be32(0, mgp->irq_deassert);
if (!myri10ge_deassert_wait) if (!myri10ge_deassert_wait)
stats->valid = 0; stats->valid = 0;
mb(); mb();
...@@ -1195,7 +1200,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg) ...@@ -1195,7 +1200,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
myri10ge_check_statblock(mgp); myri10ge_check_statblock(mgp);
__raw_writel(htonl(3), mgp->irq_claim + 1); put_be32(htonl(3), mgp->irq_claim + 1);
return (IRQ_HANDLED); return (IRQ_HANDLED);
} }
...@@ -1233,7 +1238,7 @@ myri10ge_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal) ...@@ -1233,7 +1238,7 @@ myri10ge_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal)
struct myri10ge_priv *mgp = netdev_priv(netdev); struct myri10ge_priv *mgp = netdev_priv(netdev);
mgp->intr_coal_delay = coal->rx_coalesce_usecs; mgp->intr_coal_delay = coal->rx_coalesce_usecs;
__raw_writel(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr);
return 0; return 0;
} }
...@@ -1748,7 +1753,7 @@ static int myri10ge_open(struct net_device *dev) ...@@ -1748,7 +1753,7 @@ static int myri10ge_open(struct net_device *dev)
goto abort_with_rings; goto abort_with_rings;
} }
mgp->link_state = -1; mgp->link_state = htonl(~0U);
mgp->rdma_tags_available = 15; mgp->rdma_tags_available = 15;
netif_poll_enable(mgp->dev); /* must happen prior to any irq */ netif_poll_enable(mgp->dev); /* must happen prior to any irq */
...@@ -1876,7 +1881,7 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src, ...@@ -1876,7 +1881,7 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src,
/* re-write the last 32-bits with the valid flags */ /* re-write the last 32-bits with the valid flags */
src->flags = last_flags; src->flags = last_flags;
__raw_writel(*((u32 *) src + 3), (u32 __iomem *) dst + 3); put_be32(*((__be32 *) src + 3), (__be32 __iomem *) dst + 3);
tx->req += cnt; tx->req += cnt;
mb(); mb();
} }
...@@ -1919,7 +1924,8 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1919,7 +1924,8 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
struct myri10ge_tx_buf *tx = &mgp->tx; struct myri10ge_tx_buf *tx = &mgp->tx;
struct skb_frag_struct *frag; struct skb_frag_struct *frag;
dma_addr_t bus; dma_addr_t bus;
u32 low, high_swapped; u32 low;
__be32 high_swapped;
unsigned int len; unsigned int len;
int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments; int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments;
u16 pseudo_hdr_offset, cksum_offset; u16 pseudo_hdr_offset, cksum_offset;
...@@ -1964,7 +1970,6 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1964,7 +1970,6 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
cksum_offset = 0; cksum_offset = 0;
pseudo_hdr_offset = 0; pseudo_hdr_offset = 0;
} else { } else {
pseudo_hdr_offset = htons(pseudo_hdr_offset);
odd_flag = MXGEFW_FLAGS_ALIGN_ODD; odd_flag = MXGEFW_FLAGS_ALIGN_ODD;
flags |= MXGEFW_FLAGS_CKSUM; flags |= MXGEFW_FLAGS_CKSUM;
} }
...@@ -1986,7 +1991,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1986,7 +1991,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
/* for TSO, pseudo_hdr_offset holds mss. /* for TSO, pseudo_hdr_offset holds mss.
* The firmware figures out where to put * The firmware figures out where to put
* the checksum by parsing the header. */ * the checksum by parsing the header. */
pseudo_hdr_offset = htons(mss); pseudo_hdr_offset = mss;
} else } else
#endif /*NETIF_F_TSO */ #endif /*NETIF_F_TSO */
/* Mark small packets, and pad out tiny packets */ /* Mark small packets, and pad out tiny packets */
...@@ -2086,7 +2091,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2086,7 +2091,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
#endif /* NETIF_F_TSO */ #endif /* NETIF_F_TSO */
req->addr_high = high_swapped; req->addr_high = high_swapped;
req->addr_low = htonl(low); req->addr_low = htonl(low);
req->pseudo_hdr_offset = pseudo_hdr_offset; req->pseudo_hdr_offset = htons(pseudo_hdr_offset);
req->pad = 0; /* complete solid 16-byte block; does this matter? */ req->pad = 0; /* complete solid 16-byte block; does this matter? */
req->rdma_count = 1; req->rdma_count = 1;
req->length = htons(seglen); req->length = htons(seglen);
...@@ -2199,6 +2204,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev) ...@@ -2199,6 +2204,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
struct myri10ge_cmd cmd; struct myri10ge_cmd cmd;
struct myri10ge_priv *mgp; struct myri10ge_priv *mgp;
struct dev_mc_list *mc_list; struct dev_mc_list *mc_list;
__be32 data[2] = {0, 0};
int err; int err;
mgp = netdev_priv(dev); mgp = netdev_priv(dev);
...@@ -2237,10 +2243,9 @@ static void myri10ge_set_multicast_list(struct net_device *dev) ...@@ -2237,10 +2243,9 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
/* Walk the multicast list, and add each address */ /* Walk the multicast list, and add each address */
for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) { for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) {
memcpy(&cmd.data0, &mc_list->dmi_addr, 4); memcpy(data, &mc_list->dmi_addr, 6);
memcpy(&cmd.data1, ((char *)&mc_list->dmi_addr) + 4, 2); cmd.data0 = ntohl(data[0]);
cmd.data0 = htonl(cmd.data0); cmd.data1 = ntohl(data[1]);
cmd.data1 = htonl(cmd.data1);
err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP,
&cmd, 1); &cmd, 1);
......
...@@ -6,23 +6,23 @@ ...@@ -6,23 +6,23 @@
/* 8 Bytes */ /* 8 Bytes */
struct mcp_dma_addr { struct mcp_dma_addr {
u32 high; __be32 high;
u32 low; __be32 low;
}; };
/* 4 Bytes */ /* 4 Bytes */
struct mcp_slot { struct mcp_slot {
u16 checksum; __sum16 checksum;
u16 length; __be16 length;
}; };
/* 64 Bytes */ /* 64 Bytes */
struct mcp_cmd { struct mcp_cmd {
u32 cmd; __be32 cmd;
u32 data0; /* will be low portion if data > 32 bits */ __be32 data0; /* will be low portion if data > 32 bits */
/* 8 */ /* 8 */
u32 data1; /* will be high portion if data > 32 bits */ __be32 data1; /* will be high portion if data > 32 bits */
u32 data2; /* currently unused.. */ __be32 data2; /* currently unused.. */
/* 16 */ /* 16 */
struct mcp_dma_addr response_addr; struct mcp_dma_addr response_addr;
/* 24 */ /* 24 */
...@@ -31,8 +31,8 @@ struct mcp_cmd { ...@@ -31,8 +31,8 @@ struct mcp_cmd {
/* 8 Bytes */ /* 8 Bytes */
struct mcp_cmd_response { struct mcp_cmd_response {
u32 data; __be32 data;
u32 result; __be32 result;
}; };
/* /*
...@@ -73,10 +73,10 @@ union mcp_pso_or_cumlen { ...@@ -73,10 +73,10 @@ union mcp_pso_or_cumlen {
/* 16 Bytes */ /* 16 Bytes */
struct mcp_kreq_ether_send { struct mcp_kreq_ether_send {
u32 addr_high; __be32 addr_high;
u32 addr_low; __be32 addr_low;
u16 pseudo_hdr_offset; __be16 pseudo_hdr_offset;
u16 length; __be16 length;
u8 pad; u8 pad;
u8 rdma_count; u8 rdma_count;
u8 cksum_offset; /* where to start computing cksum */ u8 cksum_offset; /* where to start computing cksum */
...@@ -85,8 +85,8 @@ struct mcp_kreq_ether_send { ...@@ -85,8 +85,8 @@ struct mcp_kreq_ether_send {
/* 8 Bytes */ /* 8 Bytes */
struct mcp_kreq_ether_recv { struct mcp_kreq_ether_recv {
u32 addr_high; __be32 addr_high;
u32 addr_low; __be32 addr_low;
}; };
/* Commands */ /* Commands */
...@@ -219,19 +219,19 @@ enum myri10ge_mcp_cmd_status { ...@@ -219,19 +219,19 @@ enum myri10ge_mcp_cmd_status {
struct mcp_irq_data { struct mcp_irq_data {
/* add new counters at the beginning */ /* add new counters at the beginning */
u32 future_use[5]; __be32 future_use[5];
u32 dropped_multicast_filtered; __be32 dropped_multicast_filtered;
/* 40 Bytes */ /* 40 Bytes */
u32 send_done_count; __be32 send_done_count;
u32 link_up; __be32 link_up;
u32 dropped_link_overflow; __be32 dropped_link_overflow;
u32 dropped_link_error_or_filtered; __be32 dropped_link_error_or_filtered;
u32 dropped_runt; __be32 dropped_runt;
u32 dropped_overrun; __be32 dropped_overrun;
u32 dropped_no_small_buffer; __be32 dropped_no_small_buffer;
u32 dropped_no_big_buffer; __be32 dropped_no_big_buffer;
u32 rdma_tags_available; __be32 rdma_tags_available;
u8 tx_stopped; u8 tx_stopped;
u8 link_down; u8 link_down;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
struct mcp_gen_header { struct mcp_gen_header {
/* the first 4 fields are filled at compile time */ /* the first 4 fields are filled at compile time */
unsigned header_length; unsigned header_length;
unsigned mcp_type; __be32 mcp_type;
char version[128]; char version[128];
unsigned mcp_globals; /* pointer to mcp-type specific structure */ unsigned mcp_globals; /* pointer to mcp-type specific structure */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册