Commit 3c836451 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

net: move HDS config from ethtool state



Separate the HDS config from the ethtool state struct.
The HDS config contains just simple parameters, not state.
Having it as a separate struct will make it easier to clone / copy
and also long term potentially make it per-queue.

Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250119020518.1962249-2-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e81fdf70
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4610,7 +4610,7 @@ void bnxt_set_tpa_flags(struct bnxt *bp)
static void bnxt_init_ring_params(struct bnxt *bp)
{
	bp->rx_copybreak = BNXT_DEFAULT_RX_COPYBREAK;
	bp->dev->ethtool->hds_thresh = BNXT_DEFAULT_RX_COPYBREAK;
	bp->dev->cfg->hds_thresh = BNXT_DEFAULT_RX_COPYBREAK;
}

/* bp->rx_ring_size, bp->tx_ring_size, dev->mtu, BNXT_FLAG_{G|L}RO flags must
@@ -6585,7 +6585,7 @@ static void bnxt_hwrm_update_rss_hash_cfg(struct bnxt *bp)

static int bnxt_hwrm_vnic_set_hds(struct bnxt *bp, struct bnxt_vnic_info *vnic)
{
	u16 hds_thresh = (u16)bp->dev->ethtool->hds_thresh;
	u16 hds_thresh = (u16)bp->dev->cfg->hds_thresh;
	struct hwrm_vnic_plcmodes_cfg_input *req;
	int rc;

+3 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <linux/ptp_clock_kernel.h>
#include <linux/net_tstamp.h>
#include <linux/timecounter.h>
#include <net/netdev_queues.h>
#include <net/netlink.h>
#include "bnxt_hsi.h"
#include "bnxt.h"
@@ -834,7 +835,7 @@ static void bnxt_get_ringparam(struct net_device *dev,
	ering->rx_jumbo_pending = bp->rx_agg_ring_size;
	ering->tx_pending = bp->tx_ring_size;

	kernel_ering->hds_thresh = dev->ethtool->hds_thresh;
	kernel_ering->hds_thresh = dev->cfg->hds_thresh;
	kernel_ering->hds_thresh_max = BNXT_HDS_THRESHOLD_MAX;
}

@@ -852,7 +853,7 @@ static int bnxt_set_ringparam(struct net_device *dev,
	    (ering->tx_pending < BNXT_MIN_TX_DESC_CNT))
		return -EINVAL;

	hds_config_mod = tcp_data_split != dev->ethtool->hds_config;
	hds_config_mod = tcp_data_split != dev->cfg->hds_config;
	if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_DISABLED && hds_config_mod)
		return -EINVAL;

+5 −4
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@

#include <linux/debugfs.h>
#include <linux/random.h>
#include <net/netdev_queues.h>

#include "netdevsim.h"

@@ -71,8 +72,8 @@ static void nsim_get_ringparam(struct net_device *dev,
	struct netdevsim *ns = netdev_priv(dev);

	memcpy(ring, &ns->ethtool.ring, sizeof(ns->ethtool.ring));
	kernel_ring->tcp_data_split = dev->ethtool->hds_config;
	kernel_ring->hds_thresh = dev->ethtool->hds_thresh;
	kernel_ring->tcp_data_split = dev->cfg->hds_config;
	kernel_ring->hds_thresh = dev->cfg->hds_thresh;
	kernel_ring->hds_thresh_max = NSIM_HDS_THRESHOLD_MAX;

	if (kernel_ring->tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_UNKNOWN)
@@ -190,8 +191,8 @@ static void nsim_ethtool_ring_init(struct netdevsim *ns)
	ns->ethtool.ring.rx_mini_max_pending = 4096;
	ns->ethtool.ring.tx_max_pending = 4096;

	ns->netdev->ethtool->hds_config = ETHTOOL_TCP_DATA_SPLIT_UNKNOWN;
	ns->netdev->ethtool->hds_thresh = 0;
	ns->netdev->cfg->hds_config = ETHTOOL_TCP_DATA_SPLIT_UNKNOWN;
	ns->netdev->cfg->hds_thresh = 0;
}

void nsim_ethtool_init(struct netdevsim *ns)
+5 −5
Original line number Diff line number Diff line
@@ -55,10 +55,10 @@ static int nsim_forward_skb(struct net_device *dev, struct sk_buff *skb,
static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct netdevsim *ns = netdev_priv(dev);
	struct ethtool_netdev_state *ethtool;
	struct net_device *peer_dev;
	unsigned int len = skb->len;
	struct netdevsim *peer_ns;
	struct netdev_config *cfg;
	struct nsim_rq *rq;
	int rxq;

@@ -76,11 +76,11 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
		rxq = rxq % peer_dev->num_rx_queues;
	rq = peer_ns->rq[rxq];

	ethtool = peer_dev->ethtool;
	cfg = peer_dev->cfg;
	if (skb_is_nonlinear(skb) &&
	    (ethtool->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED ||
	     (ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
	      ethtool->hds_thresh > len)))
	    (cfg->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED ||
	     (cfg->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
	      cfg->hds_thresh > len)))
		skb_linearize(skb);

	skb_tx_timestamp(skb);
+0 −4
Original line number Diff line number Diff line
@@ -1171,16 +1171,12 @@ int ethtool_virtdev_set_link_ksettings(struct net_device *dev,
 * @rss_ctx:		XArray of custom RSS contexts
 * @rss_lock:		Protects entries in @rss_ctx.  May be taken from
 *			within RTNL.
 * @hds_thresh:		HDS Threshold value.
 * @hds_config:		HDS value from userspace.
 * @wol_enabled:	Wake-on-LAN is enabled
 * @module_fw_flash_in_progress: Module firmware flashing is in progress.
 */
struct ethtool_netdev_state {
	struct xarray		rss_ctx;
	struct mutex		rss_lock;
	u32			hds_thresh;
	u8			hds_config;
	unsigned		wol_enabled:1;
	unsigned		module_fw_flash_in_progress:1;
};
Loading