aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c42
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h26
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h6
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c148
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c80
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h17
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c20
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h11
9 files changed, 195 insertions, 159 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a4611386afeb..ecac04a3687c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3128,17 +3128,21 @@ static noinline u16 bnx2x_tx_split(struct bnx2x *bp,
3128 return bd_prod; 3128 return bd_prod;
3129} 3129}
3130 3130
3131static inline u16 bnx2x_csum_fix(unsigned char *t_header, u16 csum, s8 fix) 3131#define bswab32(b32) ((__force __le32) swab32((__force __u32) (b32)))
3132#define bswab16(b16) ((__force __le16) swab16((__force __u16) (b16)))
3133static inline __le16 bnx2x_csum_fix(unsigned char *t_header, u16 csum, s8 fix)
3132{ 3134{
3135 __sum16 tsum = (__force __sum16) csum;
3136
3133 if (fix > 0) 3137 if (fix > 0)
3134 csum = (u16) ~csum_fold(csum_sub(csum, 3138 tsum = ~csum_fold(csum_sub((__force __wsum) csum,
3135 csum_partial(t_header - fix, fix, 0))); 3139 csum_partial(t_header - fix, fix, 0)));
3136 3140
3137 else if (fix < 0) 3141 else if (fix < 0)
3138 csum = (u16) ~csum_fold(csum_add(csum, 3142 tsum = ~csum_fold(csum_add((__force __wsum) csum,
3139 csum_partial(t_header, -fix, 0))); 3143 csum_partial(t_header, -fix, 0)));
3140 3144
3141 return swab16(csum); 3145 return bswab16(csum);
3142} 3146}
3143 3147
3144static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb) 3148static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
@@ -3272,23 +3276,24 @@ static inline void bnx2x_set_pbd_gso(struct sk_buff *skb,
3272 u32 xmit_type) 3276 u32 xmit_type)
3273{ 3277{
3274 pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 3278 pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
3275 pbd->tcp_send_seq = swab32(tcp_hdr(skb)->seq); 3279 pbd->tcp_send_seq = bswab32(tcp_hdr(skb)->seq);
3276 pbd->tcp_flags = pbd_tcp_flags(skb); 3280 pbd->tcp_flags = pbd_tcp_flags(skb);
3277 3281
3278 if (xmit_type & XMIT_GSO_V4) { 3282 if (xmit_type & XMIT_GSO_V4) {
3279 pbd->ip_id = swab16(ip_hdr(skb)->id); 3283 pbd->ip_id = bswab16(ip_hdr(skb)->id);
3280 pbd->tcp_pseudo_csum = 3284 pbd->tcp_pseudo_csum =
3281 swab16(~csum_tcpudp_magic(ip_hdr(skb)->saddr, 3285 bswab16(~csum_tcpudp_magic(ip_hdr(skb)->saddr,
3282 ip_hdr(skb)->daddr, 3286 ip_hdr(skb)->daddr,
3283 0, IPPROTO_TCP, 0)); 3287 0, IPPROTO_TCP, 0));
3284 3288
3285 } else 3289 } else
3286 pbd->tcp_pseudo_csum = 3290 pbd->tcp_pseudo_csum =
3287 swab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, 3291 bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
3288 &ipv6_hdr(skb)->daddr, 3292 &ipv6_hdr(skb)->daddr,
3289 0, IPPROTO_TCP, 0)); 3293 0, IPPROTO_TCP, 0));
3290 3294
3291 pbd->global_data |= ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN; 3295 pbd->global_data |=
3296 cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN);
3292} 3297}
3293 3298
3294/** 3299/**
@@ -3354,8 +3359,9 @@ static inline u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
3354 3359
3355 /* for now NS flag is not used in Linux */ 3360 /* for now NS flag is not used in Linux */
3356 pbd->global_data = 3361 pbd->global_data =
3357 (hlen | ((skb->protocol == cpu_to_be16(ETH_P_8021Q)) << 3362 cpu_to_le16(hlen |
3358 ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT)); 3363 ((skb->protocol == cpu_to_be16(ETH_P_8021Q)) <<
3364 ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT));
3359 3365
3360 pbd->ip_hlen_w = (skb_transport_header(skb) - 3366 pbd->ip_hlen_w = (skb_transport_header(skb) -
3361 skb_network_header(skb)) >> 1; 3367 skb_network_header(skb)) >> 1;
@@ -3372,7 +3378,7 @@ static inline u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
3372 hlen = hlen*2; 3378 hlen = hlen*2;
3373 3379
3374 if (xmit_type & XMIT_CSUM_TCP) { 3380 if (xmit_type & XMIT_CSUM_TCP) {
3375 pbd->tcp_pseudo_csum = swab16(tcp_hdr(skb)->check); 3381 pbd->tcp_pseudo_csum = bswab16(tcp_hdr(skb)->check);
3376 3382
3377 } else { 3383 } else {
3378 s8 fix = SKB_CS_OFF(skb); /* signed! */ 3384 s8 fix = SKB_CS_OFF(skb); /* signed! */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 9b6e27acb54c..4635c025bc2d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -983,8 +983,8 @@ static inline int bnx2x_func_start(struct bnx2x *bp)
983 * @fw_lo: pointer to lower part 983 * @fw_lo: pointer to lower part
984 * @mac: pointer to MAC address 984 * @mac: pointer to MAC address
985 */ 985 */
986static inline void bnx2x_set_fw_mac_addr(u16 *fw_hi, u16 *fw_mid, u16 *fw_lo, 986static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,
987 u8 *mac) 987 __le16 *fw_lo, u8 *mac)
988{ 988{
989 ((u8 *)fw_hi)[0] = mac[1]; 989 ((u8 *)fw_hi)[0] = mac[1];
990 ((u8 *)fw_hi)[1] = mac[0]; 990 ((u8 *)fw_hi)[1] = mac[0];
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 76e30c9a2955..037860ecc343 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
@@ -3378,6 +3378,10 @@ struct regpair {
3378 __le32 hi; 3378 __le32 hi;
3379}; 3379};
3380 3380
3381struct regpair_native {
3382 u32 lo;
3383 u32 hi;
3384};
3381 3385
3382/* 3386/*
3383 * Classify rule opcodes in E2/E3 3387 * Classify rule opcodes in E2/E3
@@ -4404,13 +4408,13 @@ struct tstorm_eth_function_common_config {
4404 * MAC filtering configuration parameters per port in Tstorm 4408 * MAC filtering configuration parameters per port in Tstorm
4405 */ 4409 */
4406struct tstorm_eth_mac_filter_config { 4410struct tstorm_eth_mac_filter_config {
4407 __le32 ucast_drop_all; 4411 u32 ucast_drop_all;
4408 __le32 ucast_accept_all; 4412 u32 ucast_accept_all;
4409 __le32 mcast_drop_all; 4413 u32 mcast_drop_all;
4410 __le32 mcast_accept_all; 4414 u32 mcast_accept_all;
4411 __le32 bcast_accept_all; 4415 u32 bcast_accept_all;
4412 __le32 vlan_filter[2]; 4416 u32 vlan_filter[2];
4413 __le32 unmatched_unicast; 4417 u32 unmatched_unicast;
4414}; 4418};
4415 4419
4416 4420
@@ -4902,7 +4906,7 @@ union event_data {
4902 * per PF event ring data 4906 * per PF event ring data
4903 */ 4907 */
4904struct event_ring_data { 4908struct event_ring_data {
4905 struct regpair base_addr; 4909 struct regpair_native base_addr;
4906#if defined(__BIG_ENDIAN) 4910#if defined(__BIG_ENDIAN)
4907 u8 index_id; 4911 u8 index_id;
4908 u8 sb_id; 4912 u8 sb_id;
@@ -5135,7 +5139,7 @@ struct pci_entity {
5135 * The fast-path status block meta-data, common to all chips 5139 * The fast-path status block meta-data, common to all chips
5136 */ 5140 */
5137struct hc_sb_data { 5141struct hc_sb_data {
5138 struct regpair host_sb_addr; 5142 struct regpair_native host_sb_addr;
5139 struct hc_status_block_sm state_machine[HC_SB_MAX_SM]; 5143 struct hc_status_block_sm state_machine[HC_SB_MAX_SM];
5140 struct pci_entity p_func; 5144 struct pci_entity p_func;
5141#if defined(__BIG_ENDIAN) 5145#if defined(__BIG_ENDIAN)
@@ -5149,7 +5153,7 @@ struct hc_sb_data {
5149 u8 state; 5153 u8 state;
5150 u8 rsrv0; 5154 u8 rsrv0;
5151#endif 5155#endif
5152 struct regpair rsrv1[2]; 5156 struct regpair_native rsrv1[2];
5153}; 5157};
5154 5158
5155 5159
@@ -5167,7 +5171,7 @@ enum hc_segment {
5167 * The fast-path status block meta-data 5171 * The fast-path status block meta-data
5168 */ 5172 */
5169struct hc_sp_status_block_data { 5173struct hc_sp_status_block_data {
5170 struct regpair host_sb_addr; 5174 struct regpair_native host_sb_addr;
5171#if defined(__BIG_ENDIAN) 5175#if defined(__BIG_ENDIAN)
5172 u8 rsrv1; 5176 u8 rsrv1;
5173 u8 state; 5177 u8 state;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
index ae9b6ff30e39..8ab0dd900960 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_init_ops.h
@@ -218,7 +218,7 @@ static void bnx2x_init_wr_zp(struct bnx2x *bp, u32 addr, u32 len,
218 /* gunzip_outlen is in dwords */ 218 /* gunzip_outlen is in dwords */
219 len = GUNZIP_OUTLEN(bp); 219 len = GUNZIP_OUTLEN(bp);
220 for (i = 0; i < len; i++) 220 for (i = 0; i < len; i++)
221 ((u32 *)GUNZIP_BUF(bp))[i] = 221 ((u32 *)GUNZIP_BUF(bp))[i] = (__force u32)
222 cpu_to_le32(((u32 *)GUNZIP_BUF(bp))[i]); 222 cpu_to_le32(((u32 *)GUNZIP_BUF(bp))[i]);
223 223
224 bnx2x_write_big_buf_wb(bp, addr, len); 224 bnx2x_write_big_buf_wb(bp, addr, len);
@@ -232,7 +232,7 @@ static void bnx2x_init_block(struct bnx2x *bp, u32 block, u32 stage)
232 u16 op_end = 232 u16 op_end =
233 INIT_OPS_OFFSETS(bp)[BLOCK_OPS_IDX(block, stage, 233 INIT_OPS_OFFSETS(bp)[BLOCK_OPS_IDX(block, stage,
234 STAGE_END)]; 234 STAGE_END)];
235 union init_op *op; 235 const union init_op *op;
236 u32 op_idx, op_type, addr, len; 236 u32 op_idx, op_type, addr, len;
237 const u32 *data, *data_base; 237 const u32 *data, *data_base;
238 238
@@ -244,7 +244,7 @@ static void bnx2x_init_block(struct bnx2x *bp, u32 block, u32 stage)
244 244
245 for (op_idx = op_start; op_idx < op_end; op_idx++) { 245 for (op_idx = op_start; op_idx < op_end; op_idx++) {
246 246
247 op = (union init_op *)&(INIT_OPS(bp)[op_idx]); 247 op = (const union init_op *)&(INIT_OPS(bp)[op_idx]);
248 /* Get generic data */ 248 /* Get generic data */
249 op_type = op->raw.op; 249 op_type = op->raw.op;
250 addr = op->raw.offset; 250 addr = op->raw.offset;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index c9effad3c362..f511c3cb4872 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -1310,7 +1310,7 @@ void bnx2x_tx_hw_flushed(struct bnx2x *bp, u32 poll_count)
1310 1310
1311int bnx2x_send_final_clnup(struct bnx2x *bp, u8 clnup_func, u32 poll_cnt) 1311int bnx2x_send_final_clnup(struct bnx2x *bp, u8 clnup_func, u32 poll_cnt)
1312{ 1312{
1313 struct sdm_op_gen op_gen = {0}; 1313 u32 op_gen_command = 0;
1314 1314
1315 u32 comp_addr = BAR_CSTRORM_INTMEM + 1315 u32 comp_addr = BAR_CSTRORM_INTMEM +
1316 CSTORM_FINAL_CLEANUP_COMPLETE_OFFSET(clnup_func); 1316 CSTORM_FINAL_CLEANUP_COMPLETE_OFFSET(clnup_func);
@@ -1321,13 +1321,13 @@ int bnx2x_send_final_clnup(struct bnx2x *bp, u8 clnup_func, u32 poll_cnt)
1321 return 1; 1321 return 1;
1322 } 1322 }
1323 1323
1324 op_gen.command |= OP_GEN_PARAM(XSTORM_AGG_INT_FINAL_CLEANUP_INDEX); 1324 op_gen_command |= OP_GEN_PARAM(XSTORM_AGG_INT_FINAL_CLEANUP_INDEX);
1325 op_gen.command |= OP_GEN_TYPE(XSTORM_AGG_INT_FINAL_CLEANUP_COMP_TYPE); 1325 op_gen_command |= OP_GEN_TYPE(XSTORM_AGG_INT_FINAL_CLEANUP_COMP_TYPE);
1326 op_gen.command |= OP_GEN_AGG_VECT(clnup_func); 1326 op_gen_command |= OP_GEN_AGG_VECT(clnup_func);
1327 op_gen.command |= 1 << SDM_OP_GEN_AGG_VECT_IDX_VALID_SHIFT; 1327 op_gen_command |= 1 << SDM_OP_GEN_AGG_VECT_IDX_VALID_SHIFT;
1328 1328
1329 DP(BNX2X_MSG_SP, "sending FW Final cleanup\n"); 1329 DP(BNX2X_MSG_SP, "sending FW Final cleanup\n");
1330 REG_WR(bp, XSDM_REG_OPERATION_GEN, op_gen.command); 1330 REG_WR(bp, XSDM_REG_OPERATION_GEN, op_gen_command);
1331 1331
1332 if (bnx2x_flr_clnup_reg_poll(bp, comp_addr, 1, poll_cnt) != 1) { 1332 if (bnx2x_flr_clnup_reg_poll(bp, comp_addr, 1, poll_cnt) != 1) {
1333 BNX2X_ERR("FW final cleanup did not succeed\n"); 1333 BNX2X_ERR("FW final cleanup did not succeed\n");
@@ -2641,7 +2641,7 @@ void bnx2x__link_status_update(struct bnx2x *bp)
2641static int bnx2x_afex_func_update(struct bnx2x *bp, u16 vifid, 2641static int bnx2x_afex_func_update(struct bnx2x *bp, u16 vifid,
2642 u16 vlan_val, u8 allowed_prio) 2642 u16 vlan_val, u8 allowed_prio)
2643{ 2643{
2644 struct bnx2x_func_state_params func_params = {0}; 2644 struct bnx2x_func_state_params func_params = {NULL};
2645 struct bnx2x_func_afex_update_params *f_update_params = 2645 struct bnx2x_func_afex_update_params *f_update_params =
2646 &func_params.params.afex_update; 2646 &func_params.params.afex_update;
2647 2647
@@ -2666,7 +2666,7 @@ static int bnx2x_afex_func_update(struct bnx2x *bp, u16 vifid,
2666static int bnx2x_afex_handle_vif_list_cmd(struct bnx2x *bp, u8 cmd_type, 2666static int bnx2x_afex_handle_vif_list_cmd(struct bnx2x *bp, u8 cmd_type,
2667 u16 vif_index, u8 func_bit_map) 2667 u16 vif_index, u8 func_bit_map)
2668{ 2668{
2669 struct bnx2x_func_state_params func_params = {0}; 2669 struct bnx2x_func_state_params func_params = {NULL};
2670 struct bnx2x_func_afex_viflists_params *update_params = 2670 struct bnx2x_func_afex_viflists_params *update_params =
2671 &func_params.params.afex_viflists; 2671 &func_params.params.afex_viflists;
2672 int rc; 2672 int rc;
@@ -2682,7 +2682,7 @@ static int bnx2x_afex_handle_vif_list_cmd(struct bnx2x *bp, u8 cmd_type,
2682 2682
2683 /* set parameters according to cmd_type */ 2683 /* set parameters according to cmd_type */
2684 update_params->afex_vif_list_command = cmd_type; 2684 update_params->afex_vif_list_command = cmd_type;
2685 update_params->vif_list_index = cpu_to_le16(vif_index); 2685 update_params->vif_list_index = vif_index;
2686 update_params->func_bit_map = 2686 update_params->func_bit_map =
2687 (cmd_type == VIF_LIST_RULE_GET) ? 0 : func_bit_map; 2687 (cmd_type == VIF_LIST_RULE_GET) ? 0 : func_bit_map;
2688 update_params->func_to_clear = 0; 2688 update_params->func_to_clear = 0;
@@ -3189,7 +3189,7 @@ static void bnx2x_pf_init(struct bnx2x *bp)
3189 if (bp->port.pmf) 3189 if (bp->port.pmf)
3190 storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); 3190 storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp));
3191 3191
3192 /* init Event Queue */ 3192 /* init Event Queue - PCI bus guarantees correct endianity*/
3193 eq_data.base_addr.hi = U64_HI(bp->eq_mapping); 3193 eq_data.base_addr.hi = U64_HI(bp->eq_mapping);
3194 eq_data.base_addr.lo = U64_LO(bp->eq_mapping); 3194 eq_data.base_addr.lo = U64_LO(bp->eq_mapping);
3195 eq_data.producer = bp->eq_prod; 3195 eq_data.producer = bp->eq_prod;
@@ -3279,65 +3279,75 @@ static void bnx2x_drv_info_fcoe_stat(struct bnx2x *bp)
3279 struct fcoe_statistics_params *fw_fcoe_stat = 3279 struct fcoe_statistics_params *fw_fcoe_stat =
3280 &bp->fw_stats_data->fcoe; 3280 &bp->fw_stats_data->fcoe;
3281 3281
3282 ADD_64(fcoe_stat->rx_bytes_hi, 0, fcoe_stat->rx_bytes_lo, 3282 ADD_64_LE(fcoe_stat->rx_bytes_hi, LE32_0,
3283 fw_fcoe_stat->rx_stat0.fcoe_rx_byte_cnt); 3283 fcoe_stat->rx_bytes_lo,
3284 fw_fcoe_stat->rx_stat0.fcoe_rx_byte_cnt);
3284 3285
3285 ADD_64(fcoe_stat->rx_bytes_hi, 3286 ADD_64_LE(fcoe_stat->rx_bytes_hi,
3286 fcoe_q_tstorm_stats->rcv_ucast_bytes.hi, 3287 fcoe_q_tstorm_stats->rcv_ucast_bytes.hi,
3287 fcoe_stat->rx_bytes_lo, 3288 fcoe_stat->rx_bytes_lo,
3288 fcoe_q_tstorm_stats->rcv_ucast_bytes.lo); 3289 fcoe_q_tstorm_stats->rcv_ucast_bytes.lo);
3289 3290
3290 ADD_64(fcoe_stat->rx_bytes_hi, 3291 ADD_64_LE(fcoe_stat->rx_bytes_hi,
3291 fcoe_q_tstorm_stats->rcv_bcast_bytes.hi, 3292 fcoe_q_tstorm_stats->rcv_bcast_bytes.hi,
3292 fcoe_stat->rx_bytes_lo, 3293 fcoe_stat->rx_bytes_lo,
3293 fcoe_q_tstorm_stats->rcv_bcast_bytes.lo); 3294 fcoe_q_tstorm_stats->rcv_bcast_bytes.lo);
3294 3295
3295 ADD_64(fcoe_stat->rx_bytes_hi, 3296 ADD_64_LE(fcoe_stat->rx_bytes_hi,
3296 fcoe_q_tstorm_stats->rcv_mcast_bytes.hi, 3297 fcoe_q_tstorm_stats->rcv_mcast_bytes.hi,
3297 fcoe_stat->rx_bytes_lo, 3298 fcoe_stat->rx_bytes_lo,
3298 fcoe_q_tstorm_stats->rcv_mcast_bytes.lo); 3299 fcoe_q_tstorm_stats->rcv_mcast_bytes.lo);
3299 3300
3300 ADD_64(fcoe_stat->rx_frames_hi, 0, fcoe_stat->rx_frames_lo, 3301 ADD_64_LE(fcoe_stat->rx_frames_hi, LE32_0,
3301 fw_fcoe_stat->rx_stat0.fcoe_rx_pkt_cnt); 3302 fcoe_stat->rx_frames_lo,
3303 fw_fcoe_stat->rx_stat0.fcoe_rx_pkt_cnt);
3302 3304
3303 ADD_64(fcoe_stat->rx_frames_hi, 0, fcoe_stat->rx_frames_lo, 3305 ADD_64_LE(fcoe_stat->rx_frames_hi, LE32_0,
3304 fcoe_q_tstorm_stats->rcv_ucast_pkts); 3306 fcoe_stat->rx_frames_lo,
3307 fcoe_q_tstorm_stats->rcv_ucast_pkts);
3305 3308
3306 ADD_64(fcoe_stat->rx_frames_hi, 0, fcoe_stat->rx_frames_lo, 3309 ADD_64_LE(fcoe_stat->rx_frames_hi, LE32_0,
3307 fcoe_q_tstorm_stats->rcv_bcast_pkts); 3310 fcoe_stat->rx_frames_lo,
3311 fcoe_q_tstorm_stats->rcv_bcast_pkts);
3308 3312
3309 ADD_64(fcoe_stat->rx_frames_hi, 0, fcoe_stat->rx_frames_lo, 3313 ADD_64_LE(fcoe_stat->rx_frames_hi, LE32_0,
3310 fcoe_q_tstorm_stats->rcv_mcast_pkts); 3314 fcoe_stat->rx_frames_lo,
3315 fcoe_q_tstorm_stats->rcv_mcast_pkts);
3311 3316
3312 ADD_64(fcoe_stat->tx_bytes_hi, 0, fcoe_stat->tx_bytes_lo, 3317 ADD_64_LE(fcoe_stat->tx_bytes_hi, LE32_0,
3313 fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt); 3318 fcoe_stat->tx_bytes_lo,
3319 fw_fcoe_stat->tx_stat.fcoe_tx_byte_cnt);
3314 3320
3315 ADD_64(fcoe_stat->tx_bytes_hi, 3321 ADD_64_LE(fcoe_stat->tx_bytes_hi,
3316 fcoe_q_xstorm_stats->ucast_bytes_sent.hi, 3322 fcoe_q_xstorm_stats->ucast_bytes_sent.hi,
3317 fcoe_stat->tx_bytes_lo, 3323 fcoe_stat->tx_bytes_lo,
3318 fcoe_q_xstorm_stats->ucast_bytes_sent.lo); 3324 fcoe_q_xstorm_stats->ucast_bytes_sent.lo);
3319 3325
3320 ADD_64(fcoe_stat->tx_bytes_hi, 3326 ADD_64_LE(fcoe_stat->tx_bytes_hi,
3321 fcoe_q_xstorm_stats->bcast_bytes_sent.hi, 3327 fcoe_q_xstorm_stats->bcast_bytes_sent.hi,
3322 fcoe_stat->tx_bytes_lo, 3328 fcoe_stat->tx_bytes_lo,
3323 fcoe_q_xstorm_stats->bcast_bytes_sent.lo); 3329 fcoe_q_xstorm_stats->bcast_bytes_sent.lo);
3324 3330
3325 ADD_64(fcoe_stat->tx_bytes_hi, 3331 ADD_64_LE(fcoe_stat->tx_bytes_hi,
3326 fcoe_q_xstorm_stats->mcast_bytes_sent.hi, 3332 fcoe_q_xstorm_stats->mcast_bytes_sent.hi,
3327 fcoe_stat->tx_bytes_lo, 3333 fcoe_stat->tx_bytes_lo,
3328 fcoe_q_xstorm_stats->mcast_bytes_sent.lo); 3334 fcoe_q_xstorm_stats->mcast_bytes_sent.lo);
3329 3335
3330 ADD_64(fcoe_stat->tx_frames_hi, 0, fcoe_stat->tx_frames_lo, 3336 ADD_64_LE(fcoe_stat->tx_frames_hi, LE32_0,
3331 fw_fcoe_stat->tx_stat.fcoe_tx_pkt_cnt); 3337 fcoe_stat->tx_frames_lo,
3338 fw_fcoe_stat->tx_stat.fcoe_tx_pkt_cnt);
3332 3339
3333 ADD_64(fcoe_stat->tx_frames_hi, 0, fcoe_stat->tx_frames_lo, 3340 ADD_64_LE(fcoe_stat->tx_frames_hi, LE32_0,
3334 fcoe_q_xstorm_stats->ucast_pkts_sent); 3341 fcoe_stat->tx_frames_lo,
3342 fcoe_q_xstorm_stats->ucast_pkts_sent);
3335 3343
3336 ADD_64(fcoe_stat->tx_frames_hi, 0, fcoe_stat->tx_frames_lo, 3344 ADD_64_LE(fcoe_stat->tx_frames_hi, LE32_0,
3337 fcoe_q_xstorm_stats->bcast_pkts_sent); 3345 fcoe_stat->tx_frames_lo,
3346 fcoe_q_xstorm_stats->bcast_pkts_sent);
3338 3347
3339 ADD_64(fcoe_stat->tx_frames_hi, 0, fcoe_stat->tx_frames_lo, 3348 ADD_64_LE(fcoe_stat->tx_frames_hi, LE32_0,
3340 fcoe_q_xstorm_stats->mcast_pkts_sent); 3349 fcoe_stat->tx_frames_lo,
3350 fcoe_q_xstorm_stats->mcast_pkts_sent);
3341 } 3351 }
3342 3352
3343 /* ask L5 driver to add data to the struct */ 3353 /* ask L5 driver to add data to the struct */
@@ -4829,7 +4839,8 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp,
4829 /* Always push next commands out, don't wait here */ 4839 /* Always push next commands out, don't wait here */
4830 __set_bit(RAMROD_CONT, &ramrod_flags); 4840 __set_bit(RAMROD_CONT, &ramrod_flags);
4831 4841
4832 switch (elem->message.data.eth_event.echo >> BNX2X_SWCID_SHIFT) { 4842 switch (le32_to_cpu((__force __le32)elem->message.data.eth_event.echo)
4843 >> BNX2X_SWCID_SHIFT) {
4833 case BNX2X_FILTER_MAC_PENDING: 4844 case BNX2X_FILTER_MAC_PENDING:
4834 DP(BNX2X_MSG_SP, "Got SETUP_MAC completions\n"); 4845 DP(BNX2X_MSG_SP, "Got SETUP_MAC completions\n");
4835 if (CNIC_LOADED(bp) && (cid == BNX2X_ISCSI_ETH_CID(bp))) 4846 if (CNIC_LOADED(bp) && (cid == BNX2X_ISCSI_ETH_CID(bp)))
@@ -5016,9 +5027,11 @@ static void bnx2x_eq_int(struct bnx2x *bp)
5016 rc); 5027 rc);
5017 goto next_spqe; 5028 goto next_spqe;
5018 } 5029 }
5019 cid = SW_CID(elem->message.data.cfc_del_event.cid);
5020 opcode = elem->message.opcode;
5021 5030
5031 /* elem CID originates from FW; actually LE */
5032 cid = SW_CID((__force __le32)
5033 elem->message.data.cfc_del_event.cid);
5034 opcode = elem->message.opcode;
5022 5035
5023 /* handle eq element */ 5036 /* handle eq element */
5024 switch (opcode) { 5037 switch (opcode) {
@@ -5537,7 +5550,7 @@ void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid,
5537 5550
5538 DP(NETIF_MSG_IFUP, "Init FW SB %d\n", fw_sb_id); 5551 DP(NETIF_MSG_IFUP, "Init FW SB %d\n", fw_sb_id);
5539 5552
5540 /* write indecies to HW */ 5553 /* write indices to HW - PCI guarantees endianity of regpairs */
5541 bnx2x_wr_fp_sb_data(bp, fw_sb_id, sb_data_p, data_size); 5554 bnx2x_wr_fp_sb_data(bp, fw_sb_id, sb_data_p, data_size);
5542} 5555}
5543 5556
@@ -5625,6 +5638,7 @@ static void bnx2x_init_def_sb(struct bnx2x *bp)
5625 5638
5626 bnx2x_zero_sp_sb(bp); 5639 bnx2x_zero_sp_sb(bp);
5627 5640
5641 /* PCI guarantees endianity of regpairs */
5628 sp_sb_data.state = SB_ENABLED; 5642 sp_sb_data.state = SB_ENABLED;
5629 sp_sb_data.host_sb_addr.lo = U64_LO(section); 5643 sp_sb_data.host_sb_addr.lo = U64_LO(section);
5630 sp_sb_data.host_sb_addr.hi = U64_HI(section); 5644 sp_sb_data.host_sb_addr.hi = U64_HI(section);
@@ -5722,9 +5736,9 @@ int bnx2x_set_q_rx_mode(struct bnx2x *bp, u8 cl_id,
5722 return 0; 5736 return 0;
5723} 5737}
5724 5738
5725int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode, 5739static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode,
5726 unsigned long *rx_accept_flags, 5740 unsigned long *rx_accept_flags,
5727 unsigned long *tx_accept_flags) 5741 unsigned long *tx_accept_flags)
5728{ 5742{
5729 /* Clear the flags first */ 5743 /* Clear the flags first */
5730 *rx_accept_flags = 0; 5744 *rx_accept_flags = 0;
@@ -10541,10 +10555,10 @@ static void bnx2x_link_settings_requested(struct bnx2x *bp)
10541 10555
10542static void bnx2x_set_mac_buf(u8 *mac_buf, u32 mac_lo, u16 mac_hi) 10556static void bnx2x_set_mac_buf(u8 *mac_buf, u32 mac_lo, u16 mac_hi)
10543{ 10557{
10544 mac_hi = cpu_to_be16(mac_hi); 10558 __be16 mac_hi_be = cpu_to_be16(mac_hi);
10545 mac_lo = cpu_to_be32(mac_lo); 10559 __be32 mac_lo_be = cpu_to_be32(mac_lo);
10546 memcpy(mac_buf, &mac_hi, sizeof(mac_hi)); 10560 memcpy(mac_buf, &mac_hi_be, sizeof(mac_hi_be));
10547 memcpy(mac_buf + sizeof(mac_hi), &mac_lo, sizeof(mac_lo)); 10561 memcpy(mac_buf + sizeof(mac_hi_be), &mac_lo_be, sizeof(mac_lo_be));
10548} 10562}
10549 10563
10550static void bnx2x_get_port_hwinfo(struct bnx2x *bp) 10564static void bnx2x_get_port_hwinfo(struct bnx2x *bp)
@@ -12005,7 +12019,7 @@ static int bnx2x_check_firmware(struct bnx2x *bp)
12005 struct bnx2x_fw_file_hdr *fw_hdr; 12019 struct bnx2x_fw_file_hdr *fw_hdr;
12006 struct bnx2x_fw_file_section *sections; 12020 struct bnx2x_fw_file_section *sections;
12007 u32 offset, len, num_ops; 12021 u32 offset, len, num_ops;
12008 u16 *ops_offsets; 12022 __be16 *ops_offsets;
12009 int i; 12023 int i;
12010 const u8 *fw_ver; 12024 const u8 *fw_ver;
12011 12025
@@ -12030,7 +12044,7 @@ static int bnx2x_check_firmware(struct bnx2x *bp)
12030 12044
12031 /* Likewise for the init_ops offsets */ 12045 /* Likewise for the init_ops offsets */
12032 offset = be32_to_cpu(fw_hdr->init_ops_offsets.offset); 12046 offset = be32_to_cpu(fw_hdr->init_ops_offsets.offset);
12033 ops_offsets = (u16 *)(firmware->data + offset); 12047 ops_offsets = (__force __be16 *)(firmware->data + offset);
12034 num_ops = be32_to_cpu(fw_hdr->init_ops.len) / sizeof(struct raw_op); 12048 num_ops = be32_to_cpu(fw_hdr->init_ops.len) / sizeof(struct raw_op);
12035 12049
12036 for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) { 12050 for (i = 0; i < be32_to_cpu(fw_hdr->init_ops_offsets.len) / 2; i++) {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 7d6d601a8420..7306416bc90d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -707,7 +707,8 @@ static inline void bnx2x_vlan_mac_set_cmd_hdr_e2(struct bnx2x *bp,
707static inline void bnx2x_vlan_mac_set_rdata_hdr_e2(u32 cid, int type, 707static inline void bnx2x_vlan_mac_set_rdata_hdr_e2(u32 cid, int type,
708 struct eth_classify_header *hdr, int rule_cnt) 708 struct eth_classify_header *hdr, int rule_cnt)
709{ 709{
710 hdr->echo = (cid & BNX2X_SWCID_MASK) | (type << BNX2X_SWCID_SHIFT); 710 hdr->echo = cpu_to_le32((cid & BNX2X_SWCID_MASK) |
711 (type << BNX2X_SWCID_SHIFT));
711 hdr->rule_cnt = (u8)rule_cnt; 712 hdr->rule_cnt = (u8)rule_cnt;
712} 713}
713 714
@@ -813,8 +814,9 @@ static inline void bnx2x_vlan_mac_set_rdata_hdr_e1x(struct bnx2x *bp,
813 814
814 hdr->length = 1; 815 hdr->length = 1;
815 hdr->offset = (u8)cam_offset; 816 hdr->offset = (u8)cam_offset;
816 hdr->client_id = 0xff; 817 hdr->client_id = cpu_to_le16(0xff);
817 hdr->echo = ((r->cid & BNX2X_SWCID_MASK) | (type << BNX2X_SWCID_SHIFT)); 818 hdr->echo = cpu_to_le32((r->cid & BNX2X_SWCID_MASK) |
819 (type << BNX2X_SWCID_SHIFT));
818} 820}
819 821
820static inline void bnx2x_vlan_mac_set_cfg_entry_e1x(struct bnx2x *bp, 822static inline void bnx2x_vlan_mac_set_cfg_entry_e1x(struct bnx2x *bp,
@@ -903,7 +905,7 @@ static void bnx2x_set_one_vlan_e2(struct bnx2x *bp,
903 (struct eth_classify_rules_ramrod_data *)(raw->rdata); 905 (struct eth_classify_rules_ramrod_data *)(raw->rdata);
904 int rule_cnt = rule_idx + 1; 906 int rule_cnt = rule_idx + 1;
905 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; 907 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
906 int cmd = elem->cmd_data.vlan_mac.cmd; 908 enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
907 bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false; 909 bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
908 u16 vlan = elem->cmd_data.vlan_mac.u.vlan.vlan; 910 u16 vlan = elem->cmd_data.vlan_mac.u.vlan.vlan;
909 911
@@ -953,7 +955,7 @@ static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp,
953 (struct eth_classify_rules_ramrod_data *)(raw->rdata); 955 (struct eth_classify_rules_ramrod_data *)(raw->rdata);
954 int rule_cnt = rule_idx + 1; 956 int rule_cnt = rule_idx + 1;
955 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx]; 957 union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
956 int cmd = elem->cmd_data.vlan_mac.cmd; 958 enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
957 bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false; 959 bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
958 u16 vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan; 960 u16 vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan;
959 u8 *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac; 961 u8 *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac;
@@ -1532,7 +1534,7 @@ static inline int bnx2x_vlan_mac_get_registry_elem(
1532 bool restore, 1534 bool restore,
1533 struct bnx2x_vlan_mac_registry_elem **re) 1535 struct bnx2x_vlan_mac_registry_elem **re)
1534{ 1536{
1535 int cmd = elem->cmd_data.vlan_mac.cmd; 1537 enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
1536 struct bnx2x_vlan_mac_registry_elem *reg_elem; 1538 struct bnx2x_vlan_mac_registry_elem *reg_elem;
1537 1539
1538 /* Allocate a new registry element if needed. */ 1540 /* Allocate a new registry element if needed. */
@@ -1591,7 +1593,7 @@ static int bnx2x_execute_vlan_mac(struct bnx2x *bp,
1591 bool restore = test_bit(RAMROD_RESTORE, ramrod_flags); 1593 bool restore = test_bit(RAMROD_RESTORE, ramrod_flags);
1592 bool drv_only = test_bit(RAMROD_DRV_CLR_ONLY, ramrod_flags); 1594 bool drv_only = test_bit(RAMROD_DRV_CLR_ONLY, ramrod_flags);
1593 struct bnx2x_vlan_mac_registry_elem *reg_elem; 1595 struct bnx2x_vlan_mac_registry_elem *reg_elem;
1594 int cmd; 1596 enum bnx2x_vlan_mac_cmd cmd;
1595 1597
1596 /* 1598 /*
1597 * If DRIVER_ONLY execution is requested, cleanup a registry 1599 * If DRIVER_ONLY execution is requested, cleanup a registry
@@ -2186,7 +2188,7 @@ static inline void bnx2x_rx_mode_set_rdata_hdr_e2(u32 cid,
2186 struct eth_classify_header *hdr, 2188 struct eth_classify_header *hdr,
2187 u8 rule_cnt) 2189 u8 rule_cnt)
2188{ 2190{
2189 hdr->echo = cid; 2191 hdr->echo = cpu_to_le32(cid);
2190 hdr->rule_cnt = rule_cnt; 2192 hdr->rule_cnt = rule_cnt;
2191} 2193}
2192 2194
@@ -2433,7 +2435,7 @@ static int bnx2x_mcast_wait(struct bnx2x *bp,
2433static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp, 2435static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp,
2434 struct bnx2x_mcast_obj *o, 2436 struct bnx2x_mcast_obj *o,
2435 struct bnx2x_mcast_ramrod_params *p, 2437 struct bnx2x_mcast_ramrod_params *p,
2436 int cmd) 2438 enum bnx2x_mcast_cmd cmd)
2437{ 2439{
2438 int total_sz; 2440 int total_sz;
2439 struct bnx2x_pending_mcast_cmd *new_cmd; 2441 struct bnx2x_pending_mcast_cmd *new_cmd;
@@ -2565,7 +2567,7 @@ static inline u8 bnx2x_mcast_get_rx_tx_flag(struct bnx2x_mcast_obj *o)
2565static void bnx2x_mcast_set_one_rule_e2(struct bnx2x *bp, 2567static void bnx2x_mcast_set_one_rule_e2(struct bnx2x *bp,
2566 struct bnx2x_mcast_obj *o, int idx, 2568 struct bnx2x_mcast_obj *o, int idx,
2567 union bnx2x_mcast_config_data *cfg_data, 2569 union bnx2x_mcast_config_data *cfg_data,
2568 int cmd) 2570 enum bnx2x_mcast_cmd cmd)
2569{ 2571{
2570 struct bnx2x_raw_obj *r = &o->raw; 2572 struct bnx2x_raw_obj *r = &o->raw;
2571 struct eth_multicast_rules_ramrod_data *data = 2573 struct eth_multicast_rules_ramrod_data *data =
@@ -2629,7 +2631,7 @@ static inline int bnx2x_mcast_handle_restore_cmd_e2(
2629 int *rdata_idx) 2631 int *rdata_idx)
2630{ 2632{
2631 int cur_bin, cnt = *rdata_idx; 2633 int cur_bin, cnt = *rdata_idx;
2632 union bnx2x_mcast_config_data cfg_data = {0}; 2634 union bnx2x_mcast_config_data cfg_data = {NULL};
2633 2635
2634 /* go through the registry and configure the bins from it */ 2636 /* go through the registry and configure the bins from it */
2635 for (cur_bin = bnx2x_mcast_get_next_bin(o, start_bin); cur_bin >= 0; 2637 for (cur_bin = bnx2x_mcast_get_next_bin(o, start_bin); cur_bin >= 0;
@@ -2661,7 +2663,7 @@ static inline void bnx2x_mcast_hdl_pending_add_e2(struct bnx2x *bp,
2661{ 2663{
2662 struct bnx2x_mcast_mac_elem *pmac_pos, *pmac_pos_n; 2664 struct bnx2x_mcast_mac_elem *pmac_pos, *pmac_pos_n;
2663 int cnt = *line_idx; 2665 int cnt = *line_idx;
2664 union bnx2x_mcast_config_data cfg_data = {0}; 2666 union bnx2x_mcast_config_data cfg_data = {NULL};
2665 2667
2666 list_for_each_entry_safe(pmac_pos, pmac_pos_n, &cmd_pos->data.macs_head, 2668 list_for_each_entry_safe(pmac_pos, pmac_pos_n, &cmd_pos->data.macs_head,
2667 link) { 2669 link) {
@@ -2784,7 +2786,7 @@ static inline void bnx2x_mcast_hdl_add(struct bnx2x *bp,
2784 int *line_idx) 2786 int *line_idx)
2785{ 2787{
2786 struct bnx2x_mcast_list_elem *mlist_pos; 2788 struct bnx2x_mcast_list_elem *mlist_pos;
2787 union bnx2x_mcast_config_data cfg_data = {0}; 2789 union bnx2x_mcast_config_data cfg_data = {NULL};
2788 int cnt = *line_idx; 2790 int cnt = *line_idx;
2789 2791
2790 list_for_each_entry(mlist_pos, &p->mcast_list, link) { 2792 list_for_each_entry(mlist_pos, &p->mcast_list, link) {
@@ -2831,7 +2833,8 @@ static inline void bnx2x_mcast_hdl_del(struct bnx2x *bp,
2831 * Returns number of lines filled in the ramrod data in total. 2833 * Returns number of lines filled in the ramrod data in total.
2832 */ 2834 */
2833static inline int bnx2x_mcast_handle_current_cmd(struct bnx2x *bp, 2835static inline int bnx2x_mcast_handle_current_cmd(struct bnx2x *bp,
2834 struct bnx2x_mcast_ramrod_params *p, int cmd, 2836 struct bnx2x_mcast_ramrod_params *p,
2837 enum bnx2x_mcast_cmd cmd,
2835 int start_cnt) 2838 int start_cnt)
2836{ 2839{
2837 struct bnx2x_mcast_obj *o = p->mcast_obj; 2840 struct bnx2x_mcast_obj *o = p->mcast_obj;
@@ -2865,7 +2868,7 @@ static inline int bnx2x_mcast_handle_current_cmd(struct bnx2x *bp,
2865 2868
2866static int bnx2x_mcast_validate_e2(struct bnx2x *bp, 2869static int bnx2x_mcast_validate_e2(struct bnx2x *bp,
2867 struct bnx2x_mcast_ramrod_params *p, 2870 struct bnx2x_mcast_ramrod_params *p,
2868 int cmd) 2871 enum bnx2x_mcast_cmd cmd)
2869{ 2872{
2870 struct bnx2x_mcast_obj *o = p->mcast_obj; 2873 struct bnx2x_mcast_obj *o = p->mcast_obj;
2871 int reg_sz = o->get_registry_size(o); 2874 int reg_sz = o->get_registry_size(o);
@@ -2934,8 +2937,9 @@ static inline void bnx2x_mcast_set_rdata_hdr_e2(struct bnx2x *bp,
2934 struct eth_multicast_rules_ramrod_data *data = 2937 struct eth_multicast_rules_ramrod_data *data =
2935 (struct eth_multicast_rules_ramrod_data *)(r->rdata); 2938 (struct eth_multicast_rules_ramrod_data *)(r->rdata);
2936 2939
2937 data->header.echo = ((r->cid & BNX2X_SWCID_MASK) | 2940 data->header.echo = cpu_to_le32((r->cid & BNX2X_SWCID_MASK) |
2938 (BNX2X_FILTER_MCAST_PENDING << BNX2X_SWCID_SHIFT)); 2941 (BNX2X_FILTER_MCAST_PENDING <<
2942 BNX2X_SWCID_SHIFT));
2939 data->header.rule_cnt = len; 2943 data->header.rule_cnt = len;
2940} 2944}
2941 2945
@@ -2969,7 +2973,7 @@ static inline int bnx2x_mcast_refresh_registry_e2(struct bnx2x *bp,
2969 2973
2970static int bnx2x_mcast_setup_e2(struct bnx2x *bp, 2974static int bnx2x_mcast_setup_e2(struct bnx2x *bp,
2971 struct bnx2x_mcast_ramrod_params *p, 2975 struct bnx2x_mcast_ramrod_params *p,
2972 int cmd) 2976 enum bnx2x_mcast_cmd cmd)
2973{ 2977{
2974 struct bnx2x_raw_obj *raw = &p->mcast_obj->raw; 2978 struct bnx2x_raw_obj *raw = &p->mcast_obj->raw;
2975 struct bnx2x_mcast_obj *o = p->mcast_obj; 2979 struct bnx2x_mcast_obj *o = p->mcast_obj;
@@ -3055,7 +3059,7 @@ static int bnx2x_mcast_setup_e2(struct bnx2x *bp,
3055 3059
3056static int bnx2x_mcast_validate_e1h(struct bnx2x *bp, 3060static int bnx2x_mcast_validate_e1h(struct bnx2x *bp,
3057 struct bnx2x_mcast_ramrod_params *p, 3061 struct bnx2x_mcast_ramrod_params *p,
3058 int cmd) 3062 enum bnx2x_mcast_cmd cmd)
3059{ 3063{
3060 /* Mark, that there is a work to do */ 3064 /* Mark, that there is a work to do */
3061 if ((cmd == BNX2X_MCAST_CMD_DEL) || (cmd == BNX2X_MCAST_CMD_RESTORE)) 3065 if ((cmd == BNX2X_MCAST_CMD_DEL) || (cmd == BNX2X_MCAST_CMD_RESTORE))
@@ -3117,7 +3121,7 @@ static inline void bnx2x_mcast_hdl_restore_e1h(struct bnx2x *bp,
3117 */ 3121 */
3118static int bnx2x_mcast_setup_e1h(struct bnx2x *bp, 3122static int bnx2x_mcast_setup_e1h(struct bnx2x *bp,
3119 struct bnx2x_mcast_ramrod_params *p, 3123 struct bnx2x_mcast_ramrod_params *p,
3120 int cmd) 3124 enum bnx2x_mcast_cmd cmd)
3121{ 3125{
3122 int i; 3126 int i;
3123 struct bnx2x_mcast_obj *o = p->mcast_obj; 3127 struct bnx2x_mcast_obj *o = p->mcast_obj;
@@ -3171,7 +3175,7 @@ static int bnx2x_mcast_setup_e1h(struct bnx2x *bp,
3171 3175
3172static int bnx2x_mcast_validate_e1(struct bnx2x *bp, 3176static int bnx2x_mcast_validate_e1(struct bnx2x *bp,
3173 struct bnx2x_mcast_ramrod_params *p, 3177 struct bnx2x_mcast_ramrod_params *p,
3174 int cmd) 3178 enum bnx2x_mcast_cmd cmd)
3175{ 3179{
3176 struct bnx2x_mcast_obj *o = p->mcast_obj; 3180 struct bnx2x_mcast_obj *o = p->mcast_obj;
3177 int reg_sz = o->get_registry_size(o); 3181 int reg_sz = o->get_registry_size(o);
@@ -3244,7 +3248,7 @@ static void bnx2x_mcast_revert_e1(struct bnx2x *bp,
3244static void bnx2x_mcast_set_one_rule_e1(struct bnx2x *bp, 3248static void bnx2x_mcast_set_one_rule_e1(struct bnx2x *bp,
3245 struct bnx2x_mcast_obj *o, int idx, 3249 struct bnx2x_mcast_obj *o, int idx,
3246 union bnx2x_mcast_config_data *cfg_data, 3250 union bnx2x_mcast_config_data *cfg_data,
3247 int cmd) 3251 enum bnx2x_mcast_cmd cmd)
3248{ 3252{
3249 struct bnx2x_raw_obj *r = &o->raw; 3253 struct bnx2x_raw_obj *r = &o->raw;
3250 struct mac_configuration_cmd *data = 3254 struct mac_configuration_cmd *data =
@@ -3288,9 +3292,10 @@ static inline void bnx2x_mcast_set_rdata_hdr_e1(struct bnx2x *bp,
3288 BNX2X_MAX_MULTICAST*(1 + r->func_id)); 3292 BNX2X_MAX_MULTICAST*(1 + r->func_id));
3289 3293
3290 data->hdr.offset = offset; 3294 data->hdr.offset = offset;
3291 data->hdr.client_id = 0xff; 3295 data->hdr.client_id = cpu_to_le16(0xff);
3292 data->hdr.echo = ((r->cid & BNX2X_SWCID_MASK) | 3296 data->hdr.echo = cpu_to_le32((r->cid & BNX2X_SWCID_MASK) |
3293 (BNX2X_FILTER_MCAST_PENDING << BNX2X_SWCID_SHIFT)); 3297 (BNX2X_FILTER_MCAST_PENDING <<
3298 BNX2X_SWCID_SHIFT));
3294 data->hdr.length = len; 3299 data->hdr.length = len;
3295} 3300}
3296 3301
@@ -3313,7 +3318,7 @@ static inline int bnx2x_mcast_handle_restore_cmd_e1(
3313{ 3318{
3314 struct bnx2x_mcast_mac_elem *elem; 3319 struct bnx2x_mcast_mac_elem *elem;
3315 int i = 0; 3320 int i = 0;
3316 union bnx2x_mcast_config_data cfg_data = {0}; 3321 union bnx2x_mcast_config_data cfg_data = {NULL};
3317 3322
3318 /* go through the registry and configure the MACs from it. */ 3323 /* go through the registry and configure the MACs from it. */
3319 list_for_each_entry(elem, &o->registry.exact_match.macs, link) { 3324 list_for_each_entry(elem, &o->registry.exact_match.macs, link) {
@@ -3338,7 +3343,7 @@ static inline int bnx2x_mcast_handle_pending_cmds_e1(
3338 struct bnx2x_pending_mcast_cmd *cmd_pos; 3343 struct bnx2x_pending_mcast_cmd *cmd_pos;
3339 struct bnx2x_mcast_mac_elem *pmac_pos; 3344 struct bnx2x_mcast_mac_elem *pmac_pos;
3340 struct bnx2x_mcast_obj *o = p->mcast_obj; 3345 struct bnx2x_mcast_obj *o = p->mcast_obj;
3341 union bnx2x_mcast_config_data cfg_data = {0}; 3346 union bnx2x_mcast_config_data cfg_data = {NULL};
3342 int cnt = 0; 3347 int cnt = 0;
3343 3348
3344 3349
@@ -3462,7 +3467,7 @@ static inline int bnx2x_mcast_refresh_registry_e1(struct bnx2x *bp,
3462 3467
3463static int bnx2x_mcast_setup_e1(struct bnx2x *bp, 3468static int bnx2x_mcast_setup_e1(struct bnx2x *bp,
3464 struct bnx2x_mcast_ramrod_params *p, 3469 struct bnx2x_mcast_ramrod_params *p,
3465 int cmd) 3470 enum bnx2x_mcast_cmd cmd)
3466{ 3471{
3467 struct bnx2x_mcast_obj *o = p->mcast_obj; 3472 struct bnx2x_mcast_obj *o = p->mcast_obj;
3468 struct bnx2x_raw_obj *raw = &o->raw; 3473 struct bnx2x_raw_obj *raw = &o->raw;
@@ -3566,7 +3571,7 @@ static void bnx2x_mcast_set_registry_size_aprox(struct bnx2x_mcast_obj *o,
3566 3571
3567int bnx2x_config_mcast(struct bnx2x *bp, 3572int bnx2x_config_mcast(struct bnx2x *bp,
3568 struct bnx2x_mcast_ramrod_params *p, 3573 struct bnx2x_mcast_ramrod_params *p,
3569 int cmd) 3574 enum bnx2x_mcast_cmd cmd)
3570{ 3575{
3571 struct bnx2x_mcast_obj *o = p->mcast_obj; 3576 struct bnx2x_mcast_obj *o = p->mcast_obj;
3572 struct bnx2x_raw_obj *r = &o->raw; 3577 struct bnx2x_raw_obj *r = &o->raw;
@@ -4089,8 +4094,8 @@ static int bnx2x_setup_rss(struct bnx2x *bp,
4089 DP(BNX2X_MSG_SP, "Configuring RSS\n"); 4094 DP(BNX2X_MSG_SP, "Configuring RSS\n");
4090 4095
4091 /* Set an echo field */ 4096 /* Set an echo field */
4092 data->echo = (r->cid & BNX2X_SWCID_MASK) | 4097 data->echo = cpu_to_le32((r->cid & BNX2X_SWCID_MASK) |
4093 (r->state << BNX2X_SWCID_SHIFT); 4098 (r->state << BNX2X_SWCID_SHIFT));
4094 4099
4095 /* RSS mode */ 4100 /* RSS mode */
4096 if (test_bit(BNX2X_RSS_MODE_DISABLED, &p->rss_flags)) 4101 if (test_bit(BNX2X_RSS_MODE_DISABLED, &p->rss_flags))
@@ -5749,21 +5754,20 @@ inline int bnx2x_func_send_afex_viflists(struct bnx2x *bp,
5749 struct bnx2x_func_sp_obj *o = params->f_obj; 5754 struct bnx2x_func_sp_obj *o = params->f_obj;
5750 struct afex_vif_list_ramrod_data *rdata = 5755 struct afex_vif_list_ramrod_data *rdata =
5751 (struct afex_vif_list_ramrod_data *)o->afex_rdata; 5756 (struct afex_vif_list_ramrod_data *)o->afex_rdata;
5752 struct bnx2x_func_afex_viflists_params *afex_viflist_params = 5757 struct bnx2x_func_afex_viflists_params *afex_vif_params =
5753 &params->params.afex_viflists; 5758 &params->params.afex_viflists;
5754 u64 *p_rdata = (u64 *)rdata; 5759 u64 *p_rdata = (u64 *)rdata;
5755 5760
5756 memset(rdata, 0, sizeof(*rdata)); 5761 memset(rdata, 0, sizeof(*rdata));
5757 5762
5758 /* Fill the ramrod data with provided parameters */ 5763 /* Fill the ramrod data with provided parameters */
5759 rdata->vif_list_index = afex_viflist_params->vif_list_index; 5764 rdata->vif_list_index = cpu_to_le16(afex_vif_params->vif_list_index);
5760 rdata->func_bit_map = afex_viflist_params->func_bit_map; 5765 rdata->func_bit_map = afex_vif_params->func_bit_map;
5761 rdata->afex_vif_list_command = 5766 rdata->afex_vif_list_command = afex_vif_params->afex_vif_list_command;
5762 afex_viflist_params->afex_vif_list_command; 5767 rdata->func_to_clear = afex_vif_params->func_to_clear;
5763 rdata->func_to_clear = afex_viflist_params->func_to_clear;
5764 5768
5765 /* send in echo type of sub command */ 5769 /* send in echo type of sub command */
5766 rdata->echo = afex_viflist_params->afex_vif_list_command; 5770 rdata->echo = afex_vif_params->afex_vif_list_command;
5767 5771
5768 /* No need for an explicit memory barrier here as long we would 5772 /* No need for an explicit memory barrier here as long we would
5769 * need to ensure the ordering of writing to the SPQ element 5773 * need to ensure the ordering of writing to the SPQ element
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
index ff8887cfdb3c..ff907609b9fc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
@@ -524,7 +524,7 @@ struct bnx2x_mcast_ramrod_params {
524 int mcast_list_len; 524 int mcast_list_len;
525}; 525};
526 526
527enum { 527enum bnx2x_mcast_cmd {
528 BNX2X_MCAST_CMD_ADD, 528 BNX2X_MCAST_CMD_ADD,
529 BNX2X_MCAST_CMD_CONT, 529 BNX2X_MCAST_CMD_CONT,
530 BNX2X_MCAST_CMD_DEL, 530 BNX2X_MCAST_CMD_DEL,
@@ -573,7 +573,8 @@ struct bnx2x_mcast_obj {
573 * @param cmd command to execute (BNX2X_MCAST_CMD_X, see above) 573 * @param cmd command to execute (BNX2X_MCAST_CMD_X, see above)
574 */ 574 */
575 int (*config_mcast)(struct bnx2x *bp, 575 int (*config_mcast)(struct bnx2x *bp,
576 struct bnx2x_mcast_ramrod_params *p, int cmd); 576 struct bnx2x_mcast_ramrod_params *p,
577 enum bnx2x_mcast_cmd cmd);
577 578
578 /** 579 /**
579 * Fills the ramrod data during the RESTORE flow. 580 * Fills the ramrod data during the RESTORE flow.
@@ -590,11 +591,13 @@ struct bnx2x_mcast_obj {
590 int start_bin, int *rdata_idx); 591 int start_bin, int *rdata_idx);
591 592
592 int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o, 593 int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
593 struct bnx2x_mcast_ramrod_params *p, int cmd); 594 struct bnx2x_mcast_ramrod_params *p,
595 enum bnx2x_mcast_cmd cmd);
594 596
595 void (*set_one_rule)(struct bnx2x *bp, 597 void (*set_one_rule)(struct bnx2x *bp,
596 struct bnx2x_mcast_obj *o, int idx, 598 struct bnx2x_mcast_obj *o, int idx,
597 union bnx2x_mcast_config_data *cfg_data, int cmd); 599 union bnx2x_mcast_config_data *cfg_data,
600 enum bnx2x_mcast_cmd cmd);
598 601
599 /** Checks if there are more mcast MACs to be set or a previous 602 /** Checks if there are more mcast MACs to be set or a previous
600 * command is still pending. 603 * command is still pending.
@@ -617,7 +620,8 @@ struct bnx2x_mcast_obj {
617 * feasible. 620 * feasible.
618 */ 621 */
619 int (*validate)(struct bnx2x *bp, 622 int (*validate)(struct bnx2x *bp,
620 struct bnx2x_mcast_ramrod_params *p, int cmd); 623 struct bnx2x_mcast_ramrod_params *p,
624 enum bnx2x_mcast_cmd cmd);
621 625
622 /** 626 /**
623 * Restore the values of internal counters in case of a failure. 627 * Restore the values of internal counters in case of a failure.
@@ -1347,7 +1351,8 @@ void bnx2x_init_mcast_obj(struct bnx2x *bp,
1347 * completions. 1351 * completions.
1348 */ 1352 */
1349int bnx2x_config_mcast(struct bnx2x *bp, 1353int bnx2x_config_mcast(struct bnx2x *bp,
1350 struct bnx2x_mcast_ramrod_params *p, int cmd); 1354 struct bnx2x_mcast_ramrod_params *p,
1355 enum bnx2x_mcast_cmd cmd);
1351 1356
1352/****************** CREDIT POOL ****************/ 1357/****************** CREDIT POOL ****************/
1353void bnx2x_init_mac_credit_pool(struct bnx2x *bp, 1358void bnx2x_init_mac_credit_pool(struct bnx2x *bp,
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index 1069669f241d..4397f8b76f2e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1010,8 +1010,8 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
1010 UPDATE_EXTEND_TSTAT(rcv_bcast_pkts, 1010 UPDATE_EXTEND_TSTAT(rcv_bcast_pkts,
1011 total_broadcast_packets_received); 1011 total_broadcast_packets_received);
1012 UPDATE_EXTEND_E_TSTAT(pkts_too_big_discard, 1012 UPDATE_EXTEND_E_TSTAT(pkts_too_big_discard,
1013 etherstatsoverrsizepkts); 1013 etherstatsoverrsizepkts, 32);
1014 UPDATE_EXTEND_E_TSTAT(no_buff_discard, no_buff_discard); 1014 UPDATE_EXTEND_E_TSTAT(no_buff_discard, no_buff_discard, 16);
1015 1015
1016 SUB_EXTEND_USTAT(ucast_no_buff_pkts, 1016 SUB_EXTEND_USTAT(ucast_no_buff_pkts,
1017 total_unicast_packets_received); 1017 total_unicast_packets_received);
@@ -1090,15 +1090,15 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
1090 estats->total_bytes_received_lo, 1090 estats->total_bytes_received_lo,
1091 estats->rx_stat_ifhcinbadoctets_lo); 1091 estats->rx_stat_ifhcinbadoctets_lo);
1092 1092
1093 ADD_64(estats->total_bytes_received_hi, 1093 ADD_64_LE(estats->total_bytes_received_hi,
1094 le32_to_cpu(tfunc->rcv_error_bytes.hi), 1094 tfunc->rcv_error_bytes.hi,
1095 estats->total_bytes_received_lo, 1095 estats->total_bytes_received_lo,
1096 le32_to_cpu(tfunc->rcv_error_bytes.lo)); 1096 tfunc->rcv_error_bytes.lo);
1097 1097
1098 ADD_64(estats->error_bytes_received_hi, 1098 ADD_64_LE(estats->error_bytes_received_hi,
1099 le32_to_cpu(tfunc->rcv_error_bytes.hi), 1099 tfunc->rcv_error_bytes.hi,
1100 estats->error_bytes_received_lo, 1100 estats->error_bytes_received_lo,
1101 le32_to_cpu(tfunc->rcv_error_bytes.lo)); 1101 tfunc->rcv_error_bytes.lo);
1102 1102
1103 UPDATE_ESTAT(etherstatsoverrsizepkts, rx_stat_dot3statsframestoolong); 1103 UPDATE_ESTAT(etherstatsoverrsizepkts, rx_stat_dot3statsframestoolong);
1104 1104
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
index 63a2f852b420..364e37ecbc5c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
@@ -421,16 +421,19 @@ struct bnx2x_fw_port_stats_old {
421 new->s); \ 421 new->s); \
422 } while (0) 422 } while (0)
423 423
424#define UPDATE_EXTEND_TSTAT(s, t) \ 424#define UPDATE_EXTEND_TSTAT_X(s, t, size) \
425 do { \ 425 do { \
426 diff = le32_to_cpu(tclient->s) - le32_to_cpu(old_tclient->s); \ 426 diff = le##size##_to_cpu(tclient->s) - \
427 le##size##_to_cpu(old_tclient->s); \
427 old_tclient->s = tclient->s; \ 428 old_tclient->s = tclient->s; \
428 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 429 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
429 } while (0) 430 } while (0)
430 431
431#define UPDATE_EXTEND_E_TSTAT(s, t) \ 432#define UPDATE_EXTEND_TSTAT(s, t) UPDATE_EXTEND_TSTAT_X(s, t, 32)
433
434#define UPDATE_EXTEND_E_TSTAT(s, t, size) \
432 do { \ 435 do { \
433 UPDATE_EXTEND_TSTAT(s, t); \ 436 UPDATE_EXTEND_TSTAT_X(s, t, size); \
434 ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \ 437 ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \
435 } while (0) 438 } while (0)
436 439