Commit ae923785 authored by David S. Miller's avatar David S. Miller

Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2018-08-24

This series contains fixes to e1000, igb, ixgb, ixgbe and i40e.

YueHaibing from Huawei provides a change to use dma_zalloc_coherent()
instead of calls to allocator followed by a memset for ixgb.

Bo Chen provides a couple of fixes for e1000, first by adding a check to
prevent a NULL pointer dereference.  The second change is to clean up a
possible resource leak on old transmit and receive rings when the device
is not up.

Jesus fixes an issue in the usage of an advanced transmit context
descriptor for retrieving the timestamp of a packet for AF_PACKET if the
IGB_TX_FLAGS_VLAN is not set in igb.

Jia-Ju Bai provides several patches which replace GFP_ATOMIC with
GFP_KERNEL, when using kzalloc() and kcalloc() which is not necessary.
Also found an instance of mdelay() call which could be replaced with
msleep().

Tony fixes ixgbe to allow MTU changes with XDP, by adding checks to
ensure only supported values and return -EINVAL for when it is not
supported.

Sebastian fixed an issue that was not clearing VF mailbox memory and
ensure queues are re-enabled correctly.

Martyna fixes a transmit timeout when DCB is configured when bringing up
an interface.

Jake fixes a previous commit which accidentally reversed the check of
the data pointer, so we can accurately count the size of the stats.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ff0fadff 07f37013
...@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev, ...@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev,
adapter->tx_ring = tx_old; adapter->tx_ring = tx_old;
e1000_free_all_rx_resources(adapter); e1000_free_all_rx_resources(adapter);
e1000_free_all_tx_resources(adapter); e1000_free_all_tx_resources(adapter);
kfree(tx_old);
kfree(rx_old);
adapter->rx_ring = rxdr; adapter->rx_ring = rxdr;
adapter->tx_ring = txdr; adapter->tx_ring = txdr;
err = e1000_up(adapter); err = e1000_up(adapter);
if (err) if (err)
goto err_setup; goto err_setup;
} }
kfree(tx_old);
kfree(rx_old);
clear_bit(__E1000_RESETTING, &adapter->flags); clear_bit(__E1000_RESETTING, &adapter->flags);
return 0; return 0;
...@@ -644,7 +644,8 @@ static int e1000_set_ringparam(struct net_device *netdev, ...@@ -644,7 +644,8 @@ static int e1000_set_ringparam(struct net_device *netdev,
err_alloc_rx: err_alloc_rx:
kfree(txdr); kfree(txdr);
err_alloc_tx: err_alloc_tx:
e1000_up(adapter); if (netif_running(adapter->netdev))
e1000_up(adapter);
err_setup: err_setup:
clear_bit(__E1000_RESETTING, &adapter->flags); clear_bit(__E1000_RESETTING, &adapter->flags);
return err; return err;
......
...@@ -2013,7 +2013,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data) ...@@ -2013,7 +2013,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data)
for (i = 0; i < I40E_MAX_USER_PRIORITY; i++) for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
i40e_add_stat_strings(&data, i40e_gstrings_pfc_stats, i); i40e_add_stat_strings(&data, i40e_gstrings_pfc_stats, i);
WARN_ONCE(p - data != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN, WARN_ONCE(data - p != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
"stat strings count mismatch!"); "stat strings count mismatch!");
} }
......
...@@ -5122,15 +5122,17 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, ...@@ -5122,15 +5122,17 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,
u8 *bw_share) u8 *bw_share)
{ {
struct i40e_aqc_configure_vsi_tc_bw_data bw_data; struct i40e_aqc_configure_vsi_tc_bw_data bw_data;
struct i40e_pf *pf = vsi->back;
i40e_status ret; i40e_status ret;
int i; int i;
if (vsi->back->flags & I40E_FLAG_TC_MQPRIO) /* There is no need to reset BW when mqprio mode is on. */
if (pf->flags & I40E_FLAG_TC_MQPRIO)
return 0; return 0;
if (!vsi->mqprio_qopt.qopt.hw) { if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) {
ret = i40e_set_bw_limit(vsi, vsi->seid, 0); ret = i40e_set_bw_limit(vsi, vsi->seid, 0);
if (ret) if (ret)
dev_info(&vsi->back->pdev->dev, dev_info(&pf->pdev->dev,
"Failed to reset tx rate for vsi->seid %u\n", "Failed to reset tx rate for vsi->seid %u\n",
vsi->seid); vsi->seid);
return ret; return ret;
...@@ -5139,12 +5141,11 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, ...@@ -5139,12 +5141,11 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
bw_data.tc_bw_credits[i] = bw_share[i]; bw_data.tc_bw_credits[i] = bw_share[i];
ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data, ret = i40e_aq_config_vsi_tc_bw(&pf->hw, vsi->seid, &bw_data, NULL);
NULL);
if (ret) { if (ret) {
dev_info(&vsi->back->pdev->dev, dev_info(&pf->pdev->dev,
"AQ command Config VSI BW allocation per TC failed = %d\n", "AQ command Config VSI BW allocation per TC failed = %d\n",
vsi->back->hw.aq.asq_last_status); pf->hw.aq.asq_last_status);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1649,7 +1649,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) ...@@ -1649,7 +1649,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
if (hw->phy.type == e1000_phy_m88) if (hw->phy.type == e1000_phy_m88)
igb_phy_disable_receiver(adapter); igb_phy_disable_receiver(adapter);
mdelay(500); msleep(500);
return 0; return 0;
} }
......
...@@ -3873,7 +3873,7 @@ static int igb_sw_init(struct igb_adapter *adapter) ...@@ -3873,7 +3873,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
adapter->mac_table = kcalloc(hw->mac.rar_entry_count, adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
sizeof(struct igb_mac_addr), sizeof(struct igb_mac_addr),
GFP_ATOMIC); GFP_KERNEL);
if (!adapter->mac_table) if (!adapter->mac_table)
return -ENOMEM; return -ENOMEM;
...@@ -3883,7 +3883,7 @@ static int igb_sw_init(struct igb_adapter *adapter) ...@@ -3883,7 +3883,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
/* Setup and initialize a copy of the hw vlan table array */ /* Setup and initialize a copy of the hw vlan table array */
adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32), adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32),
GFP_ATOMIC); GFP_KERNEL);
if (!adapter->shadow_vfta) if (!adapter->shadow_vfta)
return -ENOMEM; return -ENOMEM;
...@@ -5816,7 +5816,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first) ...@@ -5816,7 +5816,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first)
if (skb->ip_summed != CHECKSUM_PARTIAL) { if (skb->ip_summed != CHECKSUM_PARTIAL) {
csum_failed: csum_failed:
if (!(first->tx_flags & IGB_TX_FLAGS_VLAN)) if (!(first->tx_flags & IGB_TX_FLAGS_VLAN) &&
!tx_ring->launchtime_enable)
return; return;
goto no_csum; goto no_csum;
} }
......
...@@ -771,14 +771,13 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter) ...@@ -771,14 +771,13 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc); rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
rxdr->size = ALIGN(rxdr->size, 4096); rxdr->size = ALIGN(rxdr->size, 4096);
rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
GFP_KERNEL); GFP_KERNEL);
if (!rxdr->desc) { if (!rxdr->desc) {
vfree(rxdr->buffer_info); vfree(rxdr->buffer_info);
return -ENOMEM; return -ENOMEM;
} }
memset(rxdr->desc, 0, rxdr->size);
rxdr->next_to_clean = 0; rxdr->next_to_clean = 0;
rxdr->next_to_use = 0; rxdr->next_to_use = 0;
......
...@@ -192,7 +192,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid, ...@@ -192,7 +192,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid,
} }
/* alloc the udl from per cpu ddp pool */ /* alloc the udl from per cpu ddp pool */
ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp); ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_KERNEL, &ddp->udp);
if (!ddp->udl) { if (!ddp->udl) {
e_err(drv, "failed allocated ddp context\n"); e_err(drv, "failed allocated ddp context\n");
goto out_noddp_unmap; goto out_noddp_unmap;
...@@ -760,7 +760,7 @@ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter) ...@@ -760,7 +760,7 @@ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter)
return 0; return 0;
/* Extra buffer to be shared by all DDPs for HW work around */ /* Extra buffer to be shared by all DDPs for HW work around */
buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC); buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_KERNEL);
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
......
...@@ -6201,7 +6201,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, ...@@ -6201,7 +6201,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
adapter->mac_table = kcalloc(hw->mac.num_rar_entries, adapter->mac_table = kcalloc(hw->mac.num_rar_entries,
sizeof(struct ixgbe_mac_addr), sizeof(struct ixgbe_mac_addr),
GFP_ATOMIC); GFP_KERNEL);
if (!adapter->mac_table) if (!adapter->mac_table)
return -ENOMEM; return -ENOMEM;
...@@ -6620,8 +6620,18 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -6620,8 +6620,18 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
if (adapter->xdp_prog) { if (adapter->xdp_prog) {
e_warn(probe, "MTU cannot be changed while XDP program is loaded\n"); int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
return -EPERM; VLAN_HLEN;
int i;
for (i = 0; i < adapter->num_rx_queues; i++) {
struct ixgbe_ring *ring = adapter->rx_ring[i];
if (new_frame_size > ixgbe_rx_bufsz(ring)) {
e_warn(probe, "Requested MTU size is not supported with XDP\n");
return -EINVAL;
}
}
} }
/* /*
...@@ -8983,6 +8993,15 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) ...@@ -8983,6 +8993,15 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
#ifdef CONFIG_IXGBE_DCB #ifdef CONFIG_IXGBE_DCB
if (tc) { if (tc) {
if (adapter->xdp_prog) {
e_warn(probe, "DCB is not supported with XDP\n");
ixgbe_init_interrupt_scheme(adapter);
if (netif_running(dev))
ixgbe_open(dev);
return -EINVAL;
}
netdev_set_num_tc(dev, tc); netdev_set_num_tc(dev, tc);
ixgbe_set_prio_tc_map(adapter); ixgbe_set_prio_tc_map(adapter);
...@@ -9934,6 +9953,11 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) ...@@ -9934,6 +9953,11 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
int tcs = adapter->hw_tcs ? : 1; int tcs = adapter->hw_tcs ? : 1;
int pool, err; int pool, err;
if (adapter->xdp_prog) {
e_warn(probe, "L2FW offload is not supported with XDP\n");
return ERR_PTR(-EINVAL);
}
/* The hardware supported by ixgbe only filters on the destination MAC /* The hardware supported by ixgbe only filters on the destination MAC
* address. In order to avoid issues we only support offloading modes * address. In order to avoid issues we only support offloading modes
* where the hardware can actually provide the functionality. * where the hardware can actually provide the functionality.
......
...@@ -53,6 +53,11 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter, ...@@ -53,6 +53,11 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
int i; int i;
if (adapter->xdp_prog) {
e_warn(probe, "SRIOV is not supported with XDP\n");
return -EINVAL;
}
/* Enable VMDq flag so device will be set in VM mode */ /* Enable VMDq flag so device will be set in VM mode */
adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED | adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED |
IXGBE_FLAG_VMDQ_ENABLED; IXGBE_FLAG_VMDQ_ENABLED;
...@@ -688,8 +693,13 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, ...@@ -688,8 +693,13 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
{ {
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; struct vf_data_storage *vfinfo = &adapter->vfinfo[vf];
u32 q_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
u8 num_tcs = adapter->hw_tcs; u8 num_tcs = adapter->hw_tcs;
u32 reg_val;
u32 queue;
u32 word;
/* remove VLAN filters beloning to this VF */ /* remove VLAN filters beloning to this VF */
ixgbe_clear_vf_vlans(adapter, vf); ixgbe_clear_vf_vlans(adapter, vf);
...@@ -726,6 +736,27 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) ...@@ -726,6 +736,27 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
/* reset VF api back to unknown */ /* reset VF api back to unknown */
adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10; adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10;
/* Restart each queue for given VF */
for (queue = 0; queue < q_per_pool; queue++) {
unsigned int reg_idx = (vf * q_per_pool) + queue;
reg_val = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(reg_idx));
/* Re-enabling only configured queues */
if (reg_val) {
reg_val |= IXGBE_TXDCTL_ENABLE;
IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val);
reg_val &= ~IXGBE_TXDCTL_ENABLE;
IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val);
}
}
/* Clear VF's mailbox memory */
for (word = 0; word < IXGBE_VFMAILBOX_SIZE; word++)
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf), word, 0);
IXGBE_WRITE_FLUSH(hw);
} }
static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,
......
...@@ -2518,6 +2518,7 @@ enum { ...@@ -2518,6 +2518,7 @@ enum {
/* Translated register #defines */ /* Translated register #defines */
#define IXGBE_PVFTDH(P) (0x06010 + (0x40 * (P))) #define IXGBE_PVFTDH(P) (0x06010 + (0x40 * (P)))
#define IXGBE_PVFTDT(P) (0x06018 + (0x40 * (P))) #define IXGBE_PVFTDT(P) (0x06018 + (0x40 * (P)))
#define IXGBE_PVFTXDCTL(P) (0x06028 + (0x40 * (P)))
#define IXGBE_PVFTDWBAL(P) (0x06038 + (0x40 * (P))) #define IXGBE_PVFTDWBAL(P) (0x06038 + (0x40 * (P)))
#define IXGBE_PVFTDWBAH(P) (0x0603C + (0x40 * (P))) #define IXGBE_PVFTDWBAH(P) (0x0603C + (0x40 * (P)))
......
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