Commit efcb9a4d authored by Pavel Begunkov's avatar Pavel Begunkov
Browse files

net: add bare bone queue configs



We'll need to pass extra parameters when allocating a queue for memory
providers. Define a new structure for queue configurations, and pass it
to qapi callbacks. It's empty for now, actual parameters will be added
in following patches.

Configurations should persist across resets, and for that they're
default-initialised on device registration and stored in struct
netdev_rx_queue. We also add a new qapi callback for defaulting a given
config. It must be implemented if a driver wants to use queue configs
and is optional otherwise.

Suggested-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
parent 92d76cf9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -15911,7 +15911,9 @@ static const struct netdev_stat_ops bnxt_stat_ops = {
	.get_base_stats		= bnxt_get_base_stats,
};

static int bnxt_queue_mem_alloc(struct net_device *dev, void *qmem, int idx)
static int bnxt_queue_mem_alloc(struct net_device *dev,
				struct netdev_queue_config *qcfg,
				void *qmem, int idx)
{
	struct bnxt_rx_ring_info *rxr, *clone;
	struct bnxt *bp = netdev_priv(dev);
@@ -16077,7 +16079,9 @@ static void bnxt_copy_rx_ring(struct bnxt *bp,
	dst->rx_agg_bmap = src->rx_agg_bmap;
}

static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
static int bnxt_queue_start(struct net_device *dev,
			    struct netdev_queue_config *qcfg,
			    void *qmem, int idx)
{
	struct bnxt *bp = netdev_priv(dev);
	struct bnxt_rx_ring_info *rxr, *clone;
+6 −3
Original line number Diff line number Diff line
@@ -2616,8 +2616,9 @@ static void gve_rx_queue_mem_free(struct net_device *dev, void *per_q_mem)
		gve_rx_free_ring_dqo(priv, gve_per_q_mem, &cfg);
}

static int gve_rx_queue_mem_alloc(struct net_device *dev, void *per_q_mem,
				  int idx)
static int gve_rx_queue_mem_alloc(struct net_device *dev,
				  struct netdev_queue_config *qcfg,
				  void *per_q_mem, int idx)
{
	struct gve_priv *priv = netdev_priv(dev);
	struct gve_rx_alloc_rings_cfg cfg = {0};
@@ -2638,7 +2639,9 @@ static int gve_rx_queue_mem_alloc(struct net_device *dev, void *per_q_mem,
	return err;
}

static int gve_rx_queue_start(struct net_device *dev, void *per_q_mem, int idx)
static int gve_rx_queue_start(struct net_device *dev,
			      struct netdev_queue_config *qcfg,
			      void *per_q_mem, int idx)
{
	struct gve_priv *priv = netdev_priv(dev);
	struct gve_rx_ring *gve_per_q_mem;
+6 −4
Original line number Diff line number Diff line
@@ -5596,8 +5596,9 @@ struct mlx5_qmgmt_data {
	struct mlx5e_channel_param cparam;
};

static int mlx5e_queue_mem_alloc(struct net_device *dev, void *newq,
				 int queue_index)
static int mlx5e_queue_mem_alloc(struct net_device *dev,
				 struct netdev_queue_config *qcfg,
				 void *newq, int queue_index)
{
	struct mlx5_qmgmt_data *new = (struct mlx5_qmgmt_data *)newq;
	struct mlx5e_priv *priv = netdev_priv(dev);
@@ -5658,8 +5659,9 @@ static int mlx5e_queue_stop(struct net_device *dev, void *oldq, int queue_index)
	return 0;
}

static int mlx5e_queue_start(struct net_device *dev, void *newq,
			     int queue_index)
static int mlx5e_queue_start(struct net_device *dev,
			     struct netdev_queue_config *qcfg,
			     void *newq, int queue_index)
{
	struct mlx5_qmgmt_data *new = (struct mlx5_qmgmt_data *)newq;
	struct mlx5e_priv *priv = netdev_priv(dev);
+6 −2
Original line number Diff line number Diff line
@@ -2809,7 +2809,9 @@ void fbnic_napi_depletion_check(struct net_device *netdev)
	fbnic_wrfl(fbd);
}

static int fbnic_queue_mem_alloc(struct net_device *dev, void *qmem, int idx)
static int fbnic_queue_mem_alloc(struct net_device *dev,
				 struct netdev_queue_config *qcfg,
				 void *qmem, int idx)
{
	struct fbnic_net *fbn = netdev_priv(dev);
	const struct fbnic_q_triad *real;
@@ -2861,7 +2863,9 @@ static void __fbnic_nv_restart(struct fbnic_net *fbn,
		netif_wake_subqueue(fbn->netdev, nv->qt[i].sub0.q_idx);
}

static int fbnic_queue_start(struct net_device *dev, void *qmem, int idx)
static int fbnic_queue_start(struct net_device *dev,
			     struct netdev_queue_config *qcfg,
			     void *qmem, int idx)
{
	struct fbnic_net *fbn = netdev_priv(dev);
	struct fbnic_napi_vector *nv;
+5 −2
Original line number Diff line number Diff line
@@ -758,7 +758,9 @@ struct nsim_queue_mem {
};

static int
nsim_queue_mem_alloc(struct net_device *dev, void *per_queue_mem, int idx)
nsim_queue_mem_alloc(struct net_device *dev,
		     struct netdev_queue_config *qcfg,
		     void *per_queue_mem, int idx)
{
	struct nsim_queue_mem *qmem = per_queue_mem;
	struct netdevsim *ns = netdev_priv(dev);
@@ -807,7 +809,8 @@ static void nsim_queue_mem_free(struct net_device *dev, void *per_queue_mem)
}

static int
nsim_queue_start(struct net_device *dev, void *per_queue_mem, int idx)
nsim_queue_start(struct net_device *dev, struct netdev_queue_config *qcfg,
		 void *per_queue_mem, int idx)
{
	struct nsim_queue_mem *qmem = per_queue_mem;
	struct netdevsim *ns = netdev_priv(dev);
Loading