All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org, mengyuanlou@net-swift.com
Subject: Re: [PATCH net-next 05/10] net: libwx: Allocate Rx and Tx resources
Date: Mon, 23 Jan 2023 16:27:46 +0100	[thread overview]
Message-ID: <Y86ncnPW0ZDfTjye@lunn.ch> (raw)
In-Reply-To: <20230118065504.3075474-6-jiawenwu@trustnetic.com>

> +/**
> + * wx_setup_rx_resources - allocate Rx resources (Descriptors)
> + * @rx_ring: rx descriptor ring (for a specific queue) to setup
> + *
> + * Returns 0 on success, negative on failure
> + **/
> +static int wx_setup_rx_resources(struct wx_ring *rx_ring)
> +{
> +	struct device *dev = rx_ring->dev;
> +	int orig_node = dev_to_node(dev);
> +	int numa_node = -1;
> +	int size, ret;
> +
> +	size = sizeof(struct wx_rx_buffer) * rx_ring->count;
> +
> +	if (rx_ring->q_vector)
> +		numa_node = rx_ring->q_vector->numa_node;
> +
> +	rx_ring->rx_buffer_info = vmalloc_node(size, numa_node);
> +	if (!rx_ring->rx_buffer_info)
> +		rx_ring->rx_buffer_info = vmalloc(size);
> +	if (!rx_ring->rx_buffer_info)
> +		goto err;
> +
> +	/* Round up to nearest 4K */
> +	rx_ring->size = rx_ring->count * sizeof(union wx_rx_desc);
> +	rx_ring->size = ALIGN(rx_ring->size, 4096);
> +
> +	set_dev_node(dev, numa_node);
> +	rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size,
> +					   &rx_ring->dma, GFP_KERNEL);
> +	set_dev_node(dev, orig_node);
> +	rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size,
> +					   &rx_ring->dma, GFP_KERNEL);

Is this double allocation correct?

   Andrew

  parent reply	other threads:[~2023-01-23 15:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  6:54 [PATCH net-next 00/10] Wangxun interrupt and RxTx support Jiawen Wu
2023-01-18  6:54 ` [PATCH net-next 01/10] net: libwx: Add irq flow functions Jiawen Wu
2023-01-18  9:27   ` kernel test robot
2023-01-19 18:14   ` kernel test robot
2023-01-23 15:13   ` Andrew Lunn
2023-01-18  6:54 ` [PATCH net-next 02/10] net: ngbe: Add irqs request flow Jiawen Wu
2023-01-18  6:54 ` [PATCH net-next 03/10] net: txgbe: Add interrupt support Jiawen Wu
2023-01-18  6:54 ` [PATCH net-next 04/10] net: libwx: Configure Rx and Tx unit on hardware Jiawen Wu
2023-01-18  6:54 ` [PATCH net-next 05/10] net: libwx: Allocate Rx and Tx resources Jiawen Wu
2023-01-22  3:05   ` kernel test robot
2023-01-23 15:27   ` Andrew Lunn [this message]
2023-01-18  6:55 ` [PATCH net-next 06/10] net: txgbe: Setup Rx and Tx ring Jiawen Wu
2023-01-18  6:55 ` [PATCH net-next 07/10] net: libwx: Support to receive packets in NAPI Jiawen Wu
2023-01-18  6:55 ` [PATCH net-next 08/10] net: libwx: Add transmit path to process packets Jiawen Wu
2023-01-18  6:55 ` [PATCH net-next 09/10] net: txgbe: Support Rx and Tx process path Jiawen Wu
2023-01-18  6:55 ` [PATCH net-next 10/10] net: ngbe: " Jiawen Wu

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=Y86ncnPW0ZDfTjye@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=jiawenwu@trustnetic.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    /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.