Commit 12508b3e authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'update-xdp_features-flag-according-to-nic-re-configuration'

Lorenzo Bianconi says:

====================
update xdp_features flag according to NIC re-configuration

Changes since v1:
- rebase on top of net tree
- remove NETDEV_XDP_ACT_NDO_XMIT_SG support in mlx5e driver
- always enable NETDEV_XDP_ACT_NDO_XMIT support in mlx5e driver
====================

Link: https://lore.kernel.org/r/cover.1678364612.git.lorenzo@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 7e4f8a0c 481e96fc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ definitions:
  -
    type: flags
    name: xdp-act
    render-max: true
    entries:
      -
        name: basic
+12 −3
Original line number Diff line number Diff line
@@ -850,11 +850,20 @@ static int ena_set_channels(struct net_device *netdev,
	struct ena_adapter *adapter = netdev_priv(netdev);
	u32 count = channels->combined_count;
	/* The check for max value is already done in ethtool */
	if (count < ENA_MIN_NUM_IO_QUEUES ||
	    (ena_xdp_present(adapter) &&
	    !ena_xdp_legal_queue_count(adapter, count)))
	if (count < ENA_MIN_NUM_IO_QUEUES)
		return -EINVAL;

	if (!ena_xdp_legal_queue_count(adapter, count)) {
		if (ena_xdp_present(adapter))
			return -EINVAL;

		xdp_clear_features_flag(netdev);
	} else {
		xdp_set_features_flag(netdev,
				      NETDEV_XDP_ACT_BASIC |
				      NETDEV_XDP_ACT_REDIRECT);
	}

	return ena_update_queue_count(adapter, count);
}

+4 −2
Original line number Diff line number Diff line
@@ -4105,8 +4105,6 @@ static void ena_set_conf_feat_params(struct ena_adapter *adapter,
	/* Set offload features */
	ena_set_dev_offloads(feat, netdev);

	netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT;

	adapter->max_mtu = feat->dev_attr.max_mtu;
	netdev->max_mtu = adapter->max_mtu;
	netdev->min_mtu = ENA_MIN_MTU;
@@ -4393,6 +4391,10 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

	ena_config_debug_area(adapter);

	if (ena_xdp_legal_queue_count(adapter, adapter->num_io_queues))
		netdev->xdp_features = NETDEV_XDP_ACT_BASIC |
				       NETDEV_XDP_ACT_REDIRECT;

	memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len);

	netif_carrier_off(netdev);
+11 −6
Original line number Diff line number Diff line
@@ -735,14 +735,19 @@ static int nicvf_set_channels(struct net_device *dev,
	if (channel->tx_count > nic->max_queues)
		return -EINVAL;

	if (nic->xdp_prog &&
	    ((channel->tx_count + channel->rx_count) > nic->max_queues)) {
	if (channel->tx_count + channel->rx_count > nic->max_queues) {
		if (nic->xdp_prog) {
			netdev_err(nic->netdev,
				   "XDP mode, RXQs + TXQs > Max %d\n",
				   nic->max_queues);
			return -EINVAL;
		}

		xdp_clear_features_flag(nic->netdev);
	} else if (!pass1_silicon(nic->pdev)) {
		xdp_set_features_flag(dev, NETDEV_XDP_ACT_BASIC);
	}

	if (if_up)
		nicvf_stop(dev);

+3 −1
Original line number Diff line number Diff line
@@ -2218,6 +2218,8 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	netdev->netdev_ops = &nicvf_netdev_ops;
	netdev->watchdog_timeo = NICVF_TX_TIMEOUT;

	if (!pass1_silicon(nic->pdev) &&
	    nic->rx_queues + nic->tx_queues <= nic->max_queues)
		netdev->xdp_features = NETDEV_XDP_ACT_BASIC;

	/* MTU range: 64 - 9200 */
Loading