RE: [PATCH 1/5] net: qlcnic: don't set unused function argument

2016-06-16 Thread Rajesh Borundia
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Thursday, June 16, 2016 5:08 PM
>To: Dept-GE Linux NIC Dev <dept-gelinuxnic...@qlogic.com>
>Cc: Arnd Bergmann <a...@arndb.de>; David Miller
><da...@davemloft.net>; Rajesh Borundia <rajesh.borun...@qlogic.com>;
>netdev <netdev@vger.kernel.org>; linux-kernel ker...@vger.kernel.org>
>Subject: [PATCH 1/5] net: qlcnic: don't set unused function argument
>
>We get a warning for qlcnic_83xx_get_mac_address when building with
>"make W=1":
>
>drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c: In function
>'qlcnic_83xx_get_mac_address':
>drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2156:8: error:
>parameter 'function' set but not used [-Werror=unused-but-set-parameter]
>
>Clearly this is harmless, but there is also no point for setting the variable, 
>so
>we can simply remove the assignment.
>
>Signed-off-by: Arnd Bergmann <a...@arndb.de>
>---
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
>b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
>index f9640d5ce6ba..bdbcd2b088a0 100644
>--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
>+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
>@@ -2159,7 +2159,6 @@ int qlcnic_83xx_get_mac_address(struct
>qlcnic_adapter *adapter, u8 *mac,
>   struct qlcnic_cmd_args cmd;
>   u32 mac_low, mac_high;
>
>-  function = 0;
>   err = qlcnic_alloc_mbx_args(, adapter,
>QLCNIC_CMD_MAC_ADDRESS);
>   if (err)
>   return err;
>--
>2.9.0

Acked-by: Rajesh Borundia <rajesh.borun...@qlogic.com>


RE: [PATCH net v2 0/2] qlcnic fixes

2016-03-10 Thread Rajesh Borundia
>-Original Message-
>From: David Miller [mailto:da...@davemloft.net]
>Sent: Friday, March 11, 2016 2:47 AM
>To: Rajesh Borundia <rajesh.borun...@qlogic.com>
>Cc: netdev <netdev@vger.kernel.org>; Dept-GE Linux NIC Dev gelinuxnic...@qlogic.com>
>Subject: Re: [PATCH net v2 0/2] qlcnic fixes
>
>From: Rajesh Borundia <rajesh.borun...@qlogic.com>
>Date: Tue, 8 Mar 2016 02:39:56 -0500
>
>> This series adds following fixes.
>>
>> o While processing mailbox if driver gets a spurious mailbox
>>   interrupt it leads into premature completion of a next
>>   mailbox request. Added a guard against this by checking current
>>   state of mailbox and ignored spurious interrupt.
>>   Added a stats counter to record this condition.
>>
>> v2:
>>
>> o Added patch that removes usage of atomic_t as we are not implemeting
>>   atomicity by using atomic_t value.
>>
>> Please apply these fixes to net.
>
>As explained in other list postings, 'net' is basically closed for this 
>release cycle,
>so I applied this series to 'net-next'.
>

Thanks.

>Let me know if you'd like me to therefore queue these changes up for -stable.
>
Please queue the changes for stable.

>Thanks.


[PATCH net v2 2/2] qlcnic: Fix mailbox completion handling during spurious interrupt

2016-03-08 Thread Rajesh Borundia
o While the driver is in the middle of a MB completion processing
and it receives a spurious MB interrupt, it is mistaken as a good MB
completion interrupt leading to premature completion of the next MB
request. Fix the driver to guard against this by checking the current
state of MB processing and ignore the spurious interrupt.
Also added a stats counter to record this condition.

Signed-off-by: Rajesh Borundia <rajesh.borun...@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h |  1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 15 +++
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c |  3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index d18667b..55007f1 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -566,6 +566,7 @@ struct qlcnic_adapter_stats {
u64  tx_dma_map_error;
u64  spurious_intr;
u64  mac_filter_limit_overrun;
+   u64  mbx_spurious_intr;
 };
 
 /*
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index e3d1bb7..f9640d5ce 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -2338,9 +2338,9 @@ static void qlcnic_83xx_handle_link_aen(struct 
qlcnic_adapter *adapter,
 
 static irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data)
 {
+   u32 mask, resp, event, rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED;
struct qlcnic_adapter *adapter = data;
struct qlcnic_mailbox *mbx;
-   u32 mask, resp, event;
unsigned long flags;
 
mbx = adapter->ahw->mailbox;
@@ -2350,10 +2350,14 @@ static irqreturn_t qlcnic_83xx_handle_aen(int irq, void 
*data)
goto out;
 
event = readl(QLCNIC_MBX_FW(adapter->ahw, 0));
-   if (event &  QLCNIC_MBX_ASYNC_EVENT)
+   if (event &  QLCNIC_MBX_ASYNC_EVENT) {
__qlcnic_83xx_process_aen(adapter);
-   else
-   qlcnic_83xx_notify_mbx_response(mbx);
+   } else {
+   if (mbx->rsp_status != rsp_status)
+   qlcnic_83xx_notify_mbx_response(mbx);
+   else
+   adapter->stats.mbx_spurious_intr++;
+   }
 
 out:
mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK);
@@ -4053,6 +4057,7 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct 
*work)
struct list_head *head = >cmd_q;
struct qlcnic_hardware_context *ahw;
struct qlcnic_cmd_args *cmd = NULL;
+   unsigned long flags;
 
ahw = adapter->ahw;
 
@@ -4062,7 +4067,9 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct 
*work)
return;
}
 
+   spin_lock_irqsave(>aen_lock, flags);
mbx->rsp_status = QLC_83XX_MBX_RESPONSE_WAIT;
+   spin_unlock_irqrestore(>aen_lock, flags);
 
spin_lock(>queue_lock);
 
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 494e810..0a2318c 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -59,7 +59,8 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = {
 QLC_OFF(stats.mac_filter_limit_overrun)},
{"spurious intr", QLC_SIZEOF(stats.spurious_intr),
 QLC_OFF(stats.spurious_intr)},
-
+   {"mbx spurious intr", QLC_SIZEOF(stats.mbx_spurious_intr),
+QLC_OFF(stats.mbx_spurious_intr)},
 };
 
 static const char qlcnic_device_gstrings_stats[][ETH_GSTRING_LEN] = {
-- 
1.8.3.1



[PATCH net v2 0/2] qlcnic fixes

2016-03-08 Thread Rajesh Borundia
Hi Dave,

This series adds following fixes.

o While processing mailbox if driver gets a spurious mailbox
  interrupt it leads into premature completion of a next
  mailbox request. Added a guard against this by checking current
  state of mailbox and ignored spurious interrupt.
  Added a stats counter to record this condition.

v2:

o Added patch that removes usage of atomic_t as we are not implemeting
  atomicity by using atomic_t value.

Please apply these fixes to net.

Thanks,
Rajesh

Rajesh Borundia (2):
  qlcnic: Remove unnecessary usage of atomic_t
  qlcnic: Fix mailbox completion handling during spurious interrupt

 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h|  3 ++-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c| 24 ++
 .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c|  3 ++-
 3 files changed, 19 insertions(+), 11 deletions(-)

-- 
1.8.3.1



[PATCH net v2 1/2] qlcnic: Remove unnecessary usage of atomic_t

2016-03-08 Thread Rajesh Borundia
o atomic_t usage is incorrect as we are not implementing
any atomicity.

Signed-off-by: Rajesh Borundia <rajesh.borun...@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 9 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 46bbea8..d18667b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -1099,7 +1099,7 @@ struct qlcnic_mailbox {
unsigned long   status;
spinlock_t  queue_lock; /* Mailbox queue lock */
spinlock_t  aen_lock;   /* Mailbox response/AEN lock */
-   atomic_trsp_status;
+   u32 rsp_status;
u32 num_cmds;
 };
 
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 37a731b..e3d1bb7 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -491,7 +491,7 @@ irqreturn_t qlcnic_83xx_clear_legacy_intr(struct 
qlcnic_adapter *adapter)
 
 static inline void qlcnic_83xx_notify_mbx_response(struct qlcnic_mailbox *mbx)
 {
-   atomic_set(>rsp_status, QLC_83XX_MBX_RESPONSE_ARRIVED);
+   mbx->rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED;
complete(>completion);
 }
 
@@ -510,7 +510,7 @@ static void qlcnic_83xx_poll_process_aen(struct 
qlcnic_adapter *adapter)
if (event &  QLCNIC_MBX_ASYNC_EVENT) {
__qlcnic_83xx_process_aen(adapter);
} else {
-   if (atomic_read(>rsp_status) != rsp_status)
+   if (mbx->rsp_status != rsp_status)
qlcnic_83xx_notify_mbx_response(mbx);
}
 out:
@@ -1023,7 +1023,7 @@ static void qlcnic_83xx_process_aen(struct qlcnic_adapter 
*adapter)
if (event &  QLCNIC_MBX_ASYNC_EVENT) {
__qlcnic_83xx_process_aen(adapter);
} else {
-   if (atomic_read(>rsp_status) != rsp_status)
+   if (mbx->rsp_status != rsp_status)
qlcnic_83xx_notify_mbx_response(mbx);
}
}
@@ -4050,7 +4050,6 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct 
*work)
struct qlcnic_adapter *adapter = mbx->adapter;
const struct qlcnic_mbx_ops *mbx_ops = mbx->ops;
struct device *dev = >pdev->dev;
-   atomic_t *rsp_status = >rsp_status;
struct list_head *head = >cmd_q;
struct qlcnic_hardware_context *ahw;
struct qlcnic_cmd_args *cmd = NULL;
@@ -4063,7 +4062,7 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct 
*work)
return;
}
 
-   atomic_set(rsp_status, QLC_83XX_MBX_RESPONSE_WAIT);
+   mbx->rsp_status = QLC_83XX_MBX_RESPONSE_WAIT;
 
spin_lock(>queue_lock);
 
-- 
1.8.3.1



[PATCH net] qlcnic: Fix mailbox completion handling during spurious interrupt

2015-11-16 Thread Rajesh Borundia
o While the driver is in the middle of a MB completion processing
and it receives a spurious MB interrupt, it is mistaken as a good MB
completion interrupt leading to premature completion of the next MB
request. Fix the driver to guard against this by checking the current
state of MB processing and ignore the spurious interrupt.
Also added a stats counter to record this condition.

Signed-off-by: Rajesh Borundia <rajesh.borun...@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h|1 +
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c|   12 
 .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c|3 ++-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index d6696cf..371c266 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -566,6 +566,7 @@ struct qlcnic_adapter_stats {
u64  tx_dma_map_error;
u64  spurious_intr;
u64  mac_filter_limit_overrun;
+   u64  mbx_spurious_intr;
 };
 
 /*
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 9f0bdd9..865f21b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -2338,9 +2338,9 @@ static void qlcnic_83xx_handle_link_aen(struct 
qlcnic_adapter *adapter,
 
 static irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data)
 {
+   u32 mask, resp, event, rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED;
struct qlcnic_adapter *adapter = data;
struct qlcnic_mailbox *mbx;
-   u32 mask, resp, event;
unsigned long flags;
 
mbx = adapter->ahw->mailbox;
@@ -2350,10 +2350,14 @@ static irqreturn_t qlcnic_83xx_handle_aen(int irq, void 
*data)
goto out;
 
event = readl(QLCNIC_MBX_FW(adapter->ahw, 0));
-   if (event &  QLCNIC_MBX_ASYNC_EVENT)
+   if (event &  QLCNIC_MBX_ASYNC_EVENT) {
__qlcnic_83xx_process_aen(adapter);
-   else
-   qlcnic_83xx_notify_mbx_response(mbx);
+   } else {
+   if (atomic_read(>rsp_status) != rsp_status)
+   qlcnic_83xx_notify_mbx_response(mbx);
+   else
+   adapter->stats.mbx_spurious_intr++;
+   }
 
 out:
mask = QLCRDX(adapter->ahw, QLCNIC_DEF_INT_MASK);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 494e810..0a2318c 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -59,7 +59,8 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = {
 QLC_OFF(stats.mac_filter_limit_overrun)},
{"spurious intr", QLC_SIZEOF(stats.spurious_intr),
 QLC_OFF(stats.spurious_intr)},
-
+   {"mbx spurious intr", QLC_SIZEOF(stats.mbx_spurious_intr),
+QLC_OFF(stats.mbx_spurious_intr)},
 };
 
 static const char qlcnic_device_gstrings_stats[][ETH_GSTRING_LEN] = {
-- 
1.5.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] net: qlcnic: clean up sysfs error codes

2015-05-28 Thread Rajesh Borundia
;

   qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32));
   np_cfg = (struct qlcnic_npar_func_cfg *)buf; @@ -717,7 +715,7 @@
static ssize_t qlcnic_sysfs_write_npar_config(struct file *file,
   return ret;
   index = qlcnic_is_valid_nic_func(adapter, pci_func);
   if (index  0)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;
   adapter-npars[index].min_bw = nic_info.min_tx_bw;
   adapter-npars[index].max_bw = nic_info.max_tx_bw;
   }
@@ -784,13 +782,13 @@ static ssize_t qlcnic_sysfs_get_port_stats(struct file
*file,
   int ret;

   if (qlcnic_83xx_check(adapter))
-  return QLC_STATUS_UNSUPPORTED_CMD;
+  return -EOPNOTSUPP;

   if (size != sizeof(struct qlcnic_esw_statistics))
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   if (offset = adapter-ahw-max_vnic_func)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   memset(port_stats, 0, size);
   ret = qlcnic_get_port_stats(adapter, offset,
QLCNIC_QUERY_RX_COUNTER, @@ -819,13 +817,13 @@ static ssize_t
qlcnic_sysfs_get_esw_stats(struct file *file,
   int ret;

   if (qlcnic_83xx_check(adapter))
-  return QLC_STATUS_UNSUPPORTED_CMD;
+  return -EOPNOTSUPP;

   if (size != sizeof(struct qlcnic_esw_statistics))
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   if (offset = QLCNIC_NIU_MAX_XG_PORTS)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   memset(esw_stats, 0, size);
   ret = qlcnic_get_eswitch_stats(adapter, offset,
QLCNIC_QUERY_RX_COUNTER, @@ -853,10 +851,10 @@ static ssize_t
qlcnic_sysfs_clear_esw_stats(struct file *file,
   int ret;

   if (qlcnic_83xx_check(adapter))
-  return QLC_STATUS_UNSUPPORTED_CMD;
+  return -EOPNOTSUPP;

   if (offset = QLCNIC_NIU_MAX_XG_PORTS)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   ret = qlcnic_clear_esw_stats(adapter, QLCNIC_STATS_ESWITCH,
offset,
QLCNIC_QUERY_RX_COUNTER);
@@ -883,10 +881,10 @@ static ssize_t qlcnic_sysfs_clear_port_stats(struct
file *file,
   int ret;

   if (qlcnic_83xx_check(adapter))
-  return QLC_STATUS_UNSUPPORTED_CMD;
+  return -EOPNOTSUPP;

   if (offset = adapter-ahw-max_vnic_func)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   ret = qlcnic_clear_esw_stats(adapter, QLCNIC_STATS_PORT, offset,
QLCNIC_QUERY_RX_COUNTER);
@@ -953,9 +951,7 @@ static ssize_t
qlcnic_83xx_sysfs_flash_read_handler(struct file *filp,
   struct qlcnic_adapter *adapter = dev_get_drvdata(dev);

   if (!size)
-  return QL_STATUS_INVALID_PARAM;
-  if (!buf)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   count = size / sizeof(u32);

@@ -1132,9 +1128,6 @@ static ssize_t
qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
   struct device *dev = container_of(kobj, struct device, kobj);
   struct qlcnic_adapter *adapter = dev_get_drvdata(dev);

-  if (!buf)
-  return QL_STATUS_INVALID_PARAM;
-
   ret = kstrtoul(buf, 16, data);

   switch (data) {
--
2.1.4

Acked-by: Rajesh Borundia rajesh.borun...@qlogic.com

Thanks
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] net: qlcnic: clean up sysfs error codes

2015-05-25 Thread Rajesh Borundia
-Original Message-
From: dept_hsg_linux_nic_dev-boun...@qlclistserver.qlogic.com
[mailto:dept_hsg_linux_nic_dev-boun...@qlclistserver.qlogic.com] On
Behalf Of Vladimir Zapolskiy
Sent: Tuesday, May 26, 2015 6:20 AM
To: David Miller; Shahed Shaikh; Dept-GE Linux NIC Dev
Cc: netdev
Subject: [PATCH] net: qlcnic: clean up sysfs error codes

Replace confusing QL_STATUS_INVALID_PARAM == -1 == -EPERM with -
EINVAL and QLC_STATUS_UNSUPPORTED_CMD == -2 == -ENOENT with -
EOPNOTSUPP, the latter error code is arguable, but it is already used in the
driver, so let it be here as well.

Also remove always false (!buf) check on read(), the driver should not care if
userspace gets its EFAULT or not.

Signed-off-by: Vladimir Zapolskiy v...@mleia.com
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h   |  3 -
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c  |  2 +-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 77 +++---
-
 3 files changed, 36 insertions(+), 46 deletions(-)

Hi Vladmir,

We will review the patch and get back to you.

Thanks,
Rajesh


diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index f221126..055f376 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -1326,9 +1326,6 @@ struct qlcnic_eswitch {  };


-/* Return codes for Error handling */
-#define QL_STATUS_INVALID_PARAM   -1
-
 #define MAX_BW100 /* % of link speed */
 #define MIN_BW1   /* % of link speed */
 #define MAX_VLAN_ID   4095
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 367f397..2f6cc42 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1031,7 +1031,7 @@ int qlcnic_init_pci_info(struct qlcnic_adapter
*adapter)
   pfn = pci_info[i].id;

   if (pfn = ahw-max_vnic_func) {
-  ret = QL_STATUS_INVALID_PARAM;
+  ret = -EINVAL;
   dev_err(adapter-pdev-dev, %s: Invalid function
0x%x, max 0x%x\n,
   __func__, pfn, ahw-max_vnic_func);
   goto err_eswitch;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index 59a721f..05c28f2 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -24,8 +24,6 @@
 #include linux/hwmon-sysfs.h
 #endif

-#define QLC_STATUS_UNSUPPORTED_CMD-2
-
 int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *adapter, u32
enable)  {
   return -EOPNOTSUPP;
@@ -166,7 +164,7 @@ static int qlcnic_82xx_store_beacon(struct
qlcnic_adapter *adapter,
   u8 b_state, b_rate;

   if (len != sizeof(u16))
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   memcpy(beacon, buf, sizeof(u16));
   err = qlcnic_validate_beacon(adapter, beacon, b_state, b_rate);
@@ -383,17 +381,17 @@ static int validate_pm_config(struct qlcnic_adapter
*adapter,
   dest_pci_func = pm_cfg[i].dest_npar;
   src_index = qlcnic_is_valid_nic_func(adapter, src_pci_func);
   if (src_index  0)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   dest_index = qlcnic_is_valid_nic_func(adapter,
dest_pci_func);
   if (dest_index  0)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   s_esw_id = adapter-npars[src_index].phy_port;
   d_esw_id = adapter-npars[dest_index].phy_port;

   if (s_esw_id != d_esw_id)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;
   }

   return 0;
@@ -414,7 +412,7 @@ static ssize_t qlcnic_sysfs_write_pm_config(struct file
*filp,
   count   = size / sizeof(struct qlcnic_pm_func_cfg);
   rem = size % sizeof(struct qlcnic_pm_func_cfg);
   if (rem)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   qlcnic_swap32_buffer((u32 *)buf, size / sizeof(u32));
   pm_cfg = (struct qlcnic_pm_func_cfg *)buf; @@ -427,7 +425,7 @@
static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
   action = !!pm_cfg[i].action;
   index = qlcnic_is_valid_nic_func(adapter, pci_func);
   if (index  0)
-  return QL_STATUS_INVALID_PARAM;
+  return -EINVAL;

   id = adapter-npars[index].phy_port;
   ret = qlcnic_config_port_mirroring(adapter, id, @@ -440,7
+438,7 @@ static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
   pci_func = pm_cfg[i].pci_func;
   index = qlcnic_is_valid_nic_func(adapter, pci_func);