All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Mina Almasry <almasrymina@google.com>
Cc: Shailend Chand <shailend@google.com>,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, willemb@google.com
Subject: Re: [RFC PATCH net-next 9/9] gve: Implement queue api
Date: Fri, 19 Apr 2024 20:25:35 -0700	[thread overview]
Message-ID: <20240419202535.5c5097fe@kernel.org> (raw)
In-Reply-To: <CAHS8izO=Vc6Kxx620_y6v-3PtRL3_UFP6zDRfgLf85SXpP0+dQ@mail.gmail.com>

On Fri, 19 Apr 2024 09:10:42 -0700 Mina Almasry wrote:
> Currently the ndos don't include an interface for the driver to
> declare the size, right? In theory we could add it to the ndos like
> so, if I understood you correctly (untested yet, just to illustrate
> what I'm thinking point):
> 
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c
> b/drivers/net/ethernet/google/gve/gve_main.c
> index 7c38dc06a392..efe3944b529a 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -2579,11 +2579,16 @@ static void gve_write_version(u8 __iomem
> *driver_version_register)
>   writeb('\n', driver_version_register);
>  }
> 
> +static size_t gve_rx_queue_mem_get_size(void)
> +{
> + return sizeof(struct gve_rx_ring);
> +}

> @@ -2709,6 +2709,7 @@ static const struct netdev_queue_mgmt_ops
> gve_queue_mgmt_ops = {
>   .ndo_queue_mem_free = gve_rx_queue_mem_free,
>   .ndo_queue_start = gve_rx_queue_start,
>   .ndo_queue_stop = gve_rx_queue_stop,
> + .ndo_queue_mem_get_size = gve_rx_queue_mem_get_size,
>  };

I don't think we need to make it a callback, even, directly:

const struct netdev_queue_mgmt_ops gve_queue_mgmt_ops = {
+	.queue_mem_size		= sizeof(struct gve_rx_ring),
 	.ndo_queue_mem_free	= gve_rx_queue_mem_free,
 	.ndo_queue_start	= gve_rx_queue_start,
 	.ndo_queue_stop		= gve_rx_queue_stop,

> I think maybe if we want to apply this change to mem_stop, then we
> should probably also apply this change to queue_mem_alloc as well,
> right? I.e. core will allocate the pointer, and ndo_queue_mem_alloc
> would allocate the actual resources and would fill in the entries of
> the pointer? Is this what you're looking for here?

Yup. But thinking about it again, this may be more natural once we also
have the open/close path use the queue API. IIUC for now the driver
allocates the queue resources on open, without going via .ndo_queue_*
If that's the case we can keep the code as you have it here.

  reply	other threads:[~2024-04-20  3:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 19:51 [RFC PATCH net-next 0/9] gve: Implement netdev queue api Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 1/9] queue_api: define " Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 2/9] gve: Make the RX free queue funcs idempotent Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 3/9] gve: Add adminq funcs to add/remove a single Rx queue Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 4/9] gve: Make gve_turn(up|down) ignore stopped queues Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 5/9] gve: Make gve_turnup work for nonempty queues Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 6/9] gve: Avoid rescheduling napi if on wrong cpu Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 7/9] gve: Reset Rx ring state in the ring-stop funcs Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 8/9] gve: Account for stopped queues when reading NIC stats Shailend Chand
2024-04-18 19:51 ` [RFC PATCH net-next 9/9] gve: Implement queue api Shailend Chand
2024-04-19  1:48   ` Jakub Kicinski
2024-04-19 16:10     ` Mina Almasry
2024-04-20  3:25       ` Jakub Kicinski [this message]
2024-04-22 16:58         ` Mina Almasry
2024-04-22 18:41           ` Jakub Kicinski
2024-04-19 22:23   ` Shailend Chand
2024-04-23 17:55     ` David Wei
2024-04-23 17:33   ` David Wei
2024-04-18 21:55 ` [RFC PATCH net-next 0/9] gve: Implement netdev " Mina Almasry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240419202535.5c5097fe@kernel.org \
    --to=kuba@kernel.org \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shailend@google.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.