All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Igor Russkikh <igor.russkikh@aquantia.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, David Arcari <darcari@redhat.com>,
	Pavel Belous <pavel.belous@aquantia.com>,
	Anton Mikaev <amikaev@aquantia.com>
Subject: Re: [PATCH net-next 1/5] net: aquantia: Ethtool based ring size configuration
Date: Tue, 29 May 2018 12:04:03 -0700	[thread overview]
Message-ID: <20180529120403.3f89a394@cakuba> (raw)
In-Reply-To: <7b86f8ec337f9c27a362c5a0a5c306928b07b04e.1527596210.git.igor.russkikh@aquantia.com>

On Tue, 29 May 2018 15:56:58 +0300, Igor Russkikh wrote:
> +static int aq_set_ringparam(struct net_device *ndev,
> +			    struct ethtool_ringparam *ring)
> +{
> +	int err = 0;
> +	struct aq_nic_s *aq_nic = netdev_priv(ndev);
> +	struct aq_nic_cfg_s *aq_nic_cfg = aq_nic_get_cfg(aq_nic);
> +	const struct aq_hw_caps_s *hw_caps = aq_nic_cfg->aq_hw_caps;
> +
> +	if (ring->rx_mini_pending || ring->rx_jumbo_pending) {
> +		err = -EOPNOTSUPP;
> +		goto err_exit;
> +	}
> +
> +	spin_lock(&aq_nic->aq_spinlock);
> +
> +	if (netif_running(ndev))
> +		dev_close(ndev);

I don't think you can hold a spinlock around dev_close()/dev_open()
calls.

> +	aq_nic_free_vectors(aq_nic);
> +
> +	aq_nic_cfg->rxds = max(ring->rx_pending, hw_caps->rxds_min);
> +	aq_nic_cfg->rxds = min(aq_nic_cfg->rxds, hw_caps->rxds_max);
> +	aq_nic_cfg->rxds = ALIGN(aq_nic_cfg->rxds, AQ_HW_RXD_MULTIPLE);
> +
> +	aq_nic_cfg->txds = max(ring->tx_pending, hw_caps->txds_min);
> +	aq_nic_cfg->txds = min(aq_nic_cfg->txds, hw_caps->txds_max);
> +	aq_nic_cfg->txds = ALIGN(aq_nic_cfg->txds, AQ_HW_TXD_MULTIPLE);
> +
> +	for (aq_nic->aq_vecs = 0; aq_nic->aq_vecs < aq_nic_cfg->vecs;
> +	     aq_nic->aq_vecs++) {
> +		aq_nic->aq_vec[aq_nic->aq_vecs] =
> +		    aq_vec_alloc(aq_nic, aq_nic->aq_vecs, aq_nic_cfg);
> +		if (unlikely(!aq_nic->aq_vec[aq_nic->aq_vecs])) {
> +			err = -ENOMEM;
> +			goto err_unlock;
> +		}
> +	}
> +	if (!netif_running(ndev))
> +		err = dev_open(ndev);

Will this not open the device regardless if it was open before or not?

> +err_unlock:
> +	spin_unlock(&aq_nic->aq_spinlock);
> +err_exit:
> +	return err;
> +}

  reply	other threads:[~2018-05-29 19:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 12:56 [PATCH net-next 0/5] net: aquantia: various ethtool ops implementation Igor Russkikh
2018-05-29 12:56 ` [PATCH net-next 1/5] net: aquantia: Ethtool based ring size configuration Igor Russkikh
2018-05-29 19:04   ` Jakub Kicinski [this message]
2018-06-01  9:19     ` Igor Russkikh
2018-05-29 12:56 ` [PATCH net-next 2/5] net: aquantia: Improve adapter init/deinit logic Igor Russkikh
2018-06-05 10:22   ` kbuild test robot
2018-06-05 10:22   ` [RFC PATCH] net: aquantia: hw_atl_utils_mpi_set_state() can be static kbuild test robot
2018-05-29 12:57 ` [PATCH net-next 3/5] net: aquantia: Implement rx/tx flow control ethtools callback Igor Russkikh
2018-05-29 12:57 ` [PATCH net-next 4/5] net: aquantia: Add renegotiate ethtool operation support Igor Russkikh
2018-05-29 12:57 ` [PATCH net-next 5/5] net: aquantia: bump driver version Igor Russkikh
2018-05-31 18:09 ` [PATCH net-next 0/5] net: aquantia: various ethtool ops implementation David Miller

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=20180529120403.3f89a394@cakuba \
    --to=jakub.kicinski@netronome.com \
    --cc=amikaev@aquantia.com \
    --cc=darcari@redhat.com \
    --cc=davem@davemloft.net \
    --cc=igor.russkikh@aquantia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavel.belous@aquantia.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.