Skip to content

Commit 6100086

Browse files
Ajit Khapardedavem330
Ajit Khaparde
authored andcommitted
be2net: Call version 2 of GET_STATS ioctl for Skyhawk-R
Moving to version 2 of GET_STATS command as SkyHawk-R supports higher number of rings. Signed-off-by: Ajit Khaparde <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3d7d562 commit 6100086

File tree

3 files changed

+155
-9
lines changed

3 files changed

+155
-9
lines changed

drivers/net/ethernet/emulex/benet/be_cmds.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,12 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
14361436
OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, nonemb_cmd);
14371437

14381438
/* version 1 of the cmd is not supported only by BE2 */
1439-
if (!BE2_chip(adapter))
1439+
if (BE2_chip(adapter))
1440+
hdr->version = 0;
1441+
if (BE3_chip(adapter) || lancer_chip(adapter))
14401442
hdr->version = 1;
1443+
else
1444+
hdr->version = 2;
14411445

14421446
be_mcc_notify(adapter);
14431447
adapter->stats_cmd_sent = true;

drivers/net/ethernet/emulex/benet/be_cmds.h

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,67 @@ struct be_erx_stats_v1 {
16621662
u32 rsvd[4];
16631663
};
16641664

1665+
struct be_port_rxf_stats_v2 {
1666+
u32 rsvd0[10];
1667+
u32 roce_bytes_received_lsd;
1668+
u32 roce_bytes_received_msd;
1669+
u32 rsvd1[5];
1670+
u32 roce_frames_received;
1671+
u32 rx_crc_errors;
1672+
u32 rx_alignment_symbol_errors;
1673+
u32 rx_pause_frames;
1674+
u32 rx_priority_pause_frames;
1675+
u32 rx_control_frames;
1676+
u32 rx_in_range_errors;
1677+
u32 rx_out_range_errors;
1678+
u32 rx_frame_too_long;
1679+
u32 rx_address_filtered;
1680+
u32 rx_dropped_too_small;
1681+
u32 rx_dropped_too_short;
1682+
u32 rx_dropped_header_too_small;
1683+
u32 rx_dropped_tcp_length;
1684+
u32 rx_dropped_runt;
1685+
u32 rsvd2[10];
1686+
u32 rx_ip_checksum_errs;
1687+
u32 rx_tcp_checksum_errs;
1688+
u32 rx_udp_checksum_errs;
1689+
u32 rsvd3[7];
1690+
u32 rx_switched_unicast_packets;
1691+
u32 rx_switched_multicast_packets;
1692+
u32 rx_switched_broadcast_packets;
1693+
u32 rsvd4[3];
1694+
u32 tx_pauseframes;
1695+
u32 tx_priority_pauseframes;
1696+
u32 tx_controlframes;
1697+
u32 rsvd5[10];
1698+
u32 rxpp_fifo_overflow_drop;
1699+
u32 rx_input_fifo_overflow_drop;
1700+
u32 pmem_fifo_overflow_drop;
1701+
u32 jabber_events;
1702+
u32 rsvd6[3];
1703+
u32 rx_drops_payload_size;
1704+
u32 rx_drops_clipped_header;
1705+
u32 rx_drops_crc;
1706+
u32 roce_drops_payload_len;
1707+
u32 roce_drops_crc;
1708+
u32 rsvd7[19];
1709+
};
1710+
1711+
struct be_rxf_stats_v2 {
1712+
struct be_port_rxf_stats_v2 port[4];
1713+
u32 rsvd0[2];
1714+
u32 rx_drops_no_pbuf;
1715+
u32 rx_drops_no_txpb;
1716+
u32 rx_drops_no_erx_descr;
1717+
u32 rx_drops_no_tpre_descr;
1718+
u32 rsvd1[6];
1719+
u32 rx_drops_too_many_frags;
1720+
u32 rx_drops_invalid_ring;
1721+
u32 forwarded_packets;
1722+
u32 rx_drops_mtu;
1723+
u32 rsvd2[35];
1724+
};
1725+
16651726
struct be_hw_stats_v1 {
16661727
struct be_rxf_stats_v1 rxf;
16671728
u32 rsvd0[BE_TXP_SW_SZ];
@@ -1680,6 +1741,29 @@ struct be_cmd_resp_get_stats_v1 {
16801741
struct be_hw_stats_v1 hw_stats;
16811742
};
16821743

1744+
struct be_erx_stats_v2 {
1745+
u32 rx_drops_no_fragments[136]; /* dwordS 0 to 135*/
1746+
u32 rsvd[3];
1747+
};
1748+
1749+
struct be_hw_stats_v2 {
1750+
struct be_rxf_stats_v2 rxf;
1751+
u32 rsvd0[BE_TXP_SW_SZ];
1752+
struct be_erx_stats_v2 erx;
1753+
struct be_pmem_stats pmem;
1754+
u32 rsvd1[18];
1755+
};
1756+
1757+
struct be_cmd_req_get_stats_v2 {
1758+
struct be_cmd_req_hdr hdr;
1759+
u8 rsvd[sizeof(struct be_hw_stats_v2)];
1760+
};
1761+
1762+
struct be_cmd_resp_get_stats_v2 {
1763+
struct be_cmd_resp_hdr hdr;
1764+
struct be_hw_stats_v2 hw_stats;
1765+
};
1766+
16831767
/************** get fat capabilites *******************/
16841768
#define MAX_MODULES 27
16851769
#define MAX_MODES 4

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,13 @@ static void *hw_stats_from_cmd(struct be_adapter *adapter)
306306
struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va;
307307

308308
return &cmd->hw_stats;
309-
} else {
309+
} else if (BE3_chip(adapter)) {
310310
struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va;
311311

312+
return &cmd->hw_stats;
313+
} else {
314+
struct be_cmd_resp_get_stats_v2 *cmd = adapter->stats_cmd.va;
315+
312316
return &cmd->hw_stats;
313317
}
314318
}
@@ -320,9 +324,13 @@ static void *be_erx_stats_from_cmd(struct be_adapter *adapter)
320324
struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
321325

322326
return &hw_stats->erx;
323-
} else {
327+
} else if (BE3_chip(adapter)) {
324328
struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
325329

330+
return &hw_stats->erx;
331+
} else {
332+
struct be_hw_stats_v2 *hw_stats = hw_stats_from_cmd(adapter);
333+
326334
return &hw_stats->erx;
327335
}
328336
}
@@ -422,6 +430,52 @@ static void populate_be_v1_stats(struct be_adapter *adapter)
422430
adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops;
423431
}
424432

433+
static void populate_be_v2_stats(struct be_adapter *adapter)
434+
{
435+
struct be_hw_stats_v2 *hw_stats = hw_stats_from_cmd(adapter);
436+
struct be_pmem_stats *pmem_sts = &hw_stats->pmem;
437+
struct be_rxf_stats_v2 *rxf_stats = &hw_stats->rxf;
438+
struct be_port_rxf_stats_v2 *port_stats =
439+
&rxf_stats->port[adapter->port_num];
440+
struct be_drv_stats *drvs = &adapter->drv_stats;
441+
442+
be_dws_le_to_cpu(hw_stats, sizeof(*hw_stats));
443+
drvs->pmem_fifo_overflow_drop = port_stats->pmem_fifo_overflow_drop;
444+
drvs->rx_priority_pause_frames = port_stats->rx_priority_pause_frames;
445+
drvs->rx_pause_frames = port_stats->rx_pause_frames;
446+
drvs->rx_crc_errors = port_stats->rx_crc_errors;
447+
drvs->rx_control_frames = port_stats->rx_control_frames;
448+
drvs->rx_in_range_errors = port_stats->rx_in_range_errors;
449+
drvs->rx_frame_too_long = port_stats->rx_frame_too_long;
450+
drvs->rx_dropped_runt = port_stats->rx_dropped_runt;
451+
drvs->rx_ip_checksum_errs = port_stats->rx_ip_checksum_errs;
452+
drvs->rx_tcp_checksum_errs = port_stats->rx_tcp_checksum_errs;
453+
drvs->rx_udp_checksum_errs = port_stats->rx_udp_checksum_errs;
454+
drvs->rx_dropped_tcp_length = port_stats->rx_dropped_tcp_length;
455+
drvs->rx_dropped_too_small = port_stats->rx_dropped_too_small;
456+
drvs->rx_dropped_too_short = port_stats->rx_dropped_too_short;
457+
drvs->rx_out_range_errors = port_stats->rx_out_range_errors;
458+
drvs->rx_dropped_header_too_small =
459+
port_stats->rx_dropped_header_too_small;
460+
drvs->rx_input_fifo_overflow_drop =
461+
port_stats->rx_input_fifo_overflow_drop;
462+
drvs->rx_address_filtered = port_stats->rx_address_filtered;
463+
drvs->rx_alignment_symbol_errors =
464+
port_stats->rx_alignment_symbol_errors;
465+
drvs->rxpp_fifo_overflow_drop = port_stats->rxpp_fifo_overflow_drop;
466+
drvs->tx_pauseframes = port_stats->tx_pauseframes;
467+
drvs->tx_controlframes = port_stats->tx_controlframes;
468+
drvs->tx_priority_pauseframes = port_stats->tx_priority_pauseframes;
469+
drvs->jabber_events = port_stats->jabber_events;
470+
drvs->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf;
471+
drvs->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr;
472+
drvs->forwarded_packets = rxf_stats->forwarded_packets;
473+
drvs->rx_drops_mtu = rxf_stats->rx_drops_mtu;
474+
drvs->rx_drops_no_tpre_descr = rxf_stats->rx_drops_no_tpre_descr;
475+
drvs->rx_drops_too_many_frags = rxf_stats->rx_drops_too_many_frags;
476+
adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops;
477+
}
478+
425479
static void populate_lancer_stats(struct be_adapter *adapter)
426480
{
427481

@@ -489,7 +543,7 @@ static void populate_erx_stats(struct be_adapter *adapter,
489543

490544
void be_parse_stats(struct be_adapter *adapter)
491545
{
492-
struct be_erx_stats_v1 *erx = be_erx_stats_from_cmd(adapter);
546+
struct be_erx_stats_v2 *erx = be_erx_stats_from_cmd(adapter);
493547
struct be_rx_obj *rxo;
494548
int i;
495549
u32 erx_stat;
@@ -499,11 +553,13 @@ void be_parse_stats(struct be_adapter *adapter)
499553
} else {
500554
if (BE2_chip(adapter))
501555
populate_be_v0_stats(adapter);
502-
else
503-
/* for BE3 and Skyhawk */
556+
else if (BE3_chip(adapter))
557+
/* for BE3 */
504558
populate_be_v1_stats(adapter);
559+
else
560+
populate_be_v2_stats(adapter);
505561

506-
/* as erx_v1 is longer than v0, ok to use v1 for v0 access */
562+
/* erx_v2 is longer than v0, v1. use v2 for v0, v1 access */
507563
for_all_rx_queues(adapter, rxo, i) {
508564
erx_stat = erx->rx_drops_no_fragments[rxo->q.id];
509565
populate_erx_stats(adapter, rxo, erx_stat);
@@ -4102,9 +4158,11 @@ static int be_stats_init(struct be_adapter *adapter)
41024158
cmd->size = sizeof(struct lancer_cmd_req_pport_stats);
41034159
else if (BE2_chip(adapter))
41044160
cmd->size = sizeof(struct be_cmd_req_get_stats_v0);
4105-
else
4106-
/* BE3 and Skyhawk */
4161+
else if (BE3_chip(adapter))
41074162
cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
4163+
else
4164+
/* ALL non-BE ASICs */
4165+
cmd->size = sizeof(struct be_cmd_req_get_stats_v2);
41084166

41094167
cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
41104168
GFP_KERNEL);

0 commit comments

Comments
 (0)