Skip to content

Commit 8c659fd

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== 40GbE Intel Wired LAN Driver Updates 2021-11-30 This series contains updates to iavf driver only. Patryk adds a debug message when MTU is changed. Grzegorz adds messaging when transitioning in and out of multicast promiscuous mode. Jake returns correct error codes for iavf_parse_cls_flower(). Jedrzej adds messaging for when the driver is removed and refactors struct usage to take less memory. He also adjusts ethtool statistics to only display information on active queues. Tony allows for user to specify the RSS hash. Karen resolves some static analysis warnings, corrects format specifiers, and rewords a message to come across as informational. v2: - Dropped patch 1 (for net) and 5 - Change MTU message from info to debug ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 749c694 + 64430f7 commit 8c659fd

File tree

5 files changed

+69
-44
lines changed

5 files changed

+69
-44
lines changed

drivers/net/ethernet/intel/iavf/iavf.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ struct iavf_q_vector {
137137
struct iavf_mac_filter {
138138
struct list_head list;
139139
u8 macaddr[ETH_ALEN];
140-
bool is_new_mac; /* filter is new, wait for PF decision */
141-
bool remove; /* filter needs to be removed */
142-
bool add; /* filter needs to be added */
140+
struct {
141+
u8 is_new_mac:1; /* filter is new, wait for PF decision */
142+
u8 remove:1; /* filter needs to be removed */
143+
u8 add:1; /* filter needs to be added */
144+
u8 is_primary:1; /* filter is a default VF MAC */
145+
u8 padding:4;
146+
};
143147
};
144148

145149
struct iavf_vlan_filter {

drivers/net/ethernet/intel/iavf/iavf_ethtool.c

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,16 @@ static int iavf_get_link_ksettings(struct net_device *netdev,
331331
**/
332332
static int iavf_get_sset_count(struct net_device *netdev, int sset)
333333
{
334+
/* Report the maximum number queues, even if not every queue is
335+
* currently configured. Since allocation of queues is in pairs,
336+
* use netdev->real_num_tx_queues * 2. The real_num_tx_queues is set
337+
* at device creation and never changes.
338+
*/
339+
334340
if (sset == ETH_SS_STATS)
335341
return IAVF_STATS_LEN +
336-
(IAVF_QUEUE_STATS_LEN * 2 * IAVF_MAX_REQ_QUEUES);
342+
(IAVF_QUEUE_STATS_LEN * 2 *
343+
netdev->real_num_tx_queues);
337344
else if (sset == ETH_SS_PRIV_FLAGS)
338345
return IAVF_PRIV_FLAGS_STR_LEN;
339346
else
@@ -360,17 +367,18 @@ static void iavf_get_ethtool_stats(struct net_device *netdev,
360367
iavf_add_ethtool_stats(&data, adapter, iavf_gstrings_stats);
361368

362369
rcu_read_lock();
363-
for (i = 0; i < IAVF_MAX_REQ_QUEUES; i++) {
370+
/* As num_active_queues describe both tx and rx queues, we can use
371+
* it to iterate over rings' stats.
372+
*/
373+
for (i = 0; i < adapter->num_active_queues; i++) {
364374
struct iavf_ring *ring;
365375

366-
/* Avoid accessing un-allocated queues */
367-
ring = (i < adapter->num_active_queues ?
368-
&adapter->tx_rings[i] : NULL);
376+
/* Tx rings stats */
377+
ring = &adapter->tx_rings[i];
369378
iavf_add_queue_stats(&data, ring);
370379

371-
/* Avoid accessing un-allocated queues */
372-
ring = (i < adapter->num_active_queues ?
373-
&adapter->rx_rings[i] : NULL);
380+
/* Rx rings stats */
381+
ring = &adapter->rx_rings[i];
374382
iavf_add_queue_stats(&data, ring);
375383
}
376384
rcu_read_unlock();
@@ -407,10 +415,10 @@ static void iavf_get_stat_strings(struct net_device *netdev, u8 *data)
407415

408416
iavf_add_stat_strings(&data, iavf_gstrings_stats);
409417

410-
/* Queues are always allocated in pairs, so we just use num_tx_queues
411-
* for both Tx and Rx queues.
418+
/* Queues are always allocated in pairs, so we just use
419+
* real_num_tx_queues for both Tx and Rx queues.
412420
*/
413-
for (i = 0; i < netdev->num_tx_queues; i++) {
421+
for (i = 0; i < netdev->real_num_tx_queues; i++) {
414422
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats,
415423
"tx", i);
416424
iavf_add_stat_strings(&data, iavf_gstrings_queue_stats,
@@ -1910,7 +1918,7 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
19101918
* @key: hash key
19111919
* @hfunc: hash function to use
19121920
*
1913-
* Returns -EINVAL if the table specifies an inavlid queue id, otherwise
1921+
* Returns -EINVAL if the table specifies an invalid queue id, otherwise
19141922
* returns 0 after programming the table.
19151923
**/
19161924
static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir,
@@ -1919,19 +1927,21 @@ static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir,
19191927
struct iavf_adapter *adapter = netdev_priv(netdev);
19201928
u16 i;
19211929

1922-
/* We do not allow change in unsupported parameters */
1923-
if (key ||
1924-
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
1930+
/* Only support toeplitz hash function */
1931+
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
19251932
return -EOPNOTSUPP;
1926-
if (!indir)
1933+
1934+
if (!key && !indir)
19271935
return 0;
19281936

19291937
if (key)
19301938
memcpy(adapter->rss_key, key, adapter->rss_key_size);
19311939

1932-
/* Each 32 bits pointed by 'indir' is stored with a lut entry */
1933-
for (i = 0; i < adapter->rss_lut_size; i++)
1934-
adapter->rss_lut[i] = (u8)(indir[i]);
1940+
if (indir) {
1941+
/* Each 32 bits pointed by 'indir' is stored with a lut entry */
1942+
for (i = 0; i < adapter->rss_lut_size; i++)
1943+
adapter->rss_lut[i] = (u8)(indir[i]);
1944+
}
19351945

19361946
return iavf_config_rss(adapter);
19371947
}

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,14 @@ iavf_request_traffic_irqs(struct iavf_adapter *adapter, char *basename)
463463

464464
if (q_vector->tx.ring && q_vector->rx.ring) {
465465
snprintf(q_vector->name, sizeof(q_vector->name),
466-
"iavf-%s-TxRx-%d", basename, rx_int_idx++);
466+
"iavf-%s-TxRx-%u", basename, rx_int_idx++);
467467
tx_int_idx++;
468468
} else if (q_vector->rx.ring) {
469469
snprintf(q_vector->name, sizeof(q_vector->name),
470-
"iavf-%s-rx-%d", basename, rx_int_idx++);
470+
"iavf-%s-rx-%u", basename, rx_int_idx++);
471471
} else if (q_vector->tx.ring) {
472472
snprintf(q_vector->name, sizeof(q_vector->name),
473-
"iavf-%s-tx-%d", basename, tx_int_idx++);
473+
"iavf-%s-tx-%u", basename, tx_int_idx++);
474474
} else {
475475
/* skip this unused q_vector */
476476
continue;
@@ -2910,7 +2910,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
29102910
} else {
29112911
dev_err(&adapter->pdev->dev, "Bad ether dest mask %pM\n",
29122912
match.mask->dst);
2913-
return IAVF_ERR_CONFIG;
2913+
return -EINVAL;
29142914
}
29152915
}
29162916

@@ -2920,7 +2920,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
29202920
} else {
29212921
dev_err(&adapter->pdev->dev, "Bad ether src mask %pM\n",
29222922
match.mask->src);
2923-
return IAVF_ERR_CONFIG;
2923+
return -EINVAL;
29242924
}
29252925
}
29262926

@@ -2955,7 +2955,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
29552955
} else {
29562956
dev_err(&adapter->pdev->dev, "Bad vlan mask %u\n",
29572957
match.mask->vlan_id);
2958-
return IAVF_ERR_CONFIG;
2958+
return -EINVAL;
29592959
}
29602960
}
29612961
vf->mask.tcp_spec.vlan_id |= cpu_to_be16(0xffff);
@@ -2979,7 +2979,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
29792979
} else {
29802980
dev_err(&adapter->pdev->dev, "Bad ip dst mask 0x%08x\n",
29812981
be32_to_cpu(match.mask->dst));
2982-
return IAVF_ERR_CONFIG;
2982+
return -EINVAL;
29832983
}
29842984
}
29852985

@@ -2989,13 +2989,13 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
29892989
} else {
29902990
dev_err(&adapter->pdev->dev, "Bad ip src mask 0x%08x\n",
29912991
be32_to_cpu(match.mask->dst));
2992-
return IAVF_ERR_CONFIG;
2992+
return -EINVAL;
29932993
}
29942994
}
29952995

29962996
if (field_flags & IAVF_CLOUD_FIELD_TEN_ID) {
29972997
dev_info(&adapter->pdev->dev, "Tenant id not allowed for ip filter\n");
2998-
return IAVF_ERR_CONFIG;
2998+
return -EINVAL;
29992999
}
30003000
if (match.key->dst) {
30013001
vf->mask.tcp_spec.dst_ip[0] |= cpu_to_be32(0xffffffff);
@@ -3016,7 +3016,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
30163016
if (ipv6_addr_any(&match.mask->dst)) {
30173017
dev_err(&adapter->pdev->dev, "Bad ipv6 dst mask 0x%02x\n",
30183018
IPV6_ADDR_ANY);
3019-
return IAVF_ERR_CONFIG;
3019+
return -EINVAL;
30203020
}
30213021

30223022
/* src and dest IPv6 address should not be LOOPBACK
@@ -3026,7 +3026,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
30263026
ipv6_addr_loopback(&match.key->src)) {
30273027
dev_err(&adapter->pdev->dev,
30283028
"ipv6 addr should not be loopback\n");
3029-
return IAVF_ERR_CONFIG;
3029+
return -EINVAL;
30303030
}
30313031
if (!ipv6_addr_any(&match.mask->dst) ||
30323032
!ipv6_addr_any(&match.mask->src))
@@ -3051,7 +3051,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
30513051
} else {
30523052
dev_err(&adapter->pdev->dev, "Bad src port mask %u\n",
30533053
be16_to_cpu(match.mask->src));
3054-
return IAVF_ERR_CONFIG;
3054+
return -EINVAL;
30553055
}
30563056
}
30573057

@@ -3061,7 +3061,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
30613061
} else {
30623062
dev_err(&adapter->pdev->dev, "Bad dst port mask %u\n",
30633063
be16_to_cpu(match.mask->dst));
3064-
return IAVF_ERR_CONFIG;
3064+
return -EINVAL;
30653065
}
30663066
}
30673067
if (match.key->dst) {
@@ -3428,6 +3428,8 @@ static int iavf_change_mtu(struct net_device *netdev, int new_mtu)
34283428
{
34293429
struct iavf_adapter *adapter = netdev_priv(netdev);
34303430

3431+
netdev_dbg(netdev, "changing MTU from %d to %d\n",
3432+
netdev->mtu, new_mtu);
34313433
netdev->mtu = new_mtu;
34323434
if (CLIENT_ENABLED(adapter)) {
34333435
iavf_notify_client_l2_params(&adapter->vsi);
@@ -3998,6 +4000,7 @@ static void iavf_remove(struct pci_dev *pdev)
39984000
if (iavf_lock_timeout(&adapter->crit_lock, 5000))
39994001
dev_warn(&adapter->pdev->dev, "failed to acquire crit_lock in %s\n", __FUNCTION__);
40004002

4003+
dev_info(&adapter->pdev->dev, "Removing device\n");
40014004
/* Shut down all the garbage mashers on the detention level */
40024005
iavf_change_state(adapter, __IAVF_REMOVE);
40034006
adapter->aq_required = 0;

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,7 @@ int iavf_napi_poll(struct napi_struct *napi, int budget)
17661766
if (likely(napi_complete_done(napi, work_done)))
17671767
iavf_update_enable_itr(vsi, q_vector);
17681768

1769-
return min(work_done, budget - 1);
1769+
return min_t(int, work_done, budget - 1);
17701770
}
17711771

17721772
/**

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -762,15 +762,23 @@ void iavf_set_promiscuous(struct iavf_adapter *adapter, int flags)
762762
if (flags & FLAG_VF_MULTICAST_PROMISC) {
763763
adapter->flags |= IAVF_FLAG_ALLMULTI_ON;
764764
adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_ALLMULTI;
765-
dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n");
765+
dev_info(&adapter->pdev->dev, "%s is entering multicast promiscuous mode\n",
766+
adapter->netdev->name);
766767
}
767768

768769
if (!flags) {
769-
adapter->flags &= ~(IAVF_FLAG_PROMISC_ON |
770-
IAVF_FLAG_ALLMULTI_ON);
771-
adapter->aq_required &= ~(IAVF_FLAG_AQ_RELEASE_PROMISC |
772-
IAVF_FLAG_AQ_RELEASE_ALLMULTI);
773-
dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n");
770+
if (adapter->flags & IAVF_FLAG_PROMISC_ON) {
771+
adapter->flags &= ~IAVF_FLAG_PROMISC_ON;
772+
adapter->aq_required &= ~IAVF_FLAG_AQ_RELEASE_PROMISC;
773+
dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n");
774+
}
775+
776+
if (adapter->flags & IAVF_FLAG_ALLMULTI_ON) {
777+
adapter->flags &= ~IAVF_FLAG_ALLMULTI_ON;
778+
adapter->aq_required &= ~IAVF_FLAG_AQ_RELEASE_ALLMULTI;
779+
dev_info(&adapter->pdev->dev, "%s is leaving multicast promiscuous mode\n",
780+
adapter->netdev->name);
781+
}
774782
}
775783

776784
adapter->current_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
@@ -1017,7 +1025,7 @@ static void iavf_print_link_message(struct iavf_adapter *adapter)
10171025
} else if (link_speed_mbps == SPEED_UNKNOWN) {
10181026
snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%s", "Unknown Mbps");
10191027
} else {
1020-
snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%u %s",
1028+
snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
10211029
link_speed_mbps, "Mbps");
10221030
}
10231031

@@ -1522,7 +1530,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
15221530
iavf_print_link_message(adapter);
15231531
break;
15241532
case VIRTCHNL_EVENT_RESET_IMPENDING:
1525-
dev_info(&adapter->pdev->dev, "Reset warning received from the PF\n");
1533+
dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n");
15261534
if (!(adapter->flags & IAVF_FLAG_RESET_PENDING)) {
15271535
adapter->flags |= IAVF_FLAG_RESET_PENDING;
15281536
dev_info(&adapter->pdev->dev, "Scheduling reset task\n");

0 commit comments

Comments
 (0)