Skip to content

Commit ae92378

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents ff0fadf + 07f3701 commit ae92378

File tree

10 files changed

+81
-23
lines changed

10 files changed

+81
-23
lines changed

drivers/net/ethernet/intel/e1000/e1000_ethtool.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev,
624624
adapter->tx_ring = tx_old;
625625
e1000_free_all_rx_resources(adapter);
626626
e1000_free_all_tx_resources(adapter);
627-
kfree(tx_old);
628-
kfree(rx_old);
629627
adapter->rx_ring = rxdr;
630628
adapter->tx_ring = txdr;
631629
err = e1000_up(adapter);
632630
if (err)
633631
goto err_setup;
634632
}
633+
kfree(tx_old);
634+
kfree(rx_old);
635635

636636
clear_bit(__E1000_RESETTING, &adapter->flags);
637637
return 0;
@@ -644,7 +644,8 @@ static int e1000_set_ringparam(struct net_device *netdev,
644644
err_alloc_rx:
645645
kfree(txdr);
646646
err_alloc_tx:
647-
e1000_up(adapter);
647+
if (netif_running(adapter->netdev))
648+
e1000_up(adapter);
648649
err_setup:
649650
clear_bit(__E1000_RESETTING, &adapter->flags);
650651
return err;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data)
20132013
for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
20142014
i40e_add_stat_strings(&data, i40e_gstrings_pfc_stats, i);
20152015

2016-
WARN_ONCE(p - data != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
2016+
WARN_ONCE(data - p != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
20172017
"stat strings count mismatch!");
20182018
}
20192019

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5122,15 +5122,17 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,
51225122
u8 *bw_share)
51235123
{
51245124
struct i40e_aqc_configure_vsi_tc_bw_data bw_data;
5125+
struct i40e_pf *pf = vsi->back;
51255126
i40e_status ret;
51265127
int i;
51275128

5128-
if (vsi->back->flags & I40E_FLAG_TC_MQPRIO)
5129+
/* There is no need to reset BW when mqprio mode is on. */
5130+
if (pf->flags & I40E_FLAG_TC_MQPRIO)
51295131
return 0;
5130-
if (!vsi->mqprio_qopt.qopt.hw) {
5132+
if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) {
51315133
ret = i40e_set_bw_limit(vsi, vsi->seid, 0);
51325134
if (ret)
5133-
dev_info(&vsi->back->pdev->dev,
5135+
dev_info(&pf->pdev->dev,
51345136
"Failed to reset tx rate for vsi->seid %u\n",
51355137
vsi->seid);
51365138
return ret;
@@ -5139,12 +5141,11 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,
51395141
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
51405142
bw_data.tc_bw_credits[i] = bw_share[i];
51415143

5142-
ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data,
5143-
NULL);
5144+
ret = i40e_aq_config_vsi_tc_bw(&pf->hw, vsi->seid, &bw_data, NULL);
51445145
if (ret) {
5145-
dev_info(&vsi->back->pdev->dev,
5146+
dev_info(&pf->pdev->dev,
51465147
"AQ command Config VSI BW allocation per TC failed = %d\n",
5147-
vsi->back->hw.aq.asq_last_status);
5148+
pf->hw.aq.asq_last_status);
51485149
return -EINVAL;
51495150
}
51505151

drivers/net/ethernet/intel/igb/igb_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
16491649
if (hw->phy.type == e1000_phy_m88)
16501650
igb_phy_disable_receiver(adapter);
16511651

1652-
mdelay(500);
1652+
msleep(500);
16531653
return 0;
16541654
}
16551655

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3873,7 +3873,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
38733873

38743874
adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
38753875
sizeof(struct igb_mac_addr),
3876-
GFP_ATOMIC);
3876+
GFP_KERNEL);
38773877
if (!adapter->mac_table)
38783878
return -ENOMEM;
38793879

@@ -3883,7 +3883,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
38833883

38843884
/* Setup and initialize a copy of the hw vlan table array */
38853885
adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32),
3886-
GFP_ATOMIC);
3886+
GFP_KERNEL);
38873887
if (!adapter->shadow_vfta)
38883888
return -ENOMEM;
38893889

@@ -5816,7 +5816,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first)
58165816

58175817
if (skb->ip_summed != CHECKSUM_PARTIAL) {
58185818
csum_failed:
5819-
if (!(first->tx_flags & IGB_TX_FLAGS_VLAN))
5819+
if (!(first->tx_flags & IGB_TX_FLAGS_VLAN) &&
5820+
!tx_ring->launchtime_enable)
58205821
return;
58215822
goto no_csum;
58225823
}

drivers/net/ethernet/intel/ixgb/ixgb_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,14 +771,13 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
771771
rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
772772
rxdr->size = ALIGN(rxdr->size, 4096);
773773

774-
rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
775-
GFP_KERNEL);
774+
rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
775+
GFP_KERNEL);
776776

777777
if (!rxdr->desc) {
778778
vfree(rxdr->buffer_info);
779779
return -ENOMEM;
780780
}
781-
memset(rxdr->desc, 0, rxdr->size);
782781

783782
rxdr->next_to_clean = 0;
784783
rxdr->next_to_use = 0;

drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid,
192192
}
193193

194194
/* alloc the udl from per cpu ddp pool */
195-
ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp);
195+
ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_KERNEL, &ddp->udp);
196196
if (!ddp->udl) {
197197
e_err(drv, "failed allocated ddp context\n");
198198
goto out_noddp_unmap;
@@ -760,7 +760,7 @@ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter)
760760
return 0;
761761

762762
/* Extra buffer to be shared by all DDPs for HW work around */
763-
buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC);
763+
buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_KERNEL);
764764
if (!buffer)
765765
return -ENOMEM;
766766

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6201,7 +6201,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
62016201

62026202
adapter->mac_table = kcalloc(hw->mac.num_rar_entries,
62036203
sizeof(struct ixgbe_mac_addr),
6204-
GFP_ATOMIC);
6204+
GFP_KERNEL);
62056205
if (!adapter->mac_table)
62066206
return -ENOMEM;
62076207

@@ -6620,8 +6620,18 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
66206620
struct ixgbe_adapter *adapter = netdev_priv(netdev);
66216621

66226622
if (adapter->xdp_prog) {
6623-
e_warn(probe, "MTU cannot be changed while XDP program is loaded\n");
6624-
return -EPERM;
6623+
int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
6624+
VLAN_HLEN;
6625+
int i;
6626+
6627+
for (i = 0; i < adapter->num_rx_queues; i++) {
6628+
struct ixgbe_ring *ring = adapter->rx_ring[i];
6629+
6630+
if (new_frame_size > ixgbe_rx_bufsz(ring)) {
6631+
e_warn(probe, "Requested MTU size is not supported with XDP\n");
6632+
return -EINVAL;
6633+
}
6634+
}
66256635
}
66266636

66276637
/*
@@ -8983,6 +8993,15 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
89838993

89848994
#ifdef CONFIG_IXGBE_DCB
89858995
if (tc) {
8996+
if (adapter->xdp_prog) {
8997+
e_warn(probe, "DCB is not supported with XDP\n");
8998+
8999+
ixgbe_init_interrupt_scheme(adapter);
9000+
if (netif_running(dev))
9001+
ixgbe_open(dev);
9002+
return -EINVAL;
9003+
}
9004+
89869005
netdev_set_num_tc(dev, tc);
89879006
ixgbe_set_prio_tc_map(adapter);
89889007

@@ -9934,6 +9953,11 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
99349953
int tcs = adapter->hw_tcs ? : 1;
99359954
int pool, err;
99369955

9956+
if (adapter->xdp_prog) {
9957+
e_warn(probe, "L2FW offload is not supported with XDP\n");
9958+
return ERR_PTR(-EINVAL);
9959+
}
9960+
99379961
/* The hardware supported by ixgbe only filters on the destination MAC
99389962
* address. In order to avoid issues we only support offloading modes
99399963
* where the hardware can actually provide the functionality.

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
5353
struct ixgbe_hw *hw = &adapter->hw;
5454
int i;
5555

56+
if (adapter->xdp_prog) {
57+
e_warn(probe, "SRIOV is not supported with XDP\n");
58+
return -EINVAL;
59+
}
60+
5661
/* Enable VMDq flag so device will be set in VM mode */
5762
adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED |
5863
IXGBE_FLAG_VMDQ_ENABLED;
@@ -688,8 +693,13 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
688693
static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
689694
{
690695
struct ixgbe_hw *hw = &adapter->hw;
696+
struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
691697
struct vf_data_storage *vfinfo = &adapter->vfinfo[vf];
698+
u32 q_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
692699
u8 num_tcs = adapter->hw_tcs;
700+
u32 reg_val;
701+
u32 queue;
702+
u32 word;
693703

694704
/* remove VLAN filters beloning to this VF */
695705
ixgbe_clear_vf_vlans(adapter, vf);
@@ -726,6 +736,27 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
726736

727737
/* reset VF api back to unknown */
728738
adapter->vfinfo[vf].vf_api = ixgbe_mbox_api_10;
739+
740+
/* Restart each queue for given VF */
741+
for (queue = 0; queue < q_per_pool; queue++) {
742+
unsigned int reg_idx = (vf * q_per_pool) + queue;
743+
744+
reg_val = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(reg_idx));
745+
746+
/* Re-enabling only configured queues */
747+
if (reg_val) {
748+
reg_val |= IXGBE_TXDCTL_ENABLE;
749+
IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val);
750+
reg_val &= ~IXGBE_TXDCTL_ENABLE;
751+
IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(reg_idx), reg_val);
752+
}
753+
}
754+
755+
/* Clear VF's mailbox memory */
756+
for (word = 0; word < IXGBE_VFMAILBOX_SIZE; word++)
757+
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf), word, 0);
758+
759+
IXGBE_WRITE_FLUSH(hw);
729760
}
730761

731762
static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,

drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,7 @@ enum {
25182518
/* Translated register #defines */
25192519
#define IXGBE_PVFTDH(P) (0x06010 + (0x40 * (P)))
25202520
#define IXGBE_PVFTDT(P) (0x06018 + (0x40 * (P)))
2521+
#define IXGBE_PVFTXDCTL(P) (0x06028 + (0x40 * (P)))
25212522
#define IXGBE_PVFTDWBAL(P) (0x06038 + (0x40 * (P)))
25222523
#define IXGBE_PVFTDWBAH(P) (0x0603C + (0x40 * (P)))
25232524

0 commit comments

Comments
 (0)