aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2009-02-12 03:38:17 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-16 02:31:53 -0500
commit4781bfad732af717784ee6b5bcdd97f4c3e8f597 (patch)
treee1d0bca4fe681fa59b9d03e23453a47372308d7f /drivers/net/bnx2x_main.c
parent0626b89971d75b35698f208fd7abe4303e1588b9 (diff)
bnx2x: Sparse endianity annotation
Resolving the majority of the issues, but there are still some left for future patches. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 2542ba88a290..26451f6a7c49 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -473,7 +473,7 @@ static int bnx2x_mc_assert(struct bnx2x *bp)
473static void bnx2x_fw_dump(struct bnx2x *bp) 473static void bnx2x_fw_dump(struct bnx2x *bp)
474{ 474{
475 u32 mark, offset; 475 u32 mark, offset;
476 u32 data[9]; 476 __be32 data[9];
477 int word; 477 int word;
478 478
479 mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); 479 mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104);
@@ -3000,8 +3000,8 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
3000 3000
3001#define UPDATE_EXTEND_TSTAT(s, t) \ 3001#define UPDATE_EXTEND_TSTAT(s, t) \
3002 do { \ 3002 do { \
3003 diff = le32_to_cpu(tclient->s) - old_tclient->s; \ 3003 diff = le32_to_cpu(tclient->s) - le32_to_cpu(old_tclient->s); \
3004 old_tclient->s = le32_to_cpu(tclient->s); \ 3004 old_tclient->s = tclient->s; \
3005 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 3005 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
3006 } while (0) 3006 } while (0)
3007 3007
@@ -3014,8 +3014,8 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
3014 3014
3015#define UPDATE_EXTEND_XSTAT(s, t) \ 3015#define UPDATE_EXTEND_XSTAT(s, t) \
3016 do { \ 3016 do { \
3017 diff = le32_to_cpu(xclient->s) - old_xclient->s; \ 3017 diff = le32_to_cpu(xclient->s) - le32_to_cpu(old_xclient->s); \
3018 old_xclient->s = le32_to_cpu(xclient->s); \ 3018 old_xclient->s = xclient->s; \
3019 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 3019 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
3020 } while (0) 3020 } while (0)
3021 3021
@@ -3524,7 +3524,10 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp)
3524 struct bmac_stats *new = bnx2x_sp(bp, mac_stats.bmac_stats); 3524 struct bmac_stats *new = bnx2x_sp(bp, mac_stats.bmac_stats);
3525 struct host_port_stats *pstats = bnx2x_sp(bp, port_stats); 3525 struct host_port_stats *pstats = bnx2x_sp(bp, port_stats);
3526 struct bnx2x_eth_stats *estats = &bp->eth_stats; 3526 struct bnx2x_eth_stats *estats = &bp->eth_stats;
3527 struct regpair diff; 3527 struct {
3528 u32 lo;
3529 u32 hi;
3530 } diff;
3528 3531
3529 UPDATE_STAT64(rx_stat_grerb, rx_stat_ifhcinbadoctets); 3532 UPDATE_STAT64(rx_stat_grerb, rx_stat_ifhcinbadoctets);
3530 UPDATE_STAT64(rx_stat_grfcs, rx_stat_dot3statsfcserrors); 3533 UPDATE_STAT64(rx_stat_grfcs, rx_stat_dot3statsfcserrors);
@@ -3630,7 +3633,10 @@ static int bnx2x_hw_stats_update(struct bnx2x *bp)
3630 struct nig_stats *old = &(bp->port.old_nig_stats); 3633 struct nig_stats *old = &(bp->port.old_nig_stats);
3631 struct host_port_stats *pstats = bnx2x_sp(bp, port_stats); 3634 struct host_port_stats *pstats = bnx2x_sp(bp, port_stats);
3632 struct bnx2x_eth_stats *estats = &bp->eth_stats; 3635 struct bnx2x_eth_stats *estats = &bp->eth_stats;
3633 struct regpair diff; 3636 struct {
3637 u32 lo;
3638 u32 hi;
3639 } diff;
3634 u32 nig_timer_max; 3640 u32 nig_timer_max;
3635 3641
3636 if (bp->link_vars.mac_type == MAC_TYPE_BMAC) 3642 if (bp->link_vars.mac_type == MAC_TYPE_BMAC)
@@ -3994,12 +4000,12 @@ static void bnx2x_stats_update(struct bnx2x *bp)
3994 "mac_discard %u mac_filter_discard %u " 4000 "mac_discard %u mac_filter_discard %u "
3995 "xxovrflow_discard %u brb_truncate_discard %u " 4001 "xxovrflow_discard %u brb_truncate_discard %u "
3996 "ttl0_discard %u\n", 4002 "ttl0_discard %u\n",
3997 old_tclient->checksum_discard, 4003 le32_to_cpu(old_tclient->checksum_discard),
3998 bnx2x_hilo(&qstats->etherstatsoverrsizepkts_hi), 4004 bnx2x_hilo(&qstats->etherstatsoverrsizepkts_hi),
3999 bnx2x_hilo(&qstats->no_buff_discard_hi), 4005 bnx2x_hilo(&qstats->no_buff_discard_hi),
4000 estats->mac_discard, estats->mac_filter_discard, 4006 estats->mac_discard, estats->mac_filter_discard,
4001 estats->xxoverflow_discard, estats->brb_truncate_discard, 4007 estats->xxoverflow_discard, estats->brb_truncate_discard,
4002 old_tclient->ttl0_discard); 4008 le32_to_cpu(old_tclient->ttl0_discard));
4003 4009
4004 for_each_queue(bp, i) { 4010 for_each_queue(bp, i) {
4005 printk(KERN_DEBUG "[%d]: %lu\t%lu\t%lu\n", i, 4011 printk(KERN_DEBUG "[%d]: %lu\t%lu\t%lu\n", i,
@@ -6610,9 +6616,9 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp, int set)
6610 config->config_table[0].cam_entry.lsb_mac_addr); 6616 config->config_table[0].cam_entry.lsb_mac_addr);
6611 6617
6612 /* broadcast */ 6618 /* broadcast */
6613 config->config_table[1].cam_entry.msb_mac_addr = 0xffff; 6619 config->config_table[1].cam_entry.msb_mac_addr = cpu_to_le16(0xffff);
6614 config->config_table[1].cam_entry.middle_mac_addr = 0xffff; 6620 config->config_table[1].cam_entry.middle_mac_addr = cpu_to_le16(0xffff);
6615 config->config_table[1].cam_entry.lsb_mac_addr = 0xffff; 6621 config->config_table[1].cam_entry.lsb_mac_addr = cpu_to_le16(0xffff);
6616 config->config_table[1].cam_entry.flags = cpu_to_le16(port); 6622 config->config_table[1].cam_entry.flags = cpu_to_le16(port);
6617 if (set) 6623 if (set)
6618 config->config_table[1].target_table_entry.flags = 6624 config->config_table[1].target_table_entry.flags =
@@ -7035,7 +7041,7 @@ static int bnx2x_stop_multi(struct bnx2x *bp, int index)
7035 7041
7036static int bnx2x_stop_leading(struct bnx2x *bp) 7042static int bnx2x_stop_leading(struct bnx2x *bp)
7037{ 7043{
7038 u16 dsb_sp_prod_idx; 7044 __le16 dsb_sp_prod_idx;
7039 /* if the other port is handling traffic, 7045 /* if the other port is handling traffic,
7040 this can take a lot of time */ 7046 this can take a lot of time */
7041 int cnt = 500; 7047 int cnt = 500;
@@ -8625,7 +8631,7 @@ static void bnx2x_disable_nvram_access(struct bnx2x *bp)
8625 MCPR_NVM_ACCESS_ENABLE_WR_EN))); 8631 MCPR_NVM_ACCESS_ENABLE_WR_EN)));
8626} 8632}
8627 8633
8628static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, u32 *ret_val, 8634static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, __be32 *ret_val,
8629 u32 cmd_flags) 8635 u32 cmd_flags)
8630{ 8636{
8631 int count, i, rc; 8637 int count, i, rc;
@@ -8661,8 +8667,7 @@ static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, u32 *ret_val,
8661 /* we read nvram data in cpu order 8667 /* we read nvram data in cpu order
8662 * but ethtool sees it as an array of bytes 8668 * but ethtool sees it as an array of bytes
8663 * converting to big-endian will do the work */ 8669 * converting to big-endian will do the work */
8664 val = cpu_to_be32(val); 8670 *ret_val = cpu_to_be32(val);
8665 *ret_val = val;
8666 rc = 0; 8671 rc = 0;
8667 break; 8672 break;
8668 } 8673 }
@@ -8676,7 +8681,7 @@ static int bnx2x_nvram_read(struct bnx2x *bp, u32 offset, u8 *ret_buf,
8676{ 8681{
8677 int rc; 8682 int rc;
8678 u32 cmd_flags; 8683 u32 cmd_flags;
8679 u32 val; 8684 __be32 val;
8680 8685
8681 if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) { 8686 if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) {
8682 DP(BNX2X_MSG_NVM, 8687 DP(BNX2X_MSG_NVM,
@@ -8795,7 +8800,7 @@ static int bnx2x_nvram_write1(struct bnx2x *bp, u32 offset, u8 *data_buf,
8795 int rc; 8800 int rc;
8796 u32 cmd_flags; 8801 u32 cmd_flags;
8797 u32 align_offset; 8802 u32 align_offset;
8798 u32 val; 8803 __be32 val;
8799 8804
8800 if (offset + buf_size > bp->common.flash_size) { 8805 if (offset + buf_size > bp->common.flash_size) {
8801 DP(BNX2X_MSG_NVM, "Invalid parameter: offset (0x%x) +" 8806 DP(BNX2X_MSG_NVM, "Invalid parameter: offset (0x%x) +"
@@ -9387,11 +9392,9 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
9387 9392
9388 wmb(); 9393 wmb();
9389 9394
9390 fp->hw_tx_prods->bds_prod = 9395 le16_add_cpu(&fp->hw_tx_prods->bds_prod, 1);
9391 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1);
9392 mb(); /* FW restriction: must not reorder writing nbd and packets */ 9396 mb(); /* FW restriction: must not reorder writing nbd and packets */
9393 fp->hw_tx_prods->packets_prod = 9397 le32_add_cpu(&fp->hw_tx_prods->packets_prod, 1);
9394 cpu_to_le32(le32_to_cpu(fp->hw_tx_prods->packets_prod) + 1);
9395 DOORBELL(bp, fp->index, 0); 9398 DOORBELL(bp, fp->index, 0);
9396 9399
9397 mmiowb(); 9400 mmiowb();
@@ -9491,7 +9494,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
9491 { 0x778, 0x70 }, 9494 { 0x778, 0x70 },
9492 { 0, 0 } 9495 { 0, 0 }
9493 }; 9496 };
9494 u32 buf[0x350 / 4]; 9497 __be32 buf[0x350 / 4];
9495 u8 *data = (u8 *)buf; 9498 u8 *data = (u8 *)buf;
9496 int i, rc; 9499 int i, rc;
9497 u32 magic, csum; 9500 u32 magic, csum;
@@ -10130,7 +10133,7 @@ static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
10130 rc = XMIT_PLAIN; 10133 rc = XMIT_PLAIN;
10131 10134
10132 else { 10135 else {
10133 if (skb->protocol == ntohs(ETH_P_IPV6)) { 10136 if (skb->protocol == htons(ETH_P_IPV6)) {
10134 rc = XMIT_CSUM_V6; 10137 rc = XMIT_CSUM_V6;
10135 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) 10138 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
10136 rc |= XMIT_CSUM_TCP; 10139 rc |= XMIT_CSUM_TCP;
@@ -10340,9 +10343,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
10340 hlen = (skb_network_header(skb) - skb->data + vlan_off) / 2; 10343 hlen = (skb_network_header(skb) - skb->data + vlan_off) / 2;
10341 10344
10342 /* for now NS flag is not used in Linux */ 10345 /* for now NS flag is not used in Linux */
10343 pbd->global_data = (hlen | 10346 pbd->global_data =
10344 ((skb->protocol == ntohs(ETH_P_8021Q)) << 10347 (hlen | ((skb->protocol == cpu_to_be16(ETH_P_8021Q)) <<
10345 ETH_TX_PARSE_BD_LLC_SNAP_EN_SHIFT)); 10348 ETH_TX_PARSE_BD_LLC_SNAP_EN_SHIFT));
10346 10349
10347 pbd->ip_hlen = (skb_transport_header(skb) - 10350 pbd->ip_hlen = (skb_transport_header(skb) -
10348 skb_network_header(skb)) / 2; 10351 skb_network_header(skb)) / 2;
@@ -10486,11 +10489,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
10486 */ 10489 */
10487 wmb(); 10490 wmb();
10488 10491
10489 fp->hw_tx_prods->bds_prod = 10492 le16_add_cpu(&fp->hw_tx_prods->bds_prod, nbd);
10490 cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd);
10491 mb(); /* FW restriction: must not reorder writing nbd and packets */ 10493 mb(); /* FW restriction: must not reorder writing nbd and packets */
10492 fp->hw_tx_prods->packets_prod = 10494 le32_add_cpu(&fp->hw_tx_prods->packets_prod, 1);
10493 cpu_to_le32(le32_to_cpu(fp->hw_tx_prods->packets_prod) + 1);
10494 DOORBELL(bp, fp->index, 0); 10495 DOORBELL(bp, fp->index, 0);
10495 10496
10496 mmiowb(); 10497 mmiowb();