]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
qlcnic: Enhance channel configuration logs
authorManish Chopra <manish.chopra@qlogic.com>
Wed, 24 Apr 2013 12:42:39 +0000 (12:42 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Apr 2013 23:34:05 +0000 (19:34 -0400)
o Add logs for various failure conditions during channel configuration.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

index 8d02dd75c9a231b25fb39e5c13b79e8178307dde..f699ccee65dc8169d7f8ff010dda7023dcc3ca0c 100644 (file)
@@ -1474,7 +1474,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings);
 int qlcnic_diag_alloc_res(struct net_device *netdev, int test);
 netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
 int qlcnic_set_max_rss(struct qlcnic_adapter *, u8, size_t);
-int qlcnic_validate_max_rss(u8, u8);
+int qlcnic_validate_max_rss(struct qlcnic_adapter *, __u32);
 void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter);
 int qlcnic_enable_msix(struct qlcnic_adapter *, u32);
 
index 9f7aade4667ce64ef8b7364f3b2179cda94577dd..59350c287f639ee31fbcce7995d0f772faa6706b 100644 (file)
@@ -635,7 +635,7 @@ static int qlcnic_set_channels(struct net_device *dev,
            channel->tx_count != channel->max_tx)
                return -EINVAL;
 
-       err = qlcnic_validate_max_rss(channel->max_rx, channel->rx_count);
+       err = qlcnic_validate_max_rss(adapter, channel->rx_count);
        if (err)
                return err;
 
index 247a9f9b7bdc1139abeb6a5f92046b142ba3fea5..0052953a255d92ea1f7b5f165c11926dff79f339 100644 (file)
@@ -3273,20 +3273,40 @@ qlcnicvf_start_firmware(struct qlcnic_adapter *adapter)
        return err;
 }
 
-int qlcnic_validate_max_rss(u8 max_hw, u8 val)
+int qlcnic_validate_max_rss(struct qlcnic_adapter *adapter,
+                           __u32 val)
 {
+       struct net_device *netdev = adapter->netdev;
+       u8 max_hw = adapter->ahw->max_rx_ques;
        u32 max_allowed;
 
-       if (max_hw > QLC_MAX_SDS_RINGS) {
-               max_hw = QLC_MAX_SDS_RINGS;
-               pr_info("max rss reset to %d\n", QLC_MAX_SDS_RINGS);
+       if (val > QLC_MAX_SDS_RINGS) {
+               netdev_err(netdev, "RSS value should not be higher than %u\n",
+                          QLC_MAX_SDS_RINGS);
+               return -EINVAL;
        }
 
        max_allowed = rounddown_pow_of_two(min_t(int, max_hw,
                                                 num_online_cpus()));
        if ((val > max_allowed) || (val < 2) || !is_power_of_2(val)) {
-               pr_info("rss_ring valid range [2 - %x] in powers of 2\n",
-                       max_allowed);
+               if (!is_power_of_2(val))
+                       netdev_err(netdev, "RSS value should be a power of 2\n");
+
+               if (val < 2)
+                       netdev_err(netdev, "RSS value should not be lower than 2\n");
+
+               if (val > max_hw)
+                       netdev_err(netdev,
+                                  "RSS value should not be higher than[%u], the max RSS rings supported by the adapter\n",
+                                  max_hw);
+
+               if (val > num_online_cpus())
+                       netdev_err(netdev,
+                                  "RSS value should not be higher than[%u], number of online CPUs in the system\n",
+                                  num_online_cpus());
+
+               netdev_err(netdev, "Unable to configure %u RSS rings\n", val);
+
                return -EINVAL;
        }
        return 0;