aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 13:48:32 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-12-04 16:07:23 -0500
commit40f6cff5c47efac2df361fbfc2eb2816729986c8 (patch)
treeb7b46a1a9a35fc7844c7810718c94f99035720df /drivers/net/myri10ge
parentbffa2154956da31f59c6050f176fadba630ff53a (diff)
[PATCH] myri10ge annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/net/myri10ge')
-rw-r--r--drivers/net/myri10ge/myri10ge.c91
-rw-r--r--drivers/net/myri10ge/myri10ge_mcp.h56
-rw-r--r--drivers/net/myri10ge/myri10ge_mcp_gen_header.h2
3 files changed, 77 insertions, 72 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 36350e6db1c1..d320bbeeeff6 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual BSD/GPL");
89#define MYRI10GE_EEPROM_STRINGS_SIZE 256 89#define MYRI10GE_EEPROM_STRINGS_SIZE 256
90#define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2) 90#define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2)
91 91
92#define MYRI10GE_NO_CONFIRM_DATA 0xffffffff 92#define MYRI10GE_NO_CONFIRM_DATA htonl(0xffffffff)
93#define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff 93#define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff
94 94
95struct myri10ge_rx_buffer_state { 95struct myri10ge_rx_buffer_state {
@@ -156,8 +156,8 @@ struct myri10ge_priv {
156 int sram_size; 156 int sram_size;
157 unsigned long board_span; 157 unsigned long board_span;
158 unsigned long iomem_base; 158 unsigned long iomem_base;
159 u32 __iomem *irq_claim; 159 __be32 __iomem *irq_claim;
160 u32 __iomem *irq_deassert; 160 __be32 __iomem *irq_deassert;
161 char *mac_addr_string; 161 char *mac_addr_string;
162 struct mcp_cmd_response *cmd; 162 struct mcp_cmd_response *cmd;
163 dma_addr_t cmd_bus; 163 dma_addr_t cmd_bus;
@@ -165,10 +165,10 @@ struct myri10ge_priv {
165 dma_addr_t fw_stats_bus; 165 dma_addr_t fw_stats_bus;
166 struct pci_dev *pdev; 166 struct pci_dev *pdev;
167 int msi_enabled; 167 int msi_enabled;
168 unsigned int link_state; 168 __be32 link_state;
169 unsigned int rdma_tags_available; 169 unsigned int rdma_tags_available;
170 int intr_coal_delay; 170 int intr_coal_delay;
171 u32 __iomem *intr_coal_delay_ptr; 171 __be32 __iomem *intr_coal_delay_ptr;
172 int mtrr; 172 int mtrr;
173 int wake_queue; 173 int wake_queue;
174 int stop_queue; 174 int stop_queue;
@@ -273,6 +273,11 @@ MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)");
273 273
274#define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8) 274#define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8)
275 275
276static inline void put_be32(__be32 val, __be32 __iomem *p)
277{
278 __raw_writel((__force __u32)val, (__force void __iomem *)p);
279}
280
276static int 281static int
277myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, 282myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
278 struct myri10ge_cmd *data, int atomic) 283 struct myri10ge_cmd *data, int atomic)
@@ -296,7 +301,7 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
296 301
297 buf->response_addr.low = htonl(dma_low); 302 buf->response_addr.low = htonl(dma_low);
298 buf->response_addr.high = htonl(dma_high); 303 buf->response_addr.high = htonl(dma_high);
299 response->result = MYRI10GE_NO_RESPONSE_RESULT; 304 response->result = htonl(MYRI10GE_NO_RESPONSE_RESULT);
300 mb(); 305 mb();
301 myri10ge_pio_copy(cmd_addr, buf, sizeof(*buf)); 306 myri10ge_pio_copy(cmd_addr, buf, sizeof(*buf));
302 307
@@ -311,14 +316,14 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
311 * (1ms will be enough for those commands) */ 316 * (1ms will be enough for those commands) */
312 for (sleep_total = 0; 317 for (sleep_total = 0;
313 sleep_total < 1000 318 sleep_total < 1000
314 && response->result == MYRI10GE_NO_RESPONSE_RESULT; 319 && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
315 sleep_total += 10) 320 sleep_total += 10)
316 udelay(10); 321 udelay(10);
317 } else { 322 } else {
318 /* use msleep for most command */ 323 /* use msleep for most command */
319 for (sleep_total = 0; 324 for (sleep_total = 0;
320 sleep_total < 15 325 sleep_total < 15
321 && response->result == MYRI10GE_NO_RESPONSE_RESULT; 326 && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
322 sleep_total++) 327 sleep_total++)
323 msleep(1); 328 msleep(1);
324 } 329 }
@@ -393,7 +398,7 @@ abort:
393static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) 398static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
394{ 399{
395 char __iomem *submit; 400 char __iomem *submit;
396 u32 buf[16]; 401 __be32 buf[16];
397 u32 dma_low, dma_high; 402 u32 dma_low, dma_high;
398 int i; 403 int i;
399 404
@@ -410,7 +415,7 @@ static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
410 415
411 buf[0] = htonl(dma_high); /* confirm addr MSW */ 416 buf[0] = htonl(dma_high); /* confirm addr MSW */
412 buf[1] = htonl(dma_low); /* confirm addr LSW */ 417 buf[1] = htonl(dma_low); /* confirm addr LSW */
413 buf[2] = htonl(MYRI10GE_NO_CONFIRM_DATA); /* confirm data */ 418 buf[2] = MYRI10GE_NO_CONFIRM_DATA; /* confirm data */
414 buf[3] = htonl(dma_high); /* dummy addr MSW */ 419 buf[3] = htonl(dma_high); /* dummy addr MSW */
415 buf[4] = htonl(dma_low); /* dummy addr LSW */ 420 buf[4] = htonl(dma_low); /* dummy addr LSW */
416 buf[5] = htonl(enable); /* enable? */ 421 buf[5] = htonl(enable); /* enable? */
@@ -479,7 +484,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
479 } 484 }
480 485
481 /* check id */ 486 /* check id */
482 hdr_offset = ntohl(*(u32 *) (fw->data + MCP_HEADER_PTR_OFFSET)); 487 hdr_offset = ntohl(*(__be32 *) (fw->data + MCP_HEADER_PTR_OFFSET));
483 if ((hdr_offset & 3) || hdr_offset + sizeof(*hdr) > fw->size) { 488 if ((hdr_offset & 3) || hdr_offset + sizeof(*hdr) > fw->size) {
484 dev_err(dev, "Bad firmware file\n"); 489 dev_err(dev, "Bad firmware file\n");
485 status = -EINVAL; 490 status = -EINVAL;
@@ -550,7 +555,7 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp)
550static int myri10ge_load_firmware(struct myri10ge_priv *mgp) 555static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
551{ 556{
552 char __iomem *submit; 557 char __iomem *submit;
553 u32 buf[16]; 558 __be32 buf[16];
554 u32 dma_low, dma_high, size; 559 u32 dma_low, dma_high, size;
555 int status, i; 560 int status, i;
556 561
@@ -600,7 +605,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
600 605
601 buf[0] = htonl(dma_high); /* confirm addr MSW */ 606 buf[0] = htonl(dma_high); /* confirm addr MSW */
602 buf[1] = htonl(dma_low); /* confirm addr LSW */ 607 buf[1] = htonl(dma_low); /* confirm addr LSW */
603 buf[2] = htonl(MYRI10GE_NO_CONFIRM_DATA); /* confirm data */ 608 buf[2] = MYRI10GE_NO_CONFIRM_DATA; /* confirm data */
604 609
605 /* FIX: All newest firmware should un-protect the bottom of 610 /* FIX: All newest firmware should un-protect the bottom of
606 * the sram before handoff. However, the very first interfaces 611 * the sram before handoff. However, the very first interfaces
@@ -705,21 +710,21 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
705 710
706 status |= 711 status |=
707 myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0); 712 myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_IRQ_ACK_OFFSET, &cmd, 0);
708 mgp->irq_claim = (__iomem u32 *) (mgp->sram + cmd.data0); 713 mgp->irq_claim = (__iomem __be32 *) (mgp->sram + cmd.data0);
709 if (!mgp->msi_enabled) { 714 if (!mgp->msi_enabled) {
710 status |= myri10ge_send_cmd 715 status |= myri10ge_send_cmd
711 (mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, &cmd, 0); 716 (mgp, MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET, &cmd, 0);
712 mgp->irq_deassert = (__iomem u32 *) (mgp->sram + cmd.data0); 717 mgp->irq_deassert = (__iomem __be32 *) (mgp->sram + cmd.data0);
713 718
714 } 719 }
715 status |= myri10ge_send_cmd 720 status |= myri10ge_send_cmd
716 (mgp, MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, &cmd, 0); 721 (mgp, MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, &cmd, 0);
717 mgp->intr_coal_delay_ptr = (__iomem u32 *) (mgp->sram + cmd.data0); 722 mgp->intr_coal_delay_ptr = (__iomem __be32 *) (mgp->sram + cmd.data0);
718 if (status != 0) { 723 if (status != 0) {
719 dev_err(&mgp->pdev->dev, "failed set interrupt parameters\n"); 724 dev_err(&mgp->pdev->dev, "failed set interrupt parameters\n");
720 return status; 725 return status;
721 } 726 }
722 __raw_writel(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); 727 put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr);
723 728
724 /* Run a small DMA test. 729 /* Run a small DMA test.
725 * The magic multipliers to the length tell the firmware 730 * The magic multipliers to the length tell the firmware
@@ -786,14 +791,14 @@ static inline void
786myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, 791myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst,
787 struct mcp_kreq_ether_recv *src) 792 struct mcp_kreq_ether_recv *src)
788{ 793{
789 u32 low; 794 __be32 low;
790 795
791 low = src->addr_low; 796 low = src->addr_low;
792 src->addr_low = DMA_32BIT_MASK; 797 src->addr_low = htonl(DMA_32BIT_MASK);
793 myri10ge_pio_copy(dst, src, 8 * sizeof(*src)); 798 myri10ge_pio_copy(dst, src, 8 * sizeof(*src));
794 mb(); 799 mb();
795 src->addr_low = low; 800 src->addr_low = low;
796 __raw_writel(low, &dst->addr_low); 801 put_be32(low, &dst->addr_low);
797 mb(); 802 mb();
798} 803}
799 804
@@ -939,11 +944,11 @@ done:
939 return retval; 944 return retval;
940} 945}
941 946
942static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum) 947static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, __wsum hw_csum)
943{ 948{
944 struct vlan_hdr *vh = (struct vlan_hdr *)(skb->data); 949 struct vlan_hdr *vh = (struct vlan_hdr *)(skb->data);
945 950
946 if ((skb->protocol == ntohs(ETH_P_8021Q)) && 951 if ((skb->protocol == htons(ETH_P_8021Q)) &&
947 (vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) || 952 (vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) ||
948 vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) { 953 vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) {
949 skb->csum = hw_csum; 954 skb->csum = hw_csum;
@@ -953,7 +958,7 @@ static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum)
953 958
954static inline unsigned long 959static inline unsigned long
955myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, 960myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
956 int bytes, int len, int csum) 961 int bytes, int len, __wsum csum)
957{ 962{
958 dma_addr_t bus; 963 dma_addr_t bus;
959 struct sk_buff *skb; 964 struct sk_buff *skb;
@@ -986,12 +991,12 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
986 991
987 skb->protocol = eth_type_trans(skb, mgp->dev); 992 skb->protocol = eth_type_trans(skb, mgp->dev);
988 if (mgp->csum_flag) { 993 if (mgp->csum_flag) {
989 if ((skb->protocol == ntohs(ETH_P_IP)) || 994 if ((skb->protocol == htons(ETH_P_IP)) ||
990 (skb->protocol == ntohs(ETH_P_IPV6))) { 995 (skb->protocol == htons(ETH_P_IPV6))) {
991 skb->csum = ntohs((u16) csum); 996 skb->csum = csum;
992 skb->ip_summed = CHECKSUM_COMPLETE; 997 skb->ip_summed = CHECKSUM_COMPLETE;
993 } else 998 } else
994 myri10ge_vlan_ip_csum(skb, ntohs((u16) csum)); 999 myri10ge_vlan_ip_csum(skb, csum);
995 } 1000 }
996 1001
997 netif_receive_skb(skb); 1002 netif_receive_skb(skb);
@@ -1060,12 +1065,12 @@ static inline void myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int *limit)
1060 int idx = rx_done->idx; 1065 int idx = rx_done->idx;
1061 int cnt = rx_done->cnt; 1066 int cnt = rx_done->cnt;
1062 u16 length; 1067 u16 length;
1063 u16 checksum; 1068 __wsum checksum;
1064 1069
1065 while (rx_done->entry[idx].length != 0 && *limit != 0) { 1070 while (rx_done->entry[idx].length != 0 && *limit != 0) {
1066 length = ntohs(rx_done->entry[idx].length); 1071 length = ntohs(rx_done->entry[idx].length);
1067 rx_done->entry[idx].length = 0; 1072 rx_done->entry[idx].length = 0;
1068 checksum = ntohs(rx_done->entry[idx].checksum); 1073 checksum = csum_unfold(rx_done->entry[idx].checksum);
1069 if (length <= mgp->small_bytes) 1074 if (length <= mgp->small_bytes)
1070 rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small, 1075 rx_ok = myri10ge_rx_done(mgp, &mgp->rx_small,
1071 mgp->small_bytes, 1076 mgp->small_bytes,
@@ -1142,7 +1147,7 @@ static int myri10ge_poll(struct net_device *netdev, int *budget)
1142 1147
1143 if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { 1148 if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) {
1144 netif_rx_complete(netdev); 1149 netif_rx_complete(netdev);
1145 __raw_writel(htonl(3), mgp->irq_claim); 1150 put_be32(htonl(3), mgp->irq_claim);
1146 return 0; 1151 return 0;
1147 } 1152 }
1148 return 1; 1153 return 1;
@@ -1166,7 +1171,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1166 netif_rx_schedule(mgp->dev); 1171 netif_rx_schedule(mgp->dev);
1167 1172
1168 if (!mgp->msi_enabled) { 1173 if (!mgp->msi_enabled) {
1169 __raw_writel(0, mgp->irq_deassert); 1174 put_be32(0, mgp->irq_deassert);
1170 if (!myri10ge_deassert_wait) 1175 if (!myri10ge_deassert_wait)
1171 stats->valid = 0; 1176 stats->valid = 0;
1172 mb(); 1177 mb();
@@ -1195,7 +1200,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1195 1200
1196 myri10ge_check_statblock(mgp); 1201 myri10ge_check_statblock(mgp);
1197 1202
1198 __raw_writel(htonl(3), mgp->irq_claim + 1); 1203 put_be32(htonl(3), mgp->irq_claim + 1);
1199 return (IRQ_HANDLED); 1204 return (IRQ_HANDLED);
1200} 1205}
1201 1206
@@ -1233,7 +1238,7 @@ myri10ge_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal)
1233 struct myri10ge_priv *mgp = netdev_priv(netdev); 1238 struct myri10ge_priv *mgp = netdev_priv(netdev);
1234 1239
1235 mgp->intr_coal_delay = coal->rx_coalesce_usecs; 1240 mgp->intr_coal_delay = coal->rx_coalesce_usecs;
1236 __raw_writel(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr); 1241 put_be32(htonl(mgp->intr_coal_delay), mgp->intr_coal_delay_ptr);
1237 return 0; 1242 return 0;
1238} 1243}
1239 1244
@@ -1748,7 +1753,7 @@ static int myri10ge_open(struct net_device *dev)
1748 goto abort_with_rings; 1753 goto abort_with_rings;
1749 } 1754 }
1750 1755
1751 mgp->link_state = -1; 1756 mgp->link_state = htonl(~0U);
1752 mgp->rdma_tags_available = 15; 1757 mgp->rdma_tags_available = 15;
1753 1758
1754 netif_poll_enable(mgp->dev); /* must happen prior to any irq */ 1759 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 1881
1877 /* re-write the last 32-bits with the valid flags */ 1882 /* re-write the last 32-bits with the valid flags */
1878 src->flags = last_flags; 1883 src->flags = last_flags;
1879 __raw_writel(*((u32 *) src + 3), (u32 __iomem *) dst + 3); 1884 put_be32(*((__be32 *) src + 3), (__be32 __iomem *) dst + 3);
1880 tx->req += cnt; 1885 tx->req += cnt;
1881 mb(); 1886 mb();
1882} 1887}
@@ -1919,7 +1924,8 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
1919 struct myri10ge_tx_buf *tx = &mgp->tx; 1924 struct myri10ge_tx_buf *tx = &mgp->tx;
1920 struct skb_frag_struct *frag; 1925 struct skb_frag_struct *frag;
1921 dma_addr_t bus; 1926 dma_addr_t bus;
1922 u32 low, high_swapped; 1927 u32 low;
1928 __be32 high_swapped;
1923 unsigned int len; 1929 unsigned int len;
1924 int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments; 1930 int idx, last_idx, avail, frag_cnt, frag_idx, count, mss, max_segments;
1925 u16 pseudo_hdr_offset, cksum_offset; 1931 u16 pseudo_hdr_offset, cksum_offset;
@@ -1964,7 +1970,6 @@ again:
1964 cksum_offset = 0; 1970 cksum_offset = 0;
1965 pseudo_hdr_offset = 0; 1971 pseudo_hdr_offset = 0;
1966 } else { 1972 } else {
1967 pseudo_hdr_offset = htons(pseudo_hdr_offset);
1968 odd_flag = MXGEFW_FLAGS_ALIGN_ODD; 1973 odd_flag = MXGEFW_FLAGS_ALIGN_ODD;
1969 flags |= MXGEFW_FLAGS_CKSUM; 1974 flags |= MXGEFW_FLAGS_CKSUM;
1970 } 1975 }
@@ -1986,7 +1991,7 @@ again:
1986 /* for TSO, pseudo_hdr_offset holds mss. 1991 /* for TSO, pseudo_hdr_offset holds mss.
1987 * The firmware figures out where to put 1992 * The firmware figures out where to put
1988 * the checksum by parsing the header. */ 1993 * the checksum by parsing the header. */
1989 pseudo_hdr_offset = htons(mss); 1994 pseudo_hdr_offset = mss;
1990 } else 1995 } else
1991#endif /*NETIF_F_TSO */ 1996#endif /*NETIF_F_TSO */
1992 /* Mark small packets, and pad out tiny packets */ 1997 /* Mark small packets, and pad out tiny packets */
@@ -2086,7 +2091,7 @@ again:
2086#endif /* NETIF_F_TSO */ 2091#endif /* NETIF_F_TSO */
2087 req->addr_high = high_swapped; 2092 req->addr_high = high_swapped;
2088 req->addr_low = htonl(low); 2093 req->addr_low = htonl(low);
2089 req->pseudo_hdr_offset = pseudo_hdr_offset; 2094 req->pseudo_hdr_offset = htons(pseudo_hdr_offset);
2090 req->pad = 0; /* complete solid 16-byte block; does this matter? */ 2095 req->pad = 0; /* complete solid 16-byte block; does this matter? */
2091 req->rdma_count = 1; 2096 req->rdma_count = 1;
2092 req->length = htons(seglen); 2097 req->length = htons(seglen);
@@ -2199,6 +2204,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
2199 struct myri10ge_cmd cmd; 2204 struct myri10ge_cmd cmd;
2200 struct myri10ge_priv *mgp; 2205 struct myri10ge_priv *mgp;
2201 struct dev_mc_list *mc_list; 2206 struct dev_mc_list *mc_list;
2207 __be32 data[2] = {0, 0};
2202 int err; 2208 int err;
2203 2209
2204 mgp = netdev_priv(dev); 2210 mgp = netdev_priv(dev);
@@ -2237,10 +2243,9 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
2237 2243
2238 /* Walk the multicast list, and add each address */ 2244 /* Walk the multicast list, and add each address */
2239 for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) { 2245 for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) {
2240 memcpy(&cmd.data0, &mc_list->dmi_addr, 4); 2246 memcpy(data, &mc_list->dmi_addr, 6);
2241 memcpy(&cmd.data1, ((char *)&mc_list->dmi_addr) + 4, 2); 2247 cmd.data0 = ntohl(data[0]);
2242 cmd.data0 = htonl(cmd.data0); 2248 cmd.data1 = ntohl(data[1]);
2243 cmd.data1 = htonl(cmd.data1);
2244 err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, 2249 err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP,
2245 &cmd, 1); 2250 &cmd, 1);
2246 2251
diff --git a/drivers/net/myri10ge/myri10ge_mcp.h b/drivers/net/myri10ge/myri10ge_mcp.h
index 9519ae7cd5ec..29463b301a84 100644
--- a/drivers/net/myri10ge/myri10ge_mcp.h
+++ b/drivers/net/myri10ge/myri10ge_mcp.h
@@ -6,23 +6,23 @@
6 6
7/* 8 Bytes */ 7/* 8 Bytes */
8struct mcp_dma_addr { 8struct mcp_dma_addr {
9 u32 high; 9 __be32 high;
10 u32 low; 10 __be32 low;
11}; 11};
12 12
13/* 4 Bytes */ 13/* 4 Bytes */
14struct mcp_slot { 14struct mcp_slot {
15 u16 checksum; 15 __sum16 checksum;
16 u16 length; 16 __be16 length;
17}; 17};
18 18
19/* 64 Bytes */ 19/* 64 Bytes */
20struct mcp_cmd { 20struct mcp_cmd {
21 u32 cmd; 21 __be32 cmd;
22 u32 data0; /* will be low portion if data > 32 bits */ 22 __be32 data0; /* will be low portion if data > 32 bits */
23 /* 8 */ 23 /* 8 */
24 u32 data1; /* will be high portion if data > 32 bits */ 24 __be32 data1; /* will be high portion if data > 32 bits */
25 u32 data2; /* currently unused.. */ 25 __be32 data2; /* currently unused.. */
26 /* 16 */ 26 /* 16 */
27 struct mcp_dma_addr response_addr; 27 struct mcp_dma_addr response_addr;
28 /* 24 */ 28 /* 24 */
@@ -31,8 +31,8 @@ struct mcp_cmd {
31 31
32/* 8 Bytes */ 32/* 8 Bytes */
33struct mcp_cmd_response { 33struct mcp_cmd_response {
34 u32 data; 34 __be32 data;
35 u32 result; 35 __be32 result;
36}; 36};
37 37
38/* 38/*
@@ -73,10 +73,10 @@ union mcp_pso_or_cumlen {
73 73
74/* 16 Bytes */ 74/* 16 Bytes */
75struct mcp_kreq_ether_send { 75struct mcp_kreq_ether_send {
76 u32 addr_high; 76 __be32 addr_high;
77 u32 addr_low; 77 __be32 addr_low;
78 u16 pseudo_hdr_offset; 78 __be16 pseudo_hdr_offset;
79 u16 length; 79 __be16 length;
80 u8 pad; 80 u8 pad;
81 u8 rdma_count; 81 u8 rdma_count;
82 u8 cksum_offset; /* where to start computing cksum */ 82 u8 cksum_offset; /* where to start computing cksum */
@@ -85,8 +85,8 @@ struct mcp_kreq_ether_send {
85 85
86/* 8 Bytes */ 86/* 8 Bytes */
87struct mcp_kreq_ether_recv { 87struct mcp_kreq_ether_recv {
88 u32 addr_high; 88 __be32 addr_high;
89 u32 addr_low; 89 __be32 addr_low;
90}; 90};
91 91
92/* Commands */ 92/* Commands */
@@ -219,19 +219,19 @@ enum myri10ge_mcp_cmd_status {
219 219
220struct mcp_irq_data { 220struct mcp_irq_data {
221 /* add new counters at the beginning */ 221 /* add new counters at the beginning */
222 u32 future_use[5]; 222 __be32 future_use[5];
223 u32 dropped_multicast_filtered; 223 __be32 dropped_multicast_filtered;
224 /* 40 Bytes */ 224 /* 40 Bytes */
225 u32 send_done_count; 225 __be32 send_done_count;
226 226
227 u32 link_up; 227 __be32 link_up;
228 u32 dropped_link_overflow; 228 __be32 dropped_link_overflow;
229 u32 dropped_link_error_or_filtered; 229 __be32 dropped_link_error_or_filtered;
230 u32 dropped_runt; 230 __be32 dropped_runt;
231 u32 dropped_overrun; 231 __be32 dropped_overrun;
232 u32 dropped_no_small_buffer; 232 __be32 dropped_no_small_buffer;
233 u32 dropped_no_big_buffer; 233 __be32 dropped_no_big_buffer;
234 u32 rdma_tags_available; 234 __be32 rdma_tags_available;
235 235
236 u8 tx_stopped; 236 u8 tx_stopped;
237 u8 link_down; 237 u8 link_down;
diff --git a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
index 487f7792fd46..16a810dd6d51 100644
--- a/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
+++ b/drivers/net/myri10ge/myri10ge_mcp_gen_header.h
@@ -36,7 +36,7 @@
36struct mcp_gen_header { 36struct mcp_gen_header {
37 /* the first 4 fields are filled at compile time */ 37 /* the first 4 fields are filled at compile time */
38 unsigned header_length; 38 unsigned header_length;
39 unsigned mcp_type; 39 __be32 mcp_type;
40 char version[128]; 40 char version[128];
41 unsigned mcp_globals; /* pointer to mcp-type specific structure */ 41 unsigned mcp_globals; /* pointer to mcp-type specific structure */
42 42