Skip to content

Commit 0d89484

Browse files
author
NipaLocal
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Signed-off-by: NipaLocal <nipa@local>
2 parents 59372af + bc50835 commit 0d89484

19 files changed

+103
-121
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_ethtool.c

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,14 @@ octep_get_ethtool_stats(struct net_device *netdev,
150150
iface_rx_stats,
151151
iface_tx_stats);
152152

153-
for (q = 0; q < oct->num_oqs; q++) {
154-
struct octep_iq *iq = oct->iq[q];
155-
struct octep_oq *oq = oct->oq[q];
156-
157-
tx_packets += iq->stats.instr_completed;
158-
tx_bytes += iq->stats.bytes_sent;
159-
tx_busy_errors += iq->stats.tx_busy;
160-
161-
rx_packets += oq->stats.packets;
162-
rx_bytes += oq->stats.bytes;
163-
rx_alloc_errors += oq->stats.alloc_failures;
153+
for (q = 0; q < OCTEP_MAX_QUEUES; q++) {
154+
tx_packets += oct->stats_iq[q].instr_completed;
155+
tx_bytes += oct->stats_iq[q].bytes_sent;
156+
tx_busy_errors += oct->stats_iq[q].tx_busy;
157+
158+
rx_packets += oct->stats_oq[q].packets;
159+
rx_bytes += oct->stats_oq[q].bytes;
160+
rx_alloc_errors += oct->stats_oq[q].alloc_failures;
164161
}
165162
i = 0;
166163
data[i++] = rx_packets;
@@ -198,22 +195,18 @@ octep_get_ethtool_stats(struct net_device *netdev,
198195
data[i++] = iface_rx_stats->err_pkts;
199196

200197
/* Per Tx Queue stats */
201-
for (q = 0; q < oct->num_iqs; q++) {
202-
struct octep_iq *iq = oct->iq[q];
203-
204-
data[i++] = iq->stats.instr_posted;
205-
data[i++] = iq->stats.instr_completed;
206-
data[i++] = iq->stats.bytes_sent;
207-
data[i++] = iq->stats.tx_busy;
198+
for (q = 0; q < OCTEP_MAX_QUEUES; q++) {
199+
data[i++] = oct->stats_iq[q].instr_posted;
200+
data[i++] = oct->stats_iq[q].instr_completed;
201+
data[i++] = oct->stats_iq[q].bytes_sent;
202+
data[i++] = oct->stats_iq[q].tx_busy;
208203
}
209204

210205
/* Per Rx Queue stats */
211-
for (q = 0; q < oct->num_oqs; q++) {
212-
struct octep_oq *oq = oct->oq[q];
213-
214-
data[i++] = oq->stats.packets;
215-
data[i++] = oq->stats.bytes;
216-
data[i++] = oq->stats.alloc_failures;
206+
for (q = 0; q < OCTEP_MAX_QUEUES; q++) {
207+
data[i++] = oct->stats_oq[q].packets;
208+
data[i++] = oct->stats_oq[q].bytes;
209+
data[i++] = oct->stats_oq[q].alloc_failures;
217210
}
218211
}
219212

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ static inline int octep_iq_full_check(struct octep_iq *iq)
822822
if (unlikely(IQ_INSTR_SPACE(iq) >
823823
OCTEP_WAKE_QUEUE_THRESHOLD)) {
824824
netif_start_subqueue(iq->netdev, iq->q_no);
825-
iq->stats.restart_cnt++;
825+
iq->stats->restart_cnt++;
826826
return 0;
827827
}
828828

@@ -960,7 +960,7 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
960960
wmb();
961961
/* Ring Doorbell to notify the NIC of new packets */
962962
writel(iq->fill_cnt, iq->doorbell_reg);
963-
iq->stats.instr_posted += iq->fill_cnt;
963+
iq->stats->instr_posted += iq->fill_cnt;
964964
iq->fill_cnt = 0;
965965
return NETDEV_TX_OK;
966966

@@ -991,37 +991,24 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
991991
static void octep_get_stats64(struct net_device *netdev,
992992
struct rtnl_link_stats64 *stats)
993993
{
994-
u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
995994
struct octep_device *oct = netdev_priv(netdev);
995+
u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
996996
int q;
997997

998-
if (netif_running(netdev))
999-
octep_ctrl_net_get_if_stats(oct,
1000-
OCTEP_CTRL_NET_INVALID_VFID,
1001-
&oct->iface_rx_stats,
1002-
&oct->iface_tx_stats);
1003-
1004998
tx_packets = 0;
1005999
tx_bytes = 0;
10061000
rx_packets = 0;
10071001
rx_bytes = 0;
1008-
for (q = 0; q < oct->num_oqs; q++) {
1009-
struct octep_iq *iq = oct->iq[q];
1010-
struct octep_oq *oq = oct->oq[q];
1011-
1012-
tx_packets += iq->stats.instr_completed;
1013-
tx_bytes += iq->stats.bytes_sent;
1014-
rx_packets += oq->stats.packets;
1015-
rx_bytes += oq->stats.bytes;
1002+
for (q = 0; q < OCTEP_MAX_QUEUES; q++) {
1003+
tx_packets += oct->stats_iq[q].instr_completed;
1004+
tx_bytes += oct->stats_iq[q].bytes_sent;
1005+
rx_packets += oct->stats_oq[q].packets;
1006+
rx_bytes += oct->stats_oq[q].bytes;
10161007
}
10171008
stats->tx_packets = tx_packets;
10181009
stats->tx_bytes = tx_bytes;
10191010
stats->rx_packets = rx_packets;
10201011
stats->rx_bytes = rx_bytes;
1021-
stats->multicast = oct->iface_rx_stats.mcast_pkts;
1022-
stats->rx_errors = oct->iface_rx_stats.err_pkts;
1023-
stats->collisions = oct->iface_tx_stats.xscol;
1024-
stats->tx_fifo_errors = oct->iface_tx_stats.undflw;
10251012
}
10261013

10271014
/**

drivers/net/ethernet/marvell/octeon_ep/octep_main.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,17 @@ struct octep_device {
258258
/* Pointers to Octeon Tx queues */
259259
struct octep_iq *iq[OCTEP_MAX_IQ];
260260

261+
/* Per iq stats */
262+
struct octep_iq_stats stats_iq[OCTEP_MAX_IQ];
263+
261264
/* Rx queues (OQ: Output Queue) */
262265
u16 num_oqs;
263266
/* Pointers to Octeon Rx queues */
264267
struct octep_oq *oq[OCTEP_MAX_OQ];
265268

269+
/* Per oq stats */
270+
struct octep_oq_stats stats_oq[OCTEP_MAX_OQ];
271+
266272
/* Hardware port number of the PCIe interface */
267273
u16 pcie_port;
268274

drivers/net/ethernet/marvell/octeon_ep/octep_rx.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int octep_oq_refill(struct octep_device *oct, struct octep_oq *oq)
8787
page = dev_alloc_page();
8888
if (unlikely(!page)) {
8989
dev_err(oq->dev, "refill: rx buffer alloc failed\n");
90-
oq->stats.alloc_failures++;
90+
oq->stats->alloc_failures++;
9191
break;
9292
}
9393

@@ -98,7 +98,7 @@ static int octep_oq_refill(struct octep_device *oct, struct octep_oq *oq)
9898
"OQ-%d buffer refill: DMA mapping error!\n",
9999
oq->q_no);
100100
put_page(page);
101-
oq->stats.alloc_failures++;
101+
oq->stats->alloc_failures++;
102102
break;
103103
}
104104
oq->buff_info[refill_idx].page = page;
@@ -134,6 +134,7 @@ static int octep_setup_oq(struct octep_device *oct, int q_no)
134134
oq->netdev = oct->netdev;
135135
oq->dev = &oct->pdev->dev;
136136
oq->q_no = q_no;
137+
oq->stats = &oct->stats_oq[q_no];
137138
oq->max_count = CFG_GET_OQ_NUM_DESC(oct->conf);
138139
oq->ring_size_mask = oq->max_count - 1;
139140
oq->buffer_size = CFG_GET_OQ_BUF_SIZE(oct->conf);
@@ -443,7 +444,7 @@ static int __octep_oq_process_rx(struct octep_device *oct,
443444
if (!skb) {
444445
octep_oq_drop_rx(oq, buff_info,
445446
&read_idx, &desc_used);
446-
oq->stats.alloc_failures++;
447+
oq->stats->alloc_failures++;
447448
continue;
448449
}
449450
skb_reserve(skb, data_offset);
@@ -494,8 +495,8 @@ static int __octep_oq_process_rx(struct octep_device *oct,
494495

495496
oq->host_read_idx = read_idx;
496497
oq->refill_count += desc_used;
497-
oq->stats.packets += pkt;
498-
oq->stats.bytes += rx_bytes;
498+
oq->stats->packets += pkt;
499+
oq->stats->bytes += rx_bytes;
499500

500501
return pkt;
501502
}

drivers/net/ethernet/marvell/octeon_ep/octep_rx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ struct octep_oq {
186186
*/
187187
u8 __iomem *pkts_sent_reg;
188188

189-
/* Statistics for this OQ. */
190-
struct octep_oq_stats stats;
189+
/* Pointer to statistics for this OQ. */
190+
struct octep_oq_stats *stats;
191191

192192
/* Packets pending to be processed */
193193
u32 pkts_pending;

drivers/net/ethernet/marvell/octeon_ep/octep_tx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget)
8181
}
8282

8383
iq->pkts_processed += compl_pkts;
84-
iq->stats.instr_completed += compl_pkts;
85-
iq->stats.bytes_sent += compl_bytes;
86-
iq->stats.sgentry_sent += compl_sg;
84+
iq->stats->instr_completed += compl_pkts;
85+
iq->stats->bytes_sent += compl_bytes;
86+
iq->stats->sgentry_sent += compl_sg;
8787
iq->flush_index = fi;
8888

8989
netdev_tx_completed_queue(iq->netdev_q, compl_pkts, compl_bytes);
@@ -187,6 +187,7 @@ static int octep_setup_iq(struct octep_device *oct, int q_no)
187187
iq->netdev = oct->netdev;
188188
iq->dev = &oct->pdev->dev;
189189
iq->q_no = q_no;
190+
iq->stats = &oct->stats_iq[q_no];
190191
iq->max_count = CFG_GET_IQ_NUM_DESC(oct->conf);
191192
iq->ring_size_mask = iq->max_count - 1;
192193
iq->fill_threshold = CFG_GET_IQ_DB_MIN(oct->conf);

drivers/net/ethernet/marvell/octeon_ep/octep_tx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ struct octep_iq {
170170
*/
171171
u16 flush_index;
172172

173-
/* Statistics for this input queue. */
174-
struct octep_iq_stats stats;
173+
/* Pointer to statistics for this input queue. */
174+
struct octep_iq_stats *stats;
175175

176176
/* Pointer to the Virtual Base addr of the input ring. */
177177
struct octep_tx_desc_hw *desc_ring;

drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_ethtool.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,9 @@ static void octep_vf_get_ethtool_stats(struct net_device *netdev,
114114
iface_tx_stats = &oct->iface_tx_stats;
115115
iface_rx_stats = &oct->iface_rx_stats;
116116

117-
for (q = 0; q < oct->num_oqs; q++) {
118-
struct octep_vf_iq *iq = oct->iq[q];
119-
struct octep_vf_oq *oq = oct->oq[q];
120-
121-
tx_busy_errors += iq->stats.tx_busy;
122-
rx_alloc_errors += oq->stats.alloc_failures;
117+
for (q = 0; q < OCTEP_VF_MAX_QUEUES; q++) {
118+
tx_busy_errors += oct->stats_iq[q].tx_busy;
119+
rx_alloc_errors += oct->stats_oq[q].alloc_failures;
123120
}
124121
i = 0;
125122
data[i++] = rx_alloc_errors;
@@ -134,22 +131,18 @@ static void octep_vf_get_ethtool_stats(struct net_device *netdev,
134131
data[i++] = iface_rx_stats->dropped_octets_fifo_full;
135132

136133
/* Per Tx Queue stats */
137-
for (q = 0; q < oct->num_iqs; q++) {
138-
struct octep_vf_iq *iq = oct->iq[q];
139-
140-
data[i++] = iq->stats.instr_posted;
141-
data[i++] = iq->stats.instr_completed;
142-
data[i++] = iq->stats.bytes_sent;
143-
data[i++] = iq->stats.tx_busy;
134+
for (q = 0; q < OCTEP_VF_MAX_QUEUES; q++) {
135+
data[i++] = oct->stats_iq[q].instr_posted;
136+
data[i++] = oct->stats_iq[q].instr_completed;
137+
data[i++] = oct->stats_iq[q].bytes_sent;
138+
data[i++] = oct->stats_iq[q].tx_busy;
144139
}
145140

146141
/* Per Rx Queue stats */
147142
for (q = 0; q < oct->num_oqs; q++) {
148-
struct octep_vf_oq *oq = oct->oq[q];
149-
150-
data[i++] = oq->stats.packets;
151-
data[i++] = oq->stats.bytes;
152-
data[i++] = oq->stats.alloc_failures;
143+
data[i++] = oct->stats_oq[q].packets;
144+
data[i++] = oct->stats_oq[q].bytes;
145+
data[i++] = oct->stats_oq[q].alloc_failures;
153146
}
154147
}
155148

drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ static int octep_vf_iq_full_check(struct octep_vf_iq *iq)
574574
* caused queues to get re-enabled after
575575
* being stopped
576576
*/
577-
iq->stats.restart_cnt++;
577+
iq->stats->restart_cnt++;
578578
fallthrough;
579579
case 1: /* Queue left enabled, since IQ is not yet full*/
580580
return 0;
@@ -731,7 +731,7 @@ static netdev_tx_t octep_vf_start_xmit(struct sk_buff *skb,
731731
/* Flush the hw descriptors before writing to doorbell */
732732
smp_wmb();
733733
writel(iq->fill_cnt, iq->doorbell_reg);
734-
iq->stats.instr_posted += iq->fill_cnt;
734+
iq->stats->instr_posted += iq->fill_cnt;
735735
iq->fill_cnt = 0;
736736
return NETDEV_TX_OK;
737737
}
@@ -786,27 +786,16 @@ static void octep_vf_get_stats64(struct net_device *netdev,
786786
tx_bytes = 0;
787787
rx_packets = 0;
788788
rx_bytes = 0;
789-
for (q = 0; q < oct->num_oqs; q++) {
790-
struct octep_vf_iq *iq = oct->iq[q];
791-
struct octep_vf_oq *oq = oct->oq[q];
792-
793-
tx_packets += iq->stats.instr_completed;
794-
tx_bytes += iq->stats.bytes_sent;
795-
rx_packets += oq->stats.packets;
796-
rx_bytes += oq->stats.bytes;
789+
for (q = 0; q < OCTEP_VF_MAX_QUEUES; q++) {
790+
tx_packets += oct->stats_iq[q].instr_completed;
791+
tx_bytes += oct->stats_iq[q].bytes_sent;
792+
rx_packets += oct->stats_oq[q].packets;
793+
rx_bytes += oct->stats_oq[q].bytes;
797794
}
798795
stats->tx_packets = tx_packets;
799796
stats->tx_bytes = tx_bytes;
800797
stats->rx_packets = rx_packets;
801798
stats->rx_bytes = rx_bytes;
802-
if (!octep_vf_get_if_stats(oct)) {
803-
stats->multicast = oct->iface_rx_stats.mcast_pkts;
804-
stats->rx_errors = oct->iface_rx_stats.err_pkts;
805-
stats->rx_dropped = oct->iface_rx_stats.dropped_pkts_fifo_full +
806-
oct->iface_rx_stats.err_pkts;
807-
stats->rx_missed_errors = oct->iface_rx_stats.dropped_pkts_fifo_full;
808-
stats->tx_dropped = oct->iface_tx_stats.dropped;
809-
}
810799
}
811800

812801
/**

drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,17 @@ struct octep_vf_device {
246246
/* Pointers to Octeon Tx queues */
247247
struct octep_vf_iq *iq[OCTEP_VF_MAX_IQ];
248248

249+
/* Per iq stats */
250+
struct octep_vf_iq_stats stats_iq[OCTEP_VF_MAX_IQ];
251+
249252
/* Rx queues (OQ: Output Queue) */
250253
u16 num_oqs;
251254
/* Pointers to Octeon Rx queues */
252255
struct octep_vf_oq *oq[OCTEP_VF_MAX_OQ];
253256

257+
/* Per oq stats */
258+
struct octep_vf_oq_stats stats_oq[OCTEP_VF_MAX_OQ];
259+
254260
/* Hardware port number of the PCIe interface */
255261
u16 pcie_port;
256262

drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int octep_vf_oq_refill(struct octep_vf_device *oct, struct octep_vf_oq *o
8787
page = dev_alloc_page();
8888
if (unlikely(!page)) {
8989
dev_err(oq->dev, "refill: rx buffer alloc failed\n");
90-
oq->stats.alloc_failures++;
90+
oq->stats->alloc_failures++;
9191
break;
9292
}
9393

@@ -98,7 +98,7 @@ static int octep_vf_oq_refill(struct octep_vf_device *oct, struct octep_vf_oq *o
9898
"OQ-%d buffer refill: DMA mapping error!\n",
9999
oq->q_no);
100100
put_page(page);
101-
oq->stats.alloc_failures++;
101+
oq->stats->alloc_failures++;
102102
break;
103103
}
104104
oq->buff_info[refill_idx].page = page;
@@ -134,6 +134,7 @@ static int octep_vf_setup_oq(struct octep_vf_device *oct, int q_no)
134134
oq->netdev = oct->netdev;
135135
oq->dev = &oct->pdev->dev;
136136
oq->q_no = q_no;
137+
oq->stats = &oct->stats_oq[q_no];
137138
oq->max_count = CFG_GET_OQ_NUM_DESC(oct->conf);
138139
oq->ring_size_mask = oq->max_count - 1;
139140
oq->buffer_size = CFG_GET_OQ_BUF_SIZE(oct->conf);
@@ -458,8 +459,8 @@ static int __octep_vf_oq_process_rx(struct octep_vf_device *oct,
458459

459460
oq->host_read_idx = read_idx;
460461
oq->refill_count += desc_used;
461-
oq->stats.packets += pkt;
462-
oq->stats.bytes += rx_bytes;
462+
oq->stats->packets += pkt;
463+
oq->stats->bytes += rx_bytes;
463464

464465
return pkt;
465466
}

drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ struct octep_vf_oq {
187187
u8 __iomem *pkts_sent_reg;
188188

189189
/* Statistics for this OQ. */
190-
struct octep_vf_oq_stats stats;
190+
struct octep_vf_oq_stats *stats;
191191

192192
/* Packets pending to be processed */
193193
u32 pkts_pending;

0 commit comments

Comments
 (0)