Skip to content

Commit fabf1bc

Browse files
anguy11Jeff Kirsher
authored andcommitted
ixgbe: Prevent unsupported configurations with XDP
These changes address comments by Jakub Kicinski on commit 38b7e7f ("ixgbe: Do not allow LRO or MTU change with XDP"). Change the MTU check with XDP to allow any supported value and only reject those outside of the range as opposed to rejecting any change when XDP is active. In situations where MTU size is not supported, return -EINVAL instead of -EPERM. Add checks when enabling SRIOV, DCB, or adding L2FW offloaded device as they are not supported with XDP. CC: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 374f78f commit fabf1bc

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 5 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;

0 commit comments

Comments
 (0)