Skip to content

Commit e8a1bd8

Browse files
HariKalavakuntaPaolo Abeni
authored andcommitted
net: ncsi: Fix GCPS 64-bit member variables
Correct Get Controller Packet Statistics (GCPS) 64-bit wide member variables, as per DSP0222 v1.0.0 and forward specs. The Driver currently collects these stats, but they are yet to be exposed to the user. Therefore, no user impact. Statistics fixes: Total Bytes Received (byte range 28..35) Total Bytes Transmitted (byte range 36..43) Total Unicast Packets Received (byte range 44..51) Total Multicast Packets Received (byte range 52..59) Total Broadcast Packets Received (byte range 60..67) Total Unicast Packets Transmitted (byte range 68..75) Total Multicast Packets Transmitted (byte range 76..83) Total Broadcast Packets Transmitted (byte range 84..91) Valid Bytes Received (byte range 204..11) Signed-off-by: Hari Kalavakunta <[email protected]> Reviewed-by: Paul Fertser <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 8c9b406 commit e8a1bd8

File tree

3 files changed

+31
-34
lines changed

3 files changed

+31
-34
lines changed

net/ncsi/internal.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,15 @@ struct ncsi_channel_vlan_filter {
143143
};
144144

145145
struct ncsi_channel_stats {
146-
u32 hnc_cnt_hi; /* Counter cleared */
147-
u32 hnc_cnt_lo; /* Counter cleared */
148-
u32 hnc_rx_bytes; /* Rx bytes */
149-
u32 hnc_tx_bytes; /* Tx bytes */
150-
u32 hnc_rx_uc_pkts; /* Rx UC packets */
151-
u32 hnc_rx_mc_pkts; /* Rx MC packets */
152-
u32 hnc_rx_bc_pkts; /* Rx BC packets */
153-
u32 hnc_tx_uc_pkts; /* Tx UC packets */
154-
u32 hnc_tx_mc_pkts; /* Tx MC packets */
155-
u32 hnc_tx_bc_pkts; /* Tx BC packets */
146+
u64 hnc_cnt; /* Counter cleared */
147+
u64 hnc_rx_bytes; /* Rx bytes */
148+
u64 hnc_tx_bytes; /* Tx bytes */
149+
u64 hnc_rx_uc_pkts; /* Rx UC packets */
150+
u64 hnc_rx_mc_pkts; /* Rx MC packets */
151+
u64 hnc_rx_bc_pkts; /* Rx BC packets */
152+
u64 hnc_tx_uc_pkts; /* Tx UC packets */
153+
u64 hnc_tx_mc_pkts; /* Tx MC packets */
154+
u64 hnc_tx_bc_pkts; /* Tx BC packets */
156155
u32 hnc_fcs_err; /* FCS errors */
157156
u32 hnc_align_err; /* Alignment errors */
158157
u32 hnc_false_carrier; /* False carrier detection */
@@ -181,7 +180,7 @@ struct ncsi_channel_stats {
181180
u32 hnc_tx_1023_frames; /* Tx 512-1023 bytes frames */
182181
u32 hnc_tx_1522_frames; /* Tx 1024-1522 bytes frames */
183182
u32 hnc_tx_9022_frames; /* Tx 1523-9022 bytes frames */
184-
u32 hnc_rx_valid_bytes; /* Rx valid bytes */
183+
u64 hnc_rx_valid_bytes; /* Rx valid bytes */
185184
u32 hnc_rx_runt_pkts; /* Rx error runt packets */
186185
u32 hnc_rx_jabber_pkts; /* Rx error jabber packets */
187186
u32 ncsi_rx_cmds; /* Rx NCSI commands */

net/ncsi/ncsi-pkt.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,15 @@ struct ncsi_rsp_gp_pkt {
252252
/* Get Controller Packet Statistics */
253253
struct ncsi_rsp_gcps_pkt {
254254
struct ncsi_rsp_pkt_hdr rsp; /* Response header */
255-
__be32 cnt_hi; /* Counter cleared */
256-
__be32 cnt_lo; /* Counter cleared */
257-
__be32 rx_bytes; /* Rx bytes */
258-
__be32 tx_bytes; /* Tx bytes */
259-
__be32 rx_uc_pkts; /* Rx UC packets */
260-
__be32 rx_mc_pkts; /* Rx MC packets */
261-
__be32 rx_bc_pkts; /* Rx BC packets */
262-
__be32 tx_uc_pkts; /* Tx UC packets */
263-
__be32 tx_mc_pkts; /* Tx MC packets */
264-
__be32 tx_bc_pkts; /* Tx BC packets */
255+
__be64 cnt; /* Counter cleared */
256+
__be64 rx_bytes; /* Rx bytes */
257+
__be64 tx_bytes; /* Tx bytes */
258+
__be64 rx_uc_pkts; /* Rx UC packets */
259+
__be64 rx_mc_pkts; /* Rx MC packets */
260+
__be64 rx_bc_pkts; /* Rx BC packets */
261+
__be64 tx_uc_pkts; /* Tx UC packets */
262+
__be64 tx_mc_pkts; /* Tx MC packets */
263+
__be64 tx_bc_pkts; /* Tx BC packets */
265264
__be32 fcs_err; /* FCS errors */
266265
__be32 align_err; /* Alignment errors */
267266
__be32 false_carrier; /* False carrier detection */
@@ -290,11 +289,11 @@ struct ncsi_rsp_gcps_pkt {
290289
__be32 tx_1023_frames; /* Tx 512-1023 bytes frames */
291290
__be32 tx_1522_frames; /* Tx 1024-1522 bytes frames */
292291
__be32 tx_9022_frames; /* Tx 1523-9022 bytes frames */
293-
__be32 rx_valid_bytes; /* Rx valid bytes */
292+
__be64 rx_valid_bytes; /* Rx valid bytes */
294293
__be32 rx_runt_pkts; /* Rx error runt packets */
295294
__be32 rx_jabber_pkts; /* Rx error jabber packets */
296295
__be32 checksum; /* Checksum */
297-
};
296+
} __packed __aligned(4);
298297

299298
/* Get NCSI Statistics */
300299
struct ncsi_rsp_gns_pkt {

net/ncsi/ncsi-rsp.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -926,16 +926,15 @@ static int ncsi_rsp_handler_gcps(struct ncsi_request *nr)
926926

927927
/* Update HNC's statistics */
928928
ncs = &nc->stats;
929-
ncs->hnc_cnt_hi = ntohl(rsp->cnt_hi);
930-
ncs->hnc_cnt_lo = ntohl(rsp->cnt_lo);
931-
ncs->hnc_rx_bytes = ntohl(rsp->rx_bytes);
932-
ncs->hnc_tx_bytes = ntohl(rsp->tx_bytes);
933-
ncs->hnc_rx_uc_pkts = ntohl(rsp->rx_uc_pkts);
934-
ncs->hnc_rx_mc_pkts = ntohl(rsp->rx_mc_pkts);
935-
ncs->hnc_rx_bc_pkts = ntohl(rsp->rx_bc_pkts);
936-
ncs->hnc_tx_uc_pkts = ntohl(rsp->tx_uc_pkts);
937-
ncs->hnc_tx_mc_pkts = ntohl(rsp->tx_mc_pkts);
938-
ncs->hnc_tx_bc_pkts = ntohl(rsp->tx_bc_pkts);
929+
ncs->hnc_cnt = be64_to_cpu(rsp->cnt);
930+
ncs->hnc_rx_bytes = be64_to_cpu(rsp->rx_bytes);
931+
ncs->hnc_tx_bytes = be64_to_cpu(rsp->tx_bytes);
932+
ncs->hnc_rx_uc_pkts = be64_to_cpu(rsp->rx_uc_pkts);
933+
ncs->hnc_rx_mc_pkts = be64_to_cpu(rsp->rx_mc_pkts);
934+
ncs->hnc_rx_bc_pkts = be64_to_cpu(rsp->rx_bc_pkts);
935+
ncs->hnc_tx_uc_pkts = be64_to_cpu(rsp->tx_uc_pkts);
936+
ncs->hnc_tx_mc_pkts = be64_to_cpu(rsp->tx_mc_pkts);
937+
ncs->hnc_tx_bc_pkts = be64_to_cpu(rsp->tx_bc_pkts);
939938
ncs->hnc_fcs_err = ntohl(rsp->fcs_err);
940939
ncs->hnc_align_err = ntohl(rsp->align_err);
941940
ncs->hnc_false_carrier = ntohl(rsp->false_carrier);
@@ -964,7 +963,7 @@ static int ncsi_rsp_handler_gcps(struct ncsi_request *nr)
964963
ncs->hnc_tx_1023_frames = ntohl(rsp->tx_1023_frames);
965964
ncs->hnc_tx_1522_frames = ntohl(rsp->tx_1522_frames);
966965
ncs->hnc_tx_9022_frames = ntohl(rsp->tx_9022_frames);
967-
ncs->hnc_rx_valid_bytes = ntohl(rsp->rx_valid_bytes);
966+
ncs->hnc_rx_valid_bytes = be64_to_cpu(rsp->rx_valid_bytes);
968967
ncs->hnc_rx_runt_pkts = ntohl(rsp->rx_runt_pkts);
969968
ncs->hnc_rx_jabber_pkts = ntohl(rsp->rx_jabber_pkts);
970969

0 commit comments

Comments
 (0)