Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1701081

Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor lan9303_xxx_packet_processing()

From Egil Hjelmeland <privat@egil-hjelmeland.no>
Newsgroups linux.kernel
Subject Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor lan9303_xxx_packet_processing()
Date 2017-08-01 16:00 +0200
Message-ID <u9FSj-4Gv-23@gated-at.bofh.it> (permalink)
References <u9Dnr-3jr-1@gated-at.bofh.it> <u9Dnt-3jr-37@gated-at.bofh.it> <u9FIC-4Dg-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01. aug. 2017 15:39, Andrew Lunn wrote:
>> @@ -704,7 +710,7 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port,
>>   	unsigned int u, poff;
>>   	int ret;
>>   
>> -	poff = port * 0x400;
>> +	poff = LAN9303_SWITCH_PORT_REG(port, 0);
>>   
>>   	for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
>>   		ret = lan9303_read_switch_reg(chip,
> 
> So the actual code is:
> 
> 	for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
>         		ret = lan9303_read_switch_reg(chip,
> 			      		      lan9303_mib[u].offset + poff,
> 					      &reg);
> 
> Could this be written as
> 
> 	for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
> 		ret = lan9303_read_switch_port(chip, port, lan9303_mib[u].offset, &reg);
> 
> It is then clear you are reading the statistics from a port register.
> 
>     Andrew
> 

Yes it can. Since it is (insignificantly) less efficient, I
chose not to touch it. But I can do it if you like.

Egil

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 net-next 0/3] Refactor lan9303_xxx_packet_processing Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 13:20 +0200
  [PATCH v2 net-next 2/3] net: dsa: lan9303: define LAN9303_NUM_PORTS 3 Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 13:20 +0200
    Re: [PATCH v2 net-next 2/3] net: dsa: lan9303: define LAN9303_NUM_PORTS 3 Juergen Borleis <jbe@pengutronix.de> - 2017-08-01 14:00 +0200
      Re: [PATCH v2 net-next 2/3] net: dsa: lan9303: define  LAN9303_NUM_PORTS 3 Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 14:40 +0200
        Re: [PATCH v2 net-next 2/3] net: dsa: lan9303: define  LAN9303_NUM_PORTS 3 Andrew Lunn <andrew@lunn.ch> - 2017-08-01 15:30 +0200
          Re: [PATCH v2 net-next 2/3] net: dsa: lan9303: define  LAN9303_NUM_PORTS 3 Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 15:50 +0200
          Re: [PATCH v2 net-next 2/3] net: dsa: lan9303: define  LAN9303_NUM_PORTS 3 Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-03 12:00 +0200
            Re: [PATCH v2 net-next 2/3] net: dsa: lan9303: define  LAN9303_NUM_PORTS 3 Andrew Lunn <andrew@lunn.ch> - 2017-08-03 15:40 +0200
  [PATCH v2 net-next 3/3] net: dsa: lan9303: Simplify lan9303_xxx_packet_processing() usage Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 13:20 +0200
  [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor lan9303_xxx_packet_processing() Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 13:20 +0200
    Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor  lan9303_xxx_packet_processing() Andrew Lunn <andrew@lunn.ch> - 2017-08-01 15:50 +0200
      Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor  lan9303_xxx_packet_processing() Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 16:00 +0200
        Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor  lan9303_xxx_packet_processing() Andrew Lunn <andrew@lunn.ch> - 2017-08-01 16:10 +0200
          Re: [PATCH v2 net-next 1/3] net: dsa: lan9303: Refactor  lan9303_xxx_packet_processing() Egil Hjelmeland <privat@egil-hjelmeland.no> - 2017-08-01 16:50 +0200

csiph-web