netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
       [not found] <1404827830-22990-1-git-send-email-ethan.zhao@oracle.com>
@ 2014-07-09  2:41 ` ethan zhao
  2014-07-09  3:46   ` David Miller
  2014-07-09 11:32   ` Manish Chopra
  0 siblings, 2 replies; 8+ messages in thread
From: ethan zhao @ 2014-07-09  2:41 UTC (permalink / raw)
  To: davem; +Cc: balbi, netdev, linux-kernel, sriharsha.devdas, ethan.kernel,
	vaughan

David,

    Please help to review and confirm this patch.

Thanks,
Ethan

On 2014/7/8 21:57, Ethan Zhao wrote:
> netxen driver has implemented netxen_nic_get_ethtool_stats() interface,
> but it doesn't collect stats.rxdropped in driver, so we will get
> different rx_dropped statistic information while using ifconfig and ethtool.
> this patch fills stats.rxdropped field with data from net core
> with dev_get_stats() just as ixgbe driver did for some of its stats.
>
> V2: only fix the stats.rxdropped field.
>
> Tested with last netxen 4.0.82
> Compiled with net-next branch 3.16-rc2
>
> Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
> Tested-by: Sriharsha Yadagudde <sriharsha.devdas@oracle.com>
> ---
>   .../ethernet/qlogic/netxen/netxen_nic_ethtool.c    |   34 +++++++++++++++++---
>   1 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
> index 4ca2c19..49e6a1b 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
> @@ -33,22 +33,30 @@
>   #include "netxen_nic.h"
>   #include "netxen_nic_hw.h"
>   
> +enum {NETDEV_STATS, NETXEN_STATS};
> +
>   struct netxen_nic_stats {
>   	char stat_string[ETH_GSTRING_LEN];
> +	int type;
>   	int sizeof_stat;
>   	int stat_offset;
>   };
>   
> -#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_adapter *)0)->m), \
> +#define NETXEN_NIC_STAT(m)	NETXEN_STATS, \
> +			sizeof(((struct netxen_adapter *)0)->m), \
>   			offsetof(struct netxen_adapter, m)
>   
> +#define NETXEN_NETDEV_STAT(m)	NETDEV_STATS, \
> +			sizeof(((struct rtnl_link_stats64 *)0)->m), \
> +			offsetof(struct rtnl_link_stats64, m)
> +
>   #define NETXEN_NIC_PORT_WINDOW 0x10000
>   #define NETXEN_NIC_INVALID_DATA 0xDEADBEEF
>   
>   static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
>   	{"xmit_called", NETXEN_NIC_STAT(stats.xmitcalled)},
>   	{"xmit_finished", NETXEN_NIC_STAT(stats.xmitfinished)},
> -	{"rx_dropped", NETXEN_NIC_STAT(stats.rxdropped)},
> +	{"rx_dropped", NETXEN_NETDEV_STAT(rx_dropped)},
>   	{"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)},
>   	{"csummed", NETXEN_NIC_STAT(stats.csummed)},
>   	{"rx_pkts", NETXEN_NIC_STAT(stats.rx_pkts)},
> @@ -679,11 +687,27 @@ netxen_nic_get_ethtool_stats(struct net_device *dev,
>   {
>   	struct netxen_adapter *adapter = netdev_priv(dev);
>   	int index;
> +	struct rtnl_link_stats64 temp;
> +	const struct rtnl_link_stats64 *net_stats;
> +	char *p = NULL;
>   
> +	net_stats = dev_get_stats(dev, &temp);
>   	for (index = 0; index < NETXEN_NIC_STATS_LEN; index++) {
> -		char *p =
> -		    (char *)adapter +
> -		    netxen_nic_gstrings_stats[index].stat_offset;
> +
> +		switch (netxen_nic_gstrings_stats[index].type) {
> +		case NETDEV_STATS:
> +			p = (char *)net_stats +
> +				netxen_nic_gstrings_stats[index].stat_offset;
> +			break;
> +		case NETXEN_STATS:
> +			p = (char *)adapter +
> +				netxen_nic_gstrings_stats[index].stat_offset;
> +			break;
> +		default:
> +			data[index] = 0;
> +			continue;
> +		}
> +
>   		data[index] =
>   		    (netxen_nic_gstrings_stats[index].sizeof_stat ==
>   		     sizeof(u64)) ? *(u64 *) p : *(u32 *) p;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09  2:41 ` [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats() ethan zhao
@ 2014-07-09  3:46   ` David Miller
  2014-07-09  5:15     ` ethan zhao
  2014-07-09 11:32   ` Manish Chopra
  1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2014-07-09  3:46 UTC (permalink / raw)
  To: ethan.zhao
  Cc: balbi, netdev, linux-kernel, sriharsha.devdas, ethan.kernel,
	vaughan.cao

From: ethan zhao <ethan.zhao@oracle.com>
Date: Wed, 09 Jul 2014 10:41:23 +0800

>    Please help to review and confirm this patch.

It's not in patchwork, therefore it's not in my queue.

It is also not my responsibility to review all patches, that's
a joint responsibility of everyone on this mailing list.

So asking me specifically to review a patch is really not
generally inappropriate.

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09  3:46   ` David Miller
@ 2014-07-09  5:15     ` ethan zhao
  2014-07-09  6:30       ` Shahed Shaikh
  0 siblings, 1 reply; 8+ messages in thread
From: ethan zhao @ 2014-07-09  5:15 UTC (permalink / raw)
  To: David Miller
  Cc: balbi, netdev, linux-kernel, sriharsha.devdas, ethan.kernel,
	vaughan.cao

David,
     Sorry I don't know who owns this driver, the SOB of other patches 
to netxen may mislead me you could ACK it or not,  so it is definitely 
not the original meaning that ask you specifically to review one patch.  
just ask for help point to someone could review it.

Thanks,
Ethan

On 2014/7/9 11:46, David Miller wrote:
> From: ethan zhao<ethan.zhao@oracle.com>
> Date: Wed, 09 Jul 2014 10:41:23 +0800
>
>>     Please help to review and confirm this patch.
> It's not in patchwork, therefore it's not in my queue.
>
> It is also not my responsibility to review all patches, that's
> a joint responsibility of everyone on this mailing list.
>
> So asking me specifically to review a patch is really not
> generally inappropriate.
>
> Thanks.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09  5:15     ` ethan zhao
@ 2014-07-09  6:30       ` Shahed Shaikh
  2014-07-09  6:35         ` Ethan Zhao
  0 siblings, 1 reply; 8+ messages in thread
From: Shahed Shaikh @ 2014-07-09  6:30 UTC (permalink / raw)
  To: ethan zhao, David Miller
  Cc: balbi@ti.com, netdev, linux-kernel, sriharsha.devdas@oracle.com,
	ethan.kernel@gmail.com, vaughan.cao@oracle.com

> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of ethan zhao
> Sent: Wednesday, July 09, 2014 10:45 AM
> To: David Miller
> Cc: balbi@ti.com; netdev; linux-kernel; sriharsha.devdas@oracle.com;
> ethan.kernel@gmail.com; vaughan.cao@oracle.com
> Subject: Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped
> information in ethtool get_ethtool_stats()
> 
> David,
>      Sorry I don't know who owns this driver, the SOB of other patches to
> netxen may mislead me you could ACK it or not,  so it is definitely not the
> original meaning that ask you specifically to review one patch.
> just ask for help point to someone could review it

Ethan,

You can get the maintainers of netxen_nic driver from " MAINTAINERS" file.
Please copy maintainers of this driver for review.

NETXEN (1/10) GbE SUPPORT
M:      Manish Chopra <manish.chopra@qlogic.com>
M:      Sony Chacko <sony.chacko@qlogic.com>
M:      Rajesh Borundia <rajesh.borundia@qlogic.com>
L:      netdev@vger.kernel.org
W:      http://www.qlogic.com
S:      Supported
F:      drivers/net/ethernet/qlogic/netxen/


HTH.

Thanks,
Shahed

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09  6:30       ` Shahed Shaikh
@ 2014-07-09  6:35         ` Ethan Zhao
  0 siblings, 0 replies; 8+ messages in thread
From: Ethan Zhao @ 2014-07-09  6:35 UTC (permalink / raw)
  To: Shahed Shaikh
  Cc: ethan zhao, David Miller, balbi@ti.com, netdev, linux-kernel,
	sriharsha.devdas@oracle.com, vaughan.cao@oracle.com

Shahed,
   Thanks, great.

Ethan


On Wed, Jul 9, 2014 at 2:30 PM, Shahed Shaikh <shahed.shaikh@qlogic.com> wrote:
>> -----Original Message-----
>> From: netdev-owner@vger.kernel.org [mailto:netdev-
>> owner@vger.kernel.org] On Behalf Of ethan zhao
>> Sent: Wednesday, July 09, 2014 10:45 AM
>> To: David Miller
>> Cc: balbi@ti.com; netdev; linux-kernel; sriharsha.devdas@oracle.com;
>> ethan.kernel@gmail.com; vaughan.cao@oracle.com
>> Subject: Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped
>> information in ethtool get_ethtool_stats()
>>
>> David,
>>      Sorry I don't know who owns this driver, the SOB of other patches to
>> netxen may mislead me you could ACK it or not,  so it is definitely not the
>> original meaning that ask you specifically to review one patch.
>> just ask for help point to someone could review it
>
> Ethan,
>
> You can get the maintainers of netxen_nic driver from " MAINTAINERS" file.
> Please copy maintainers of this driver for review.
>
> NETXEN (1/10) GbE SUPPORT
> M:      Manish Chopra <manish.chopra@qlogic.com>
> M:      Sony Chacko <sony.chacko@qlogic.com>
> M:      Rajesh Borundia <rajesh.borundia@qlogic.com>
> L:      netdev@vger.kernel.org
> W:      http://www.qlogic.com
> S:      Supported
> F:      drivers/net/ethernet/qlogic/netxen/
>
>
> HTH.
>
> Thanks,
> Shahed

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09  2:41 ` [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats() ethan zhao
  2014-07-09  3:46   ` David Miller
@ 2014-07-09 11:32   ` Manish Chopra
  2014-07-09 11:45     ` vaughan
  1 sibling, 1 reply; 8+ messages in thread
From: Manish Chopra @ 2014-07-09 11:32 UTC (permalink / raw)
  To: ethan zhao, David Miller
  Cc: balbi@ti.com, netdev, linux-kernel, sriharsha.devdas@oracle.com,
	ethan.kernel@gmail.com, vaughan

>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>On Behalf Of ethan zhao
>Sent: Wednesday, July 09, 2014 8:11 AM
>To: David Miller
>Cc: balbi@ti.com; netdev; linux-kernel; sriharsha.devdas@oracle.com;
>ethan.kernel@gmail.com; vaughan
>Subject: Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in
>ethtool get_ethtool_stats()
>
>David,
>
>    Please help to review and confirm this patch.
>
>Thanks,
>Ethan
>
>On 2014/7/8 21:57, Ethan Zhao wrote:
>> netxen driver has implemented netxen_nic_get_ethtool_stats()
>> interface, but it doesn't collect stats.rxdropped in driver, so we
>> will get different rx_dropped statistic information while using ifconfig and
>ethtool.
>> this patch fills stats.rxdropped field with data from net core with
>> dev_get_stats() just as ixgbe driver did for some of its stats.
>>
>> V2: only fix the stats.rxdropped field.
>>
>> Tested with last netxen 4.0.82
>> Compiled with net-next branch 3.16-rc2
>>
>> Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
>> Tested-by: Sriharsha Yadagudde <sriharsha.devdas@oracle.com>
>> ---
>>   .../ethernet/qlogic/netxen/netxen_nic_ethtool.c    |   34 +++++++++++++++++-
>--
>>   1 files changed, 29 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>> b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>> index 4ca2c19..49e6a1b 100644
>> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>> @@ -33,22 +33,30 @@
>>   #include "netxen_nic.h"
>>   #include "netxen_nic_hw.h"
>>
>> +enum {NETDEV_STATS, NETXEN_STATS};
>> +
>>   struct netxen_nic_stats {
>>   	char stat_string[ETH_GSTRING_LEN];
>> +	int type;
>>   	int sizeof_stat;
>>   	int stat_offset;
>>   };
>>
>> -#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_adapter *)0)->m), \
>> +#define NETXEN_NIC_STAT(m)	NETXEN_STATS, \
>> +			sizeof(((struct netxen_adapter *)0)->m), \
>>   			offsetof(struct netxen_adapter, m)
>>
>> +#define NETXEN_NETDEV_STAT(m)	NETDEV_STATS, \
>> +			sizeof(((struct rtnl_link_stats64 *)0)->m), \
>> +			offsetof(struct rtnl_link_stats64, m)
>> +
>>   #define NETXEN_NIC_PORT_WINDOW 0x10000
>>   #define NETXEN_NIC_INVALID_DATA 0xDEADBEEF
>>
>>   static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
>>   	{"xmit_called", NETXEN_NIC_STAT(stats.xmitcalled)},
>>   	{"xmit_finished", NETXEN_NIC_STAT(stats.xmitfinished)},
>> -	{"rx_dropped", NETXEN_NIC_STAT(stats.rxdropped)},
>> +	{"rx_dropped", NETXEN_NETDEV_STAT(rx_dropped)},
>>   	{"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)},
>>   	{"csummed", NETXEN_NIC_STAT(stats.csummed)},
>>   	{"rx_pkts", NETXEN_NIC_STAT(stats.rx_pkts)}, @@ -679,11 +687,27 @@
>> netxen_nic_get_ethtool_stats(struct net_device *dev,
>>   {
>>   	struct netxen_adapter *adapter = netdev_priv(dev);
>>   	int index;
>> +	struct rtnl_link_stats64 temp;
>> +	const struct rtnl_link_stats64 *net_stats;
>> +	char *p = NULL;
>>
>> +	net_stats = dev_get_stats(dev, &temp);
>>   	for (index = 0; index < NETXEN_NIC_STATS_LEN; index++) {
>> -		char *p =
>> -		    (char *)adapter +
>> -		    netxen_nic_gstrings_stats[index].stat_offset;
>> +
>> +		switch (netxen_nic_gstrings_stats[index].type) {
>> +		case NETDEV_STATS:
>> +			p = (char *)net_stats +
>> +				netxen_nic_gstrings_stats[index].stat_offset;
>> +			break;
>> +		case NETXEN_STATS:
>> +			p = (char *)adapter +
>> +				netxen_nic_gstrings_stats[index].stat_offset;
>> +			break;
>> +		default:
>> +			data[index] = 0;
>> +			continue;
>> +		}
>> +
>>   		data[index] =
>>   		    (netxen_nic_gstrings_stats[index].sizeof_stat ==
>>   		     sizeof(u64)) ? *(u64 *) p : *(u32 *) p;

Ethan, I can't download this patch as I don’t see it in netdev patchwork. Just looking at the diff I think there is style issue with macro definition of NETXEN_NIC_STAT and NETXEN_NETDEV_STAT.
Enclose macro definition in parentheses as they are containing complex values.

Send this patch targeted for net instead of net-next being a bug fix. Please also run checkpatch.pl to correct any style warning/errors in the patch.

Thanks!!  


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09 11:32   ` Manish Chopra
@ 2014-07-09 11:45     ` vaughan
  2014-07-10  1:31       ` ethan zhao
  0 siblings, 1 reply; 8+ messages in thread
From: vaughan @ 2014-07-09 11:45 UTC (permalink / raw)
  To: Manish Chopra, ethan zhao, David Miller
  Cc: balbi@ti.com, netdev, linux-kernel, sriharsha.devdas@oracle.com,
	ethan.kernel@gmail.com

On 07/09/2014 07:32 PM, Manish Chopra wrote:
>> -----Original Message-----
>> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>> On Behalf Of ethan zhao
>> Sent: Wednesday, July 09, 2014 8:11 AM
>> To: David Miller
>> Cc: balbi@ti.com; netdev; linux-kernel; sriharsha.devdas@oracle.com;
>> ethan.kernel@gmail.com; vaughan
>> Subject: Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in
>> ethtool get_ethtool_stats()
>>
>> David,
>>
>>    Please help to review and confirm this patch.
>>
>> Thanks,
>> Ethan
>>
>> On 2014/7/8 21:57, Ethan Zhao wrote:
>>> netxen driver has implemented netxen_nic_get_ethtool_stats()
>>> interface, but it doesn't collect stats.rxdropped in driver, so we
>>> will get different rx_dropped statistic information while using ifconfig and
>> ethtool.
>>> this patch fills stats.rxdropped field with data from net core with
>>> dev_get_stats() just as ixgbe driver did for some of its stats.
>>>
>>> V2: only fix the stats.rxdropped field.
>>>
>>> Tested with last netxen 4.0.82
>>> Compiled with net-next branch 3.16-rc2
>>>
>>> Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
>>> Tested-by: Sriharsha Yadagudde <sriharsha.devdas@oracle.com>
>>> ---
>>>   .../ethernet/qlogic/netxen/netxen_nic_ethtool.c    |   34 +++++++++++++++++-
>> --
>>>   1 files changed, 29 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>> b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>> index 4ca2c19..49e6a1b 100644
>>> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>> @@ -33,22 +33,30 @@
>>>   #include "netxen_nic.h"
>>>   #include "netxen_nic_hw.h"
>>>
>>> +enum {NETDEV_STATS, NETXEN_STATS};
>>> +
>>>   struct netxen_nic_stats {
>>>   	char stat_string[ETH_GSTRING_LEN];
>>> +	int type;
>>>   	int sizeof_stat;
>>>   	int stat_offset;
>>>   };
>>>
>>> -#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_adapter *)0)->m), \
>>> +#define NETXEN_NIC_STAT(m)	NETXEN_STATS, \
>>> +			sizeof(((struct netxen_adapter *)0)->m), \
>>>   			offsetof(struct netxen_adapter, m)
>>>
>>> +#define NETXEN_NETDEV_STAT(m)	NETDEV_STATS, \
>>> +			sizeof(((struct rtnl_link_stats64 *)0)->m), \
>>> +			offsetof(struct rtnl_link_stats64, m)
>>> +
>>>   #define NETXEN_NIC_PORT_WINDOW 0x10000
>>>   #define NETXEN_NIC_INVALID_DATA 0xDEADBEEF
>>>
>>>   static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
>>>   	{"xmit_called", NETXEN_NIC_STAT(stats.xmitcalled)},
>>>   	{"xmit_finished", NETXEN_NIC_STAT(stats.xmitfinished)},
>>> -	{"rx_dropped", NETXEN_NIC_STAT(stats.rxdropped)},
>>> +	{"rx_dropped", NETXEN_NETDEV_STAT(rx_dropped)},
>>>   	{"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)},
>>>   	{"csummed", NETXEN_NIC_STAT(stats.csummed)},
>>>   	{"rx_pkts", NETXEN_NIC_STAT(stats.rx_pkts)}, @@ -679,11 +687,27 @@
>>> netxen_nic_get_ethtool_stats(struct net_device *dev,
>>>   {
>>>   	struct netxen_adapter *adapter = netdev_priv(dev);
>>>   	int index;
>>> +	struct rtnl_link_stats64 temp;
>>> +	const struct rtnl_link_stats64 *net_stats;
>>> +	char *p = NULL;
>>>
>>> +	net_stats = dev_get_stats(dev, &temp);
>>>   	for (index = 0; index < NETXEN_NIC_STATS_LEN; index++) {
>>> -		char *p =
>>> -		    (char *)adapter +
>>> -		    netxen_nic_gstrings_stats[index].stat_offset;
>>> +
>>> +		switch (netxen_nic_gstrings_stats[index].type) {
>>> +		case NETDEV_STATS:
>>> +			p = (char *)net_stats +
>>> +				netxen_nic_gstrings_stats[index].stat_offset;
>>> +			break;
>>> +		case NETXEN_STATS:
>>> +			p = (char *)adapter +
>>> +				netxen_nic_gstrings_stats[index].stat_offset;
>>> +			break;
>>> +		default:
>>> +			data[index] = 0;
>>> +			continue;
>>> +		}
>>> +
>>>   		data[index] =
>>>   		    (netxen_nic_gstrings_stats[index].sizeof_stat ==
>>>   		     sizeof(u64)) ? *(u64 *) p : *(u32 *) p;
> Ethan, I can't download this patch as I don’t see it in netdev patchwork. Just looking at the diff I think there is style issue with macro definition of NETXEN_NIC_STAT and NETXEN_NETDEV_STAT.
> Enclose macro definition in parentheses as they are containing complex values.
It's not an error as checkpatch.pl indicates.  As the definition of
netxen_nic_stats shows,

  struct netxen_nic_stats {
  	char stat_string[ETH_GSTRING_LEN];
+	int type;
  	int sizeof_stat;
  	int stat_offset;
  };

This macros consists of multiple elements, which shouldn't be enclosed
in parentheses.

>
> Send this patch targeted for net instead of net-next being a bug fix. Please also run checkpatch.pl to correct any style warning/errors in the patch.
>
> Thanks!!  
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats()
  2014-07-09 11:45     ` vaughan
@ 2014-07-10  1:31       ` ethan zhao
  0 siblings, 0 replies; 8+ messages in thread
From: ethan zhao @ 2014-07-10  1:31 UTC (permalink / raw)
  To: vaughan
  Cc: Manish Chopra, David Miller, balbi@ti.com, netdev, linux-kernel,
	sriharsha.devdas@oracle.com, ethan.kernel@gmail.com


On 2014/7/9 19:45, vaughan wrote:
> On 07/09/2014 07:32 PM, Manish Chopra wrote:
>>> -----Original Message-----
>>> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>>> On Behalf Of ethan zhao
>>> Sent: Wednesday, July 09, 2014 8:11 AM
>>> To: David Miller
>>> Cc: balbi@ti.com; netdev; linux-kernel; sriharsha.devdas@oracle.com;
>>> ethan.kernel@gmail.com; vaughan
>>> Subject: Re: [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in
>>> ethtool get_ethtool_stats()
>>>
>>> David,
>>>
>>>     Please help to review and confirm this patch.
>>>
>>> Thanks,
>>> Ethan
>>>
>>> On 2014/7/8 21:57, Ethan Zhao wrote:
>>>> netxen driver has implemented netxen_nic_get_ethtool_stats()
>>>> interface, but it doesn't collect stats.rxdropped in driver, so we
>>>> will get different rx_dropped statistic information while using ifconfig and
>>> ethtool.
>>>> this patch fills stats.rxdropped field with data from net core with
>>>> dev_get_stats() just as ixgbe driver did for some of its stats.
>>>>
>>>> V2: only fix the stats.rxdropped field.
>>>>
>>>> Tested with last netxen 4.0.82
>>>> Compiled with net-next branch 3.16-rc2
>>>>
>>>> Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
>>>> Tested-by: Sriharsha Yadagudde <sriharsha.devdas@oracle.com>
>>>> ---
>>>>    .../ethernet/qlogic/netxen/netxen_nic_ethtool.c    |   34 +++++++++++++++++-
>>> --
>>>>    1 files changed, 29 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>>> b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>>> index 4ca2c19..49e6a1b 100644
>>>> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>>> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
>>>> @@ -33,22 +33,30 @@
>>>>    #include "netxen_nic.h"
>>>>    #include "netxen_nic_hw.h"
>>>>
>>>> +enum {NETDEV_STATS, NETXEN_STATS};
>>>> +
>>>>    struct netxen_nic_stats {
>>>>    	char stat_string[ETH_GSTRING_LEN];
>>>> +	int type;
>>>>    	int sizeof_stat;
>>>>    	int stat_offset;
>>>>    };
>>>>
>>>> -#define NETXEN_NIC_STAT(m) sizeof(((struct netxen_adapter *)0)->m), \
>>>> +#define NETXEN_NIC_STAT(m)	NETXEN_STATS, \
>>>> +			sizeof(((struct netxen_adapter *)0)->m), \
>>>>    			offsetof(struct netxen_adapter, m)
>>>>
>>>> +#define NETXEN_NETDEV_STAT(m)	NETDEV_STATS, \
>>>> +			sizeof(((struct rtnl_link_stats64 *)0)->m), \
>>>> +			offsetof(struct rtnl_link_stats64, m)
>>>> +
>>>>    #define NETXEN_NIC_PORT_WINDOW 0x10000
>>>>    #define NETXEN_NIC_INVALID_DATA 0xDEADBEEF
>>>>
>>>>    static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = {
>>>>    	{"xmit_called", NETXEN_NIC_STAT(stats.xmitcalled)},
>>>>    	{"xmit_finished", NETXEN_NIC_STAT(stats.xmitfinished)},
>>>> -	{"rx_dropped", NETXEN_NIC_STAT(stats.rxdropped)},
>>>> +	{"rx_dropped", NETXEN_NETDEV_STAT(rx_dropped)},
>>>>    	{"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)},
>>>>    	{"csummed", NETXEN_NIC_STAT(stats.csummed)},
>>>>    	{"rx_pkts", NETXEN_NIC_STAT(stats.rx_pkts)}, @@ -679,11 +687,27 @@
>>>> netxen_nic_get_ethtool_stats(struct net_device *dev,
>>>>    {
>>>>    	struct netxen_adapter *adapter = netdev_priv(dev);
>>>>    	int index;
>>>> +	struct rtnl_link_stats64 temp;
>>>> +	const struct rtnl_link_stats64 *net_stats;
>>>> +	char *p = NULL;
>>>>
>>>> +	net_stats = dev_get_stats(dev, &temp);
>>>>    	for (index = 0; index < NETXEN_NIC_STATS_LEN; index++) {
>>>> -		char *p =
>>>> -		    (char *)adapter +
>>>> -		    netxen_nic_gstrings_stats[index].stat_offset;
>>>> +
>>>> +		switch (netxen_nic_gstrings_stats[index].type) {
>>>> +		case NETDEV_STATS:
>>>> +			p = (char *)net_stats +
>>>> +				netxen_nic_gstrings_stats[index].stat_offset;
>>>> +			break;
>>>> +		case NETXEN_STATS:
>>>> +			p = (char *)adapter +
>>>> +				netxen_nic_gstrings_stats[index].stat_offset;
>>>> +			break;
>>>> +		default:
>>>> +			data[index] = 0;
>>>> +			continue;
>>>> +		}
>>>> +
>>>>    		data[index] =
>>>>    		    (netxen_nic_gstrings_stats[index].sizeof_stat ==
>>>>    		     sizeof(u64)) ? *(u64 *) p : *(u32 *) p;
>> Ethan, I can't download this patch as I don’t see it in netdev patchwork. Just looking at the diff I think there is style issue with macro definition of NETXEN_NIC_STAT and NETXEN_NETDEV_STAT.
>> Enclose macro definition in parentheses as they are containing complex values.
> It's not an error as checkpatch.pl indicates.  As the definition of
> netxen_nic_stats shows,
>
>    struct netxen_nic_stats {
>    	char stat_string[ETH_GSTRING_LEN];
> +	int type;
>    	int sizeof_stat;
>    	int stat_offset;
>    };
>
> This macros consists of multiple elements, which shouldn't be enclosed
> in parentheses.
  Agree, I am sure it is error of checkpatch.pl.
  Thanks,
  Ethan
>> Send this patch targeted for net instead of net-next being a bug fix. Please also run checkpatch.pl to correct any style warning/errors in the patch.
>>
>> Thanks!!
>>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-10  1:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1404827830-22990-1-git-send-email-ethan.zhao@oracle.com>
2014-07-09  2:41 ` [PATCH NET-NEXT V2] netxen: fix ethtool rx_dropped information in ethtool get_ethtool_stats() ethan zhao
2014-07-09  3:46   ` David Miller
2014-07-09  5:15     ` ethan zhao
2014-07-09  6:30       ` Shahed Shaikh
2014-07-09  6:35         ` Ethan Zhao
2014-07-09 11:32   ` Manish Chopra
2014-07-09 11:45     ` vaughan
2014-07-10  1:31       ` ethan zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).