From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: davem@davemloft.net, charrer@alacritech.com, liodot@gmail.com,
gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
Date: Tue, 15 Nov 2016 21:46:57 +0100 [thread overview]
Message-ID: <69558f55-824a-7063-d9b3-ccc0a6113b87@gmx.de> (raw)
In-Reply-To: <20161113195544.GA18258@lunn.ch>
Hi,
On 13.11.2016 20:55, Andrew Lunn wrote:
>> +static const char slic_stats_strings[][ETH_GSTRING_LEN] = {
>> + "rx_packets ",
>> + "rx_bytes ",
>> + "rx_multicasts ",
>> + "rx_errors ",
>> + "rx_buff_miss ",
>> + "rx_tp_csum ",
>> + "rx_tp_oflow ",
>> + "rx_tp_hlen ",
>> + "rx_ip_csum ",
>> + "rx_ip_len ",
>
> Are there any other drivers which pad the statistics strings?
>
First off, thank you for the review!
I took a look into a few drivers and most of them do not pad the statistic strings.
Actually there are some that do (e.g. the chelsio drivers cxgb4, cxgb3, xcgb4v),
but this seems to be rather the minority, so I will remove it. Thank you for the hint.
>> +static void slic_set_link_autoneg(struct slic_device *sdev)
>> +{
>> + unsigned int subid = sdev->pdev->subsystem_device;
>> + u32 val;
>> +
>> + if (sdev->is_fiber) {
>> + /* We've got a fiber gigabit interface, and register 4 is
>> + * different in fiber mode than in copper mode.
>> + */
>> + /* advertise FD only @1000 Mb */
>> + val = MII_ADVERTISE << 16 | SLIC_PAR_ADV1000XFD |
>> + SLIC_PAR_ASYMPAUSE_FIBER;
>> + /* enable PAUSE frames */
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + /* reset phy, enable auto-neg */
>> + val = MII_BMCR << 16 | SLIC_PCR_RESET | SLIC_PCR_AUTONEG |
>> + SLIC_PCR_AUTONEG_RST;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + } else { /* copper gigabit */
>> + /* We've got a copper gigabit interface, and register 4 is
>> + * different in copper mode than in fiber mode.
>> + */
>> + /* advertise 10/100 Mb modes */
>> + val = MII_ADVERTISE << 16 | SLIC_PAR_ADV100FD |
>> + SLIC_PAR_ADV100HD | SLIC_PAR_ADV10FD | SLIC_PAR_ADV10HD;
>> + /* enable PAUSE frames */
>> + val |= SLIC_PAR_ASYMPAUSE;
>> + /* required by the Cicada PHY */
>> + val |= SLIC_PAR_802_3;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> +
>> + /* advertise FD only @1000 Mb */
>> + val = MII_CTRL1000 << 16 | SLIC_PGC_ADV1000FD;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> +
>> + if (subid != PCI_SUBDEVICE_ID_ALACRITECH_CICADA) {
>> + /* if a Marvell PHY enable auto crossover */
>> + val = SLIC_MIICR_REG_16 | SLIC_MRV_REG16_XOVERON;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> +
>> + /* reset phy, enable auto-neg */
>> + val = MII_BMCR << 16 | SLIC_PCR_RESET |
>> + SLIC_PCR_AUTONEG | SLIC_PCR_AUTONEG_RST;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + } else {
>> + /* enable and restart auto-neg (don't reset) */
>> + val = MII_BMCR << 16 | SLIC_PCR_AUTONEG |
>> + SLIC_PCR_AUTONEG_RST;
>> + slic_write(sdev, SLIC_REG_WPHY, val);
>> + }
>> + }
>> + sdev->autoneg = true;
>> +}
>
> Could this be pulled out into a standard PHY driver? All the SLIC
> SLIC_PCR_ defines seems to be the same as those in mii.h. This could
> be a standard PHY hidden behind a single register.
>
> Andrew
You are right, the driver should really use the defines in mii.h. I will fix this in
a v2.
Concerning the use of the PHY API: What would be the advantage of using it? Note that the
phy is always internal and not interchangeable. Is not the interchangeability of PHYs
the main reason for using this API?
Regards,
Lino
next prev parent reply other threads:[~2016-11-15 20:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-13 4:47 Gigabit ethernet driver for Alacritechs SLIC devices Lino Sanfilippo
2016-11-13 4:47 ` [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver Lino Sanfilippo
2016-11-13 7:13 ` kbuild test robot
2016-11-13 8:38 ` kbuild test robot
2016-11-13 19:55 ` Andrew Lunn
2016-11-15 20:46 ` Lino Sanfilippo [this message]
2016-11-15 20:54 ` Florian Fainelli
2016-11-15 21:24 ` Lino Sanfilippo
2016-11-15 21:59 ` Andrew Lunn
2016-11-15 22:34 ` Lino Sanfilippo
2016-11-15 22:39 ` Florian Fainelli
2016-11-15 22:54 ` Lino Sanfilippo
2016-11-15 23:03 ` Andrew Lunn
2016-11-15 23:14 ` Lino Sanfilippo
2016-11-24 12:30 ` Aw: " Lino Sanfilippo
2016-11-13 4:47 ` [net-next 2/2] MAINTAINERS: add entry for slicoss " Lino Sanfilippo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69558f55-824a-7063-d9b3-ccc0a6113b87@gmx.de \
--to=linosanfilippo@gmx.de \
--cc=andrew@lunn.ch \
--cc=charrer@alacritech.com \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liodot@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®