Commit 45e60cb3 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents dc423b6b 921c467c
...@@ -436,6 +436,12 @@ int i40e_lan_add_device(struct i40e_pf *pf) ...@@ -436,6 +436,12 @@ int i40e_lan_add_device(struct i40e_pf *pf)
pf->hw.pf_id, pf->hw.bus.bus_id, pf->hw.pf_id, pf->hw.bus.bus_id,
pf->hw.bus.device, pf->hw.bus.func); pf->hw.bus.device, pf->hw.bus.func);
/* If a client has already been registered, we need to add an instance
* of it to our new LAN device.
*/
if (registered_client)
i40e_client_add_instance(pf);
/* Since in some cases register may have happened before a device gets /* Since in some cases register may have happened before a device gets
* added, we can schedule a subtask to go initiate the clients if * added, we can schedule a subtask to go initiate the clients if
* they can be launched at probe time. * they can be launched at probe time.
...@@ -459,6 +465,9 @@ int i40e_lan_del_device(struct i40e_pf *pf) ...@@ -459,6 +465,9 @@ int i40e_lan_del_device(struct i40e_pf *pf)
struct i40e_device *ldev, *tmp; struct i40e_device *ldev, *tmp;
int ret = -ENODEV; int ret = -ENODEV;
/* First, remove any client instance. */
i40e_client_del_instance(pf);
mutex_lock(&i40e_device_mutex); mutex_lock(&i40e_device_mutex);
list_for_each_entry_safe(ldev, tmp, &i40e_devices, list) { list_for_each_entry_safe(ldev, tmp, &i40e_devices, list) {
if (ldev->pf == pf) { if (ldev->pf == pf) {
......
...@@ -9253,6 +9253,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9253,6 +9253,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
u8 broadcast[ETH_ALEN]; u8 broadcast[ETH_ALEN];
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
int etherdev_size; int etherdev_size;
netdev_features_t hw_enc_features;
netdev_features_t hw_features;
etherdev_size = sizeof(struct i40e_netdev_priv); etherdev_size = sizeof(struct i40e_netdev_priv);
netdev = alloc_etherdev_mq(etherdev_size, vsi->alloc_queue_pairs); netdev = alloc_etherdev_mq(etherdev_size, vsi->alloc_queue_pairs);
...@@ -9263,7 +9265,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9263,7 +9265,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
np = netdev_priv(netdev); np = netdev_priv(netdev);
np->vsi = vsi; np->vsi = vsi;
netdev->hw_enc_features |= NETIF_F_SG | hw_enc_features = NETIF_F_SG |
NETIF_F_IP_CSUM | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HIGHDMA | NETIF_F_HIGHDMA |
...@@ -9273,11 +9275,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9273,11 +9275,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
NETIF_F_TSO6 | NETIF_F_TSO6 |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL |
NETIF_F_SCTP_CRC | NETIF_F_SCTP_CRC |
NETIF_F_RXHASH | NETIF_F_RXHASH |
NETIF_F_RXCSUM | NETIF_F_RXCSUM |
...@@ -9288,18 +9288,20 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -9288,18 +9288,20 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
netdev->hw_enc_features |= hw_enc_features;
/* record features VLANs can make use of */ /* record features VLANs can make use of */
netdev->vlan_features |= netdev->hw_enc_features | netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
NETIF_F_TSO_MANGLEID;
if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
netdev->hw_features |= NETIF_F_NTUPLE; netdev->hw_features |= NETIF_F_NTUPLE;
hw_features = hw_enc_features |
netdev->hw_features |= netdev->hw_enc_features |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX; NETIF_F_HW_VLAN_CTAG_RX;
netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; netdev->hw_features |= hw_features;
netdev->features |= hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID; netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
if (vsi->type == I40E_VSI_MAIN) { if (vsi->type == I40E_VSI_MAIN) {
...@@ -11393,6 +11395,11 @@ static void i40e_remove(struct pci_dev *pdev) ...@@ -11393,6 +11395,11 @@ static void i40e_remove(struct pci_dev *pdev)
if (pf->service_task.func) if (pf->service_task.func)
cancel_work_sync(&pf->service_task); cancel_work_sync(&pf->service_task);
/* Client close must be called explicitly here because the timer
* has been stopped.
*/
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
i40e_free_vfs(pf); i40e_free_vfs(pf);
pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
...@@ -11633,6 +11640,11 @@ static void i40e_shutdown(struct pci_dev *pdev) ...@@ -11633,6 +11640,11 @@ static void i40e_shutdown(struct pci_dev *pdev)
cancel_work_sync(&pf->service_task); cancel_work_sync(&pf->service_task);
i40e_fdir_teardown(pf); i40e_fdir_teardown(pf);
/* Client close must be called explicitly here because the timer
* has been stopped.
*/
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE)) if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE))
i40e_enable_mc_magic_wake(pf); i40e_enable_mc_magic_wake(pf);
......
...@@ -163,7 +163,8 @@ struct i40e_virtchnl_vsi_resource { ...@@ -163,7 +163,8 @@ struct i40e_virtchnl_vsi_resource {
#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00100000 #define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
#define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \ #define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \
I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \ I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \
......
...@@ -1408,6 +1408,13 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) ...@@ -1408,6 +1408,13 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2; I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2;
} }
if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_ENCAP)
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_ENCAP;
if ((pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE) &&
(vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM))
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM;
if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) { if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) {
if (pf->flags & I40E_FLAG_MFP_ENABLED) { if (pf->flags & I40E_FLAG_MFP_ENABLED) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
......
...@@ -163,7 +163,8 @@ struct i40e_virtchnl_vsi_resource { ...@@ -163,7 +163,8 @@ struct i40e_virtchnl_vsi_resource {
#define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING 0x00020000
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x00040000
#define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF 0X00080000
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00100000 #define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
#define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \ #define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \
I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \ I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \
......
...@@ -2401,6 +2401,8 @@ int i40evf_process_config(struct i40evf_adapter *adapter) ...@@ -2401,6 +2401,8 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct i40e_vsi *vsi = &adapter->vsi; struct i40e_vsi *vsi = &adapter->vsi;
int i; int i;
netdev_features_t hw_enc_features;
netdev_features_t hw_features;
/* got VF config message back from PF, now we can parse it */ /* got VF config message back from PF, now we can parse it */
for (i = 0; i < vfres->num_vsis; i++) { for (i = 0; i < vfres->num_vsis; i++) {
...@@ -2412,7 +2414,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter) ...@@ -2412,7 +2414,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
return -ENODEV; return -ENODEV;
} }
netdev->hw_enc_features |= NETIF_F_SG | hw_enc_features = NETIF_F_SG |
NETIF_F_IP_CSUM | NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_HIGHDMA | NETIF_F_HIGHDMA |
...@@ -2420,38 +2422,44 @@ int i40evf_process_config(struct i40evf_adapter *adapter) ...@@ -2420,38 +2422,44 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
NETIF_F_TSO | NETIF_F_TSO |
NETIF_F_TSO_ECN | NETIF_F_TSO_ECN |
NETIF_F_TSO6 | NETIF_F_TSO6 |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
0;
/* advertise to stack only if offloads for encapsulated packets is
* supported
*/
if (vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_ENCAP) {
hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_GRE | NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 | NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_PARTIAL | NETIF_F_GSO_PARTIAL |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
0; 0;
if (!(adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE)) if (!(vfres->vf_offload_flags &
netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM))
netdev->gso_partial_features |=
NETIF_F_GSO_UDP_TUNNEL_CSUM;
netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
netdev->hw_enc_features |= hw_enc_features;
}
/* record features VLANs can make use of */ /* record features VLANs can make use of */
netdev->vlan_features |= netdev->hw_enc_features | netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
NETIF_F_TSO_MANGLEID;
/* Write features and hw_features separately to avoid polluting /* Write features and hw_features separately to avoid polluting
* with, or dropping, features that are set when we registgered. * with, or dropping, features that are set when we registered.
*/ */
netdev->hw_features |= netdev->hw_enc_features; hw_features = hw_enc_features;
netdev->features |= netdev->hw_enc_features | I40EVF_VLAN_FEATURES; netdev->hw_features |= hw_features;
netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID;
/* disable VLAN features if not supported */ netdev->features |= hw_features | I40EVF_VLAN_FEATURES;
if (!(vfres->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN))
netdev->features ^= I40EVF_VLAN_FEATURES;
adapter->vsi.id = adapter->vsi_res->vsi_id; adapter->vsi.id = adapter->vsi_res->vsi_id;
...@@ -2592,9 +2600,6 @@ static void i40evf_init_task(struct work_struct *work) ...@@ -2592,9 +2600,6 @@ static void i40evf_init_task(struct work_struct *work)
goto err_alloc; goto err_alloc;
} }
if (hw->mac.type == I40E_MAC_X722_VF)
adapter->flags |= I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE;
if (i40evf_process_config(adapter)) if (i40evf_process_config(adapter))
goto err_alloc; goto err_alloc;
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
......
...@@ -159,7 +159,9 @@ int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter) ...@@ -159,7 +159,9 @@ int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter)
I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG | I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG |
I40E_VIRTCHNL_VF_OFFLOAD_VLAN | I40E_VIRTCHNL_VF_OFFLOAD_VLAN |
I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR |
I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2; I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 |
I40E_VIRTCHNL_VF_OFFLOAD_ENCAP |
I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM;
adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES; adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES;
adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG; adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment