On 7/8/19 10:25 PM, Michal Kubecek wrote:
On Mon, Jul 08, 2019 at 12:25:26PM -0700, Shannon Nelson wrote:
Add in the basic ethtool callbacks for device information
and control.


+
+       if (fec_type != idev->port_info->config.fec_type) {
+               mutex_lock(&ionic->dev_cmd_lock);
+               ionic_dev_cmd_port_fec(idev, PORT_FEC_TYPE_NONE);
The second argument should be fec_type, I believe.

Yep.


+               err = ionic_dev_cmd_wait(ionic, devcmd_timeout);
+               mutex_unlock(&ionic->dev_cmd_lock);
+               if (err)
+                       return err;
+
+               idev->port_info->config.fec_type = fec_type;
+       }
+
+       return 0;
+}
...
+static int ionic_set_ringparam(struct net_device *netdev,
+                              struct ethtool_ringparam *ring)
+{
+       struct lif *lif = netdev_priv(netdev);
+       bool running;
+       int i, j;
+
+       if (ring->rx_mini_pending || ring->rx_jumbo_pending) {
+               netdev_info(netdev, "Changing jumbo or mini descriptors not 
supported\n");
+               return -EINVAL;
+       }
+
+       i = ring->tx_pending & (ring->tx_pending - 1);
+       j = ring->rx_pending & (ring->rx_pending - 1);
+       if (i || j) {
+               netdev_info(netdev, "Descriptor count must be a power of 2\n");
+               return -EINVAL;
+       }
You can use is_power_of_2() here (it wouldn't allow 0 but you probably
don't want to allow that either).

Sure.

Thanks,
sln

Reply via email to