Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bnx2x: consistent statistics for old FW

Previously applied patch making the bnx2x statistics consistent
did not apply to old FWs. This remedies it, extending the consistent
behaviour to all drivers.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Reported-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yuval Mintz and committed by
David S. Miller
cb4dca27 9e62e912

+6 -41
+1
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1482 1482 1483 1483 u16 stats_counter; 1484 1484 struct bnx2x_eth_stats eth_stats; 1485 + struct host_func_stats func_stats; 1485 1486 struct bnx2x_eth_stats_old eth_stats_old; 1486 1487 struct bnx2x_net_stats_old net_stats_old; 1487 1488 struct bnx2x_fw_port_stats_old fw_stats_old;
+4 -35
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
··· 128 128 129 129 } else if (bp->func_stx) { 130 130 *stats_comp = 0; 131 + memcpy(bnx2x_sp(bp, func_stats), &bp->func_stats, 132 + sizeof(bp->func_stats)); 131 133 bnx2x_post_dmae(bp, dmae, INIT_DMAE_C(bp)); 132 134 } 133 135 } ··· 804 802 &bp->fw_stats_data->port.tstorm_port_statistics; 805 803 struct tstorm_per_pf_stats *tfunc = 806 804 &bp->fw_stats_data->pf.tstorm_pf_statistics; 807 - struct host_func_stats *fstats = bnx2x_sp(bp, func_stats); 805 + struct host_func_stats *fstats = &bp->func_stats; 808 806 struct bnx2x_eth_stats *estats = &bp->eth_stats; 809 807 struct bnx2x_eth_stats_old *estats_old = &bp->eth_stats_old; 810 808 struct stats_counter *counters = &bp->fw_stats_data->storm_counters; ··· 1309 1307 bnx2x_stats_comp(bp); 1310 1308 } 1311 1309 1312 - static void bnx2x_func_stats_base_update(struct bnx2x *bp) 1313 - { 1314 - struct dmae_command *dmae = &bp->stats_dmae; 1315 - u32 *stats_comp = bnx2x_sp(bp, stats_comp); 1316 - 1317 - /* sanity */ 1318 - if (!bp->func_stx) { 1319 - BNX2X_ERR("BUG!\n"); 1320 - return; 1321 - } 1322 - 1323 - bp->executer_idx = 0; 1324 - memset(dmae, 0, sizeof(struct dmae_command)); 1325 - 1326 - dmae->opcode = bnx2x_dmae_opcode(bp, DMAE_SRC_GRC, DMAE_DST_PCI, 1327 - true, DMAE_COMP_PCI); 1328 - dmae->src_addr_lo = bp->func_stx >> 2; 1329 - dmae->src_addr_hi = 0; 1330 - dmae->dst_addr_lo = U64_LO(bnx2x_sp_mapping(bp, func_stats)); 1331 - dmae->dst_addr_hi = U64_HI(bnx2x_sp_mapping(bp, func_stats)); 1332 - dmae->len = sizeof(struct host_func_stats) >> 2; 1333 - dmae->comp_addr_lo = U64_LO(bnx2x_sp_mapping(bp, stats_comp)); 1334 - dmae->comp_addr_hi = U64_HI(bnx2x_sp_mapping(bp, stats_comp)); 1335 - dmae->comp_val = DMAE_COMP_VAL; 1336 - 1337 - *stats_comp = 0; 1338 - bnx2x_hw_stats_post(bp); 1339 - bnx2x_stats_comp(bp); 1340 - } 1341 - 1342 1310 /** 1343 1311 * This function will prepare the statistics ramrod data the way 1344 1312 * we will only have to increment the statistics counter and ··· 1500 1528 memset(&bp->fw_stats_old, 0, sizeof(bp->fw_stats_old)); 1501 1529 memset(&bp->eth_stats_old, 0, sizeof(bp->eth_stats_old)); 1502 1530 memset(&bp->eth_stats, 0, sizeof(bp->eth_stats)); 1531 + memset(&bp->func_stats, 0, sizeof(bp->func_stats)); 1503 1532 1504 1533 /* Clean SP from previous statistics */ 1505 1534 if (bp->func_stx) { ··· 1516 1543 1517 1544 if (bp->port.pmf && bp->port.port_stx) 1518 1545 bnx2x_port_stats_base_init(bp); 1519 - 1520 - /* On a non-init, retrieve previous statistics from SP */ 1521 - if (!bp->stats_init && bp->func_stx) 1522 - bnx2x_func_stats_base_update(bp); 1523 1546 1524 1547 /* mark the end of statistics initializiation */ 1525 1548 bp->stats_init = false;
+1 -6
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
··· 421 421 do { \ 422 422 diff = le32_to_cpu(uclient->s) - le32_to_cpu(old_uclient->s); \ 423 423 old_uclient->s = uclient->s; \ 424 - } while (0) 425 - 426 - #define UPDATE_EXTEND_E_USTAT(s, t) \ 427 - do { \ 428 - UPDATE_EXTEND_USTAT(s, t); \ 429 - ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \ 424 + ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \ 430 425 } while (0) 431 426 432 427 #define UPDATE_EXTEND_E_USTAT(s, t) \