lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190531174643.4be8b27f@carbon>
Date:   Fri, 31 May 2019 17:46:43 +0200
From:   Jesper Dangaard Brouer <brouer@...hat.com>
To:     Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>
Cc:     grygorii.strashko@...com, hawk@...nel.org, davem@...emloft.net,
        ast@...nel.org, linux-kernel@...r.kernel.org,
        linux-omap@...r.kernel.org, xdp-newbies@...r.kernel.org,
        ilias.apalodimas@...aro.org, netdev@...r.kernel.org,
        daniel@...earbox.net, jakub.kicinski@...ronome.com,
        john.fastabend@...il.com, brouer@...hat.com
Subject: Re: [PATCH v2 net-next 7/7] net: ethernet: ti: cpsw: add XDP
 support


Hi Ivan,

>From below code snippets, it looks like you only allocated 1 page_pool
and sharing it with several RX-queues, as I don't have the full context
and don't know this driver, I might be wrong?

To be clear, a page_pool object is needed per RX-queue, as it is
accessing a small RX page cache (which protected by NAPI/softirq).

On Thu, 30 May 2019 21:20:39 +0300
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org> wrote:

> @@ -1404,6 +1711,14 @@ static int cpsw_ndo_open(struct net_device *ndev)
>  			enable_irq(cpsw->irqs_table[0]);
>  		}
>  
> +		pool_size = cpdma_get_num_rx_descs(cpsw->dma);
> +		cpsw->page_pool = cpsw_create_page_pool(cpsw, pool_size);
> +		if (IS_ERR(cpsw->page_pool)) {
> +			ret = PTR_ERR(cpsw->page_pool);
> +			cpsw->page_pool = NULL;
> +			goto err_cleanup;
> +		}

On Thu, 30 May 2019 21:20:39 +0300
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org> wrote:

> @@ -675,10 +742,33 @@ int cpsw_set_ringparam(struct net_device *ndev,
>  	if (cpsw->usage_count)
>  		cpdma_chan_split_pool(cpsw->dma);
>  
> +	for (i = 0; i < cpsw->data.slaves; i++) {
> +		struct net_device *ndev = cpsw->slaves[i].ndev;
> +
> +		if (!(ndev && netif_running(ndev)))
> +			continue;
> +
> +		cpsw_xdp_unreg_rxqs(netdev_priv(ndev));
> +	}
> +
> +	page_pool_destroy(cpsw->page_pool);
> +	cpsw->page_pool = pool;
> +

On Thu, 30 May 2019 21:20:39 +0300
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org> wrote:

> +void cpsw_xdp_unreg_rxqs(struct cpsw_priv *priv)
> +{
> +	struct cpsw_common *cpsw = priv->cpsw;
> +	int i;
> +
> +	for (i = 0; i < cpsw->rx_ch_num; i++)
> +		xdp_rxq_info_unreg(&priv->xdp_rxq[i]);
> +}


On Thu, 30 May 2019 21:20:39 +0300
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org> wrote:

> +int cpsw_xdp_reg_rxq(struct cpsw_priv *priv, int ch)
> +{
> +	struct xdp_rxq_info *xdp_rxq = &priv->xdp_rxq[ch];
> +	struct cpsw_common *cpsw = priv->cpsw;
> +	int ret;
> +
> +	ret = xdp_rxq_info_reg(xdp_rxq, priv->ndev, ch);
> +	if (ret)
> +		goto err_cleanup;
> +
> +	ret = xdp_rxq_info_reg_mem_model(xdp_rxq, MEM_TYPE_PAGE_POOL,
> +					 cpsw->page_pool);
> +	if (ret)
> +		goto err_cleanup;
> +
> +	return 0;



-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ