Skip to content

Commit 45e60cb

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 40GbE Intel Wired LAN Driver Updates 2017-04-06 This series contains updates to i40e and i40evf. Preethi adds support for the outer checksum and TSO offloads for encapsulated packets for the VF. Mitch fixes a possible memory leak, where we need to remove the client instance when the driver unloads. Also we need to check to see if the client (i40iw) is already present during probe, and add a client instance if necessary. Lastly, make sure we close any attached clients when the driver is removed or shut down to prevent a kernel panic. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents dc423b6 + 921c467 commit 45e60cb

File tree

7 files changed

+93
-56
lines changed

7 files changed

+93
-56
lines changed

drivers/net/ethernet/intel/i40e/i40e_client.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ int i40e_lan_add_device(struct i40e_pf *pf)
436436
pf->hw.pf_id, pf->hw.bus.bus_id,
437437
pf->hw.bus.device, pf->hw.bus.func);
438438

439+
/* If a client has already been registered, we need to add an instance
440+
* of it to our new LAN device.
441+
*/
442+
if (registered_client)
443+
i40e_client_add_instance(pf);
444+
439445
/* Since in some cases register may have happened before a device gets
440446
* added, we can schedule a subtask to go initiate the clients if
441447
* they can be launched at probe time.
@@ -459,6 +465,9 @@ int i40e_lan_del_device(struct i40e_pf *pf)
459465
struct i40e_device *ldev, *tmp;
460466
int ret = -ENODEV;
461467

468+
/* First, remove any client instance. */
469+
i40e_client_del_instance(pf);
470+
462471
mutex_lock(&i40e_device_mutex);
463472
list_for_each_entry_safe(ldev, tmp, &i40e_devices, list) {
464473
if (ldev->pf == pf) {

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9253,6 +9253,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
92539253
u8 broadcast[ETH_ALEN];
92549254
u8 mac_addr[ETH_ALEN];
92559255
int etherdev_size;
9256+
netdev_features_t hw_enc_features;
9257+
netdev_features_t hw_features;
92569258

92579259
etherdev_size = sizeof(struct i40e_netdev_priv);
92589260
netdev = alloc_etherdev_mq(etherdev_size, vsi->alloc_queue_pairs);
@@ -9263,43 +9265,43 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
92639265
np = netdev_priv(netdev);
92649266
np->vsi = vsi;
92659267

9266-
netdev->hw_enc_features |= NETIF_F_SG |
9267-
NETIF_F_IP_CSUM |
9268-
NETIF_F_IPV6_CSUM |
9269-
NETIF_F_HIGHDMA |
9270-
NETIF_F_SOFT_FEATURES |
9271-
NETIF_F_TSO |
9272-
NETIF_F_TSO_ECN |
9273-
NETIF_F_TSO6 |
9274-
NETIF_F_GSO_GRE |
9275-
NETIF_F_GSO_GRE_CSUM |
9276-
NETIF_F_GSO_IPXIP4 |
9277-
NETIF_F_GSO_IPXIP6 |
9278-
NETIF_F_GSO_UDP_TUNNEL |
9279-
NETIF_F_GSO_UDP_TUNNEL_CSUM |
9280-
NETIF_F_GSO_PARTIAL |
9281-
NETIF_F_SCTP_CRC |
9282-
NETIF_F_RXHASH |
9283-
NETIF_F_RXCSUM |
9284-
0;
9268+
hw_enc_features = NETIF_F_SG |
9269+
NETIF_F_IP_CSUM |
9270+
NETIF_F_IPV6_CSUM |
9271+
NETIF_F_HIGHDMA |
9272+
NETIF_F_SOFT_FEATURES |
9273+
NETIF_F_TSO |
9274+
NETIF_F_TSO_ECN |
9275+
NETIF_F_TSO6 |
9276+
NETIF_F_GSO_GRE |
9277+
NETIF_F_GSO_GRE_CSUM |
9278+
NETIF_F_GSO_PARTIAL |
9279+
NETIF_F_GSO_UDP_TUNNEL |
9280+
NETIF_F_GSO_UDP_TUNNEL_CSUM |
9281+
NETIF_F_SCTP_CRC |
9282+
NETIF_F_RXHASH |
9283+
NETIF_F_RXCSUM |
9284+
0;
92859285

92869286
if (!(pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE))
92879287
netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
92889288

92899289
netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
92909290

9291+
netdev->hw_enc_features |= hw_enc_features;
9292+
92919293
/* record features VLANs can make use of */
9292-
netdev->vlan_features |= netdev->hw_enc_features |
9293-
NETIF_F_TSO_MANGLEID;
9294+
netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
92949295

92959296
if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
92969297
netdev->hw_features |= NETIF_F_NTUPLE;
9298+
hw_features = hw_enc_features |
9299+
NETIF_F_HW_VLAN_CTAG_TX |
9300+
NETIF_F_HW_VLAN_CTAG_RX;
92979301

9298-
netdev->hw_features |= netdev->hw_enc_features |
9299-
NETIF_F_HW_VLAN_CTAG_TX |
9300-
NETIF_F_HW_VLAN_CTAG_RX;
9302+
netdev->hw_features |= hw_features;
93019303

9302-
netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
9304+
netdev->features |= hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
93039305
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
93049306

93059307
if (vsi->type == I40E_VSI_MAIN) {
@@ -11393,6 +11395,11 @@ static void i40e_remove(struct pci_dev *pdev)
1139311395
if (pf->service_task.func)
1139411396
cancel_work_sync(&pf->service_task);
1139511397

11398+
/* Client close must be called explicitly here because the timer
11399+
* has been stopped.
11400+
*/
11401+
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
11402+
1139611403
if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
1139711404
i40e_free_vfs(pf);
1139811405
pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
@@ -11633,6 +11640,11 @@ static void i40e_shutdown(struct pci_dev *pdev)
1163311640
cancel_work_sync(&pf->service_task);
1163411641
i40e_fdir_teardown(pf);
1163511642

11643+
/* Client close must be called explicitly here because the timer
11644+
* has been stopped.
11645+
*/
11646+
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
11647+
1163611648
if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE))
1163711649
i40e_enable_mc_magic_wake(pf);
1163811650

drivers/net/ethernet/intel/i40e/i40e_virtchnl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ struct i40e_virtchnl_vsi_resource {
163163
#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
164164
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
165165
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
166-
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00100000
166+
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
167+
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
167168

168169
#define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \
169170
I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,13 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
14081408
I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2;
14091409
}
14101410

1411+
if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_ENCAP)
1412+
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_ENCAP;
1413+
1414+
if ((pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE) &&
1415+
(vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM))
1416+
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM;
1417+
14111418
if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) {
14121419
if (pf->flags & I40E_FLAG_MFP_ENABLED) {
14131420
dev_err(&pf->pdev->dev,

drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ struct i40e_virtchnl_vsi_resource {
163163
#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
164164
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
165165
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
166-
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00100000
166+
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
167+
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
167168

168169
#define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \
169170
I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,8 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
24012401
struct net_device *netdev = adapter->netdev;
24022402
struct i40e_vsi *vsi = &adapter->vsi;
24032403
int i;
2404+
netdev_features_t hw_enc_features;
2405+
netdev_features_t hw_features;
24042406

24052407
/* got VF config message back from PF, now we can parse it */
24062408
for (i = 0; i < vfres->num_vsis; i++) {
@@ -2412,46 +2414,52 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
24122414
return -ENODEV;
24132415
}
24142416

2415-
netdev->hw_enc_features |= NETIF_F_SG |
2416-
NETIF_F_IP_CSUM |
2417-
NETIF_F_IPV6_CSUM |
2418-
NETIF_F_HIGHDMA |
2419-
NETIF_F_SOFT_FEATURES |
2420-
NETIF_F_TSO |
2421-
NETIF_F_TSO_ECN |
2422-
NETIF_F_TSO6 |
2417+
hw_enc_features = NETIF_F_SG |
2418+
NETIF_F_IP_CSUM |
2419+
NETIF_F_IPV6_CSUM |
2420+
NETIF_F_HIGHDMA |
2421+
NETIF_F_SOFT_FEATURES |
2422+
NETIF_F_TSO |
2423+
NETIF_F_TSO_ECN |
2424+
NETIF_F_TSO6 |
2425+
NETIF_F_SCTP_CRC |
2426+
NETIF_F_RXHASH |
2427+
NETIF_F_RXCSUM |
2428+
0;
2429+
2430+
/* advertise to stack only if offloads for encapsulated packets is
2431+
* supported
2432+
*/
2433+
if (vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_ENCAP) {
2434+
hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
24232435
NETIF_F_GSO_GRE |
24242436
NETIF_F_GSO_GRE_CSUM |
24252437
NETIF_F_GSO_IPXIP4 |
24262438
NETIF_F_GSO_IPXIP6 |
2427-
NETIF_F_GSO_UDP_TUNNEL |
24282439
NETIF_F_GSO_UDP_TUNNEL_CSUM |
24292440
NETIF_F_GSO_PARTIAL |
2430-
NETIF_F_SCTP_CRC |
2431-
NETIF_F_RXHASH |
2432-
NETIF_F_RXCSUM |
24332441
0;
24342442

2435-
if (!(adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE))
2436-
netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
2437-
2438-
netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
2443+
if (!(vfres->vf_offload_flags &
2444+
I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM))
2445+
netdev->gso_partial_features |=
2446+
NETIF_F_GSO_UDP_TUNNEL_CSUM;
24392447

2448+
netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
2449+
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
2450+
netdev->hw_enc_features |= hw_enc_features;
2451+
}
24402452
/* record features VLANs can make use of */
2441-
netdev->vlan_features |= netdev->hw_enc_features |
2442-
NETIF_F_TSO_MANGLEID;
2453+
netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
24432454

24442455
/* Write features and hw_features separately to avoid polluting
2445-
* with, or dropping, features that are set when we registgered.
2456+
* with, or dropping, features that are set when we registered.
24462457
*/
2447-
netdev->hw_features |= netdev->hw_enc_features;
2458+
hw_features = hw_enc_features;
24482459

2449-
netdev->features |= netdev->hw_enc_features | I40EVF_VLAN_FEATURES;
2450-
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
2460+
netdev->hw_features |= hw_features;
24512461

2452-
/* disable VLAN features if not supported */
2453-
if (!(vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN))
2454-
netdev->features ^= I40EVF_VLAN_FEATURES;
2462+
netdev->features |= hw_features | I40EVF_VLAN_FEATURES;
24552463

24562464
adapter->vsi.id = adapter->vsi_res->vsi_id;
24572465

@@ -2592,9 +2600,6 @@ static void i40evf_init_task(struct work_struct *work)
25922600
goto err_alloc;
25932601
}
25942602

2595-
if (hw->mac.type == I40E_MAC_X722_VF)
2596-
adapter->flags |= I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE;
2597-
25982603
if (i40evf_process_config(adapter))
25992604
goto err_alloc;
26002605
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;

drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter)
159159
I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG |
160160
I40E_VIRTCHNL_VF_OFFLOAD_VLAN |
161161
I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR |
162-
I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2;
162+
I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 |
163+
I40E_VIRTCHNL_VF_OFFLOAD_ENCAP |
164+
I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM;
163165

164166
adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES;
165167
adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG;

0 commit comments

Comments
 (0)