Skip to content

Commit 8e67902

Browse files
jrfastabJeff Kirsher
authored andcommitted
ixgbe: incorrect XDP ring accounting in ethtool tx_frame param
Changing the TX ring parameters with an XDP program attached may cause the XDP queues to be cleared and the TX rings to be incorrectly configured. Fix by doing correct ring accounting in setup call. Fixes: 33fdc82 ("ixgbe: add support for XDP_TX action") Signed-off-by: John Fastabend <john.fastabend@gmail.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 5e0fac6 commit 8e67902

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
10481048
{
10491049
struct ixgbe_adapter *adapter = netdev_priv(netdev);
10501050
struct ixgbe_ring *temp_ring;
1051-
int i, err = 0;
1051+
int i, j, err = 0;
10521052
u32 new_rx_count, new_tx_count;
10531053

10541054
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
@@ -1085,8 +1085,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
10851085
}
10861086

10871087
/* allocate temporary buffer to store rings in */
1088-
i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues);
1089-
i = max_t(int, i, adapter->num_xdp_queues);
1088+
i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues,
1089+
adapter->num_rx_queues);
10901090
temp_ring = vmalloc(i * sizeof(struct ixgbe_ring));
10911091

10921092
if (!temp_ring) {
@@ -1118,8 +1118,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
11181118
}
11191119
}
11201120

1121-
for (i = 0; i < adapter->num_xdp_queues; i++) {
1122-
memcpy(&temp_ring[i], adapter->xdp_ring[i],
1121+
for (j = 0; j < adapter->num_xdp_queues; j++, i++) {
1122+
memcpy(&temp_ring[i], adapter->xdp_ring[j],
11231123
sizeof(struct ixgbe_ring));
11241124

11251125
temp_ring[i].count = new_tx_count;
@@ -1139,10 +1139,10 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
11391139
memcpy(adapter->tx_ring[i], &temp_ring[i],
11401140
sizeof(struct ixgbe_ring));
11411141
}
1142-
for (i = 0; i < adapter->num_xdp_queues; i++) {
1143-
ixgbe_free_tx_resources(adapter->xdp_ring[i]);
1142+
for (j = 0; j < adapter->num_xdp_queues; j++, i++) {
1143+
ixgbe_free_tx_resources(adapter->xdp_ring[j]);
11441144

1145-
memcpy(adapter->xdp_ring[i], &temp_ring[i],
1145+
memcpy(adapter->xdp_ring[j], &temp_ring[i],
11461146
sizeof(struct ixgbe_ring));
11471147
}
11481148

0 commit comments

Comments
 (0)