@@ -126,6 +126,7 @@ static void nicvf_set_msglevel(struct net_device *netdev, u32 lvl)
126
126
127
127
static void nicvf_get_strings (struct net_device * netdev , u32 sset , u8 * data )
128
128
{
129
+ struct nicvf * nic = netdev_priv (netdev );
129
130
int stats , qidx ;
130
131
131
132
if (sset != ETH_SS_STATS )
@@ -141,15 +142,15 @@ static void nicvf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
141
142
data += ETH_GSTRING_LEN ;
142
143
}
143
144
144
- for (qidx = 0 ; qidx < MAX_RCV_QUEUES_PER_QS ; qidx ++ ) {
145
+ for (qidx = 0 ; qidx < nic -> qs -> rq_cnt ; qidx ++ ) {
145
146
for (stats = 0 ; stats < nicvf_n_queue_stats ; stats ++ ) {
146
147
sprintf (data , "rxq%d: %s" , qidx ,
147
148
nicvf_queue_stats [stats ].name );
148
149
data += ETH_GSTRING_LEN ;
149
150
}
150
151
}
151
152
152
- for (qidx = 0 ; qidx < MAX_SND_QUEUES_PER_QS ; qidx ++ ) {
153
+ for (qidx = 0 ; qidx < nic -> qs -> sq_cnt ; qidx ++ ) {
153
154
for (stats = 0 ; stats < nicvf_n_queue_stats ; stats ++ ) {
154
155
sprintf (data , "txq%d: %s" , qidx ,
155
156
nicvf_queue_stats [stats ].name );
@@ -170,12 +171,14 @@ static void nicvf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
170
171
171
172
static int nicvf_get_sset_count (struct net_device * netdev , int sset )
172
173
{
174
+ struct nicvf * nic = netdev_priv (netdev );
175
+
173
176
if (sset != ETH_SS_STATS )
174
177
return - EINVAL ;
175
178
176
179
return nicvf_n_hw_stats + nicvf_n_drv_stats +
177
180
(nicvf_n_queue_stats *
178
- (MAX_RCV_QUEUES_PER_QS + MAX_SND_QUEUES_PER_QS )) +
181
+ (nic -> qs -> rq_cnt + nic -> qs -> sq_cnt )) +
179
182
BGX_RX_STATS_COUNT + BGX_TX_STATS_COUNT ;
180
183
}
181
184
@@ -197,13 +200,13 @@ static void nicvf_get_ethtool_stats(struct net_device *netdev,
197
200
* (data ++ ) = ((u64 * )& nic -> drv_stats )
198
201
[nicvf_drv_stats [stat ].index ];
199
202
200
- for (qidx = 0 ; qidx < MAX_RCV_QUEUES_PER_QS ; qidx ++ ) {
203
+ for (qidx = 0 ; qidx < nic -> qs -> rq_cnt ; qidx ++ ) {
201
204
for (stat = 0 ; stat < nicvf_n_queue_stats ; stat ++ )
202
205
* (data ++ ) = ((u64 * )& nic -> qs -> rq [qidx ].stats )
203
206
[nicvf_queue_stats [stat ].index ];
204
207
}
205
208
206
- for (qidx = 0 ; qidx < MAX_SND_QUEUES_PER_QS ; qidx ++ ) {
209
+ for (qidx = 0 ; qidx < nic -> qs -> sq_cnt ; qidx ++ ) {
207
210
for (stat = 0 ; stat < nicvf_n_queue_stats ; stat ++ )
208
211
* (data ++ ) = ((u64 * )& nic -> qs -> sq [qidx ].stats )
209
212
[nicvf_queue_stats [stat ].index ];
@@ -543,6 +546,7 @@ static int nicvf_set_channels(struct net_device *dev,
543
546
{
544
547
struct nicvf * nic = netdev_priv (dev );
545
548
int err = 0 ;
549
+ bool if_up = netif_running (dev );
546
550
547
551
if (!channel -> rx_count || !channel -> tx_count )
548
552
return - EINVAL ;
@@ -551,6 +555,9 @@ static int nicvf_set_channels(struct net_device *dev,
551
555
if (channel -> tx_count > MAX_SND_QUEUES_PER_QS )
552
556
return - EINVAL ;
553
557
558
+ if (if_up )
559
+ nicvf_stop (dev );
560
+
554
561
nic -> qs -> rq_cnt = channel -> rx_count ;
555
562
nic -> qs -> sq_cnt = channel -> tx_count ;
556
563
nic -> qs -> cq_cnt = max (nic -> qs -> rq_cnt , nic -> qs -> sq_cnt );
@@ -559,11 +566,9 @@ static int nicvf_set_channels(struct net_device *dev,
559
566
if (err )
560
567
return err ;
561
568
562
- if (! netif_running ( dev ) )
563
- return err ;
569
+ if (if_up )
570
+ nicvf_open ( dev ) ;
564
571
565
- nicvf_stop (dev );
566
- nicvf_open (dev );
567
572
netdev_info (dev , "Setting num Tx rings to %d, Rx rings to %d success\n" ,
568
573
nic -> qs -> sq_cnt , nic -> qs -> rq_cnt );
569
574
0 commit comments