[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180529120403.3f89a394@cakuba>
Date: Tue, 29 May 2018 12:04:03 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Igor Russkikh <igor.russkikh@...antia.com>
Cc: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
David Arcari <darcari@...hat.com>,
Pavel Belous <pavel.belous@...antia.com>,
Anton Mikaev <amikaev@...antia.com>
Subject: Re: [PATCH net-next 1/5] net: aquantia: Ethtool based ring size
configuration
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;
> +}
Powered by blists - more mailing lists