* Re: [ethtool PATCH 5/6] v4 Add RX packet classification interface
From: Ben Hutchings @ 2011-04-27 23:00 UTC (permalink / raw)
To: Alexander Duyck; +Cc: davem, jeffrey.t.kirsher, netdev
In-Reply-To: <1303927934.2875.82.camel@bwh-desktop>
On Wed, 2011-04-27 at 19:12 +0100, Ben Hutchings wrote:
> On Thu, 2011-04-21 at 13:40 -0700, Alexander Duyck wrote:
[...]
> > + fprintf(stdout,
> > + "\tVLAN EtherType: 0x%x mask: 0x%x\n"
>
> Lower-case 'ethertype', please.
[...]
Sorry, your capitalisation here is correct and the existing uses in
lower-case are wrong.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCHv2 3/4] ethtool: Use the full 32 bit speed range in ethtool's set_settings
From: Stephen Hemminger @ 2011-04-27 22:23 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, Ben Hutchings, mirq-linux, Stanislaw Gruszka,
Alexander Duyck, Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-4-git-send-email-decot@google.com>
On Wed, 27 Apr 2011 11:34:48 -0700
David Decotigny <decot@google.com> wrote:
> diff --git a/drivers/net/skge.c b/drivers/net/skge.c
> index 176d784..b0fa999 100644
> --- a/drivers/net/skge.c
> +++ b/drivers/net/skge.c
> @@ -322,7 +322,7 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
> } else {
> u32 setting;
>
> - switch (ecmd->speed) {
> + switch (ethtool_cmd_speed(ecmd)) {
> case SPEED_1000:
> if (ecmd->duplex == DUPLEX_FULL)
> setting = SUPPORTED_1000baseT_Full;
> @@ -355,7 +355,7 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
> if ((setting & supported) == 0)
> return -EINVAL;
>
> - skge->speed = ecmd->speed;
> + skge->speed = ethtool_cmd_speed(ecmd);
> skge->duplex = ecmd->duplex;
> }
>
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index c8d0451..40afe07 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -3453,7 +3453,7 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
> } else {
> u32 setting;
>
> - switch (ecmd->speed) {
> + switch (ethtool_cmd_speed(ecmd)) {
> case SPEED_1000:
> if (ecmd->duplex == DUPLEX_FULL)
> setting = SUPPORTED_1000baseT_Full;
> @@ -3486,7 +3486,7 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
> if ((setting & supported) == 0)
> return -EINVAL;
>
> - sky2->speed = ecmd->speed;
> + sky2->speed = ethtool_cmd_speed(ecmd);
> sky2->duplex = ecmd->duplex;
> sky2->flags &= ~SKY2_FLAG_AUTO_SPEED;
> }
These two are trivial, thanks for doing it.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
--
^ permalink raw reply
* Re: [PATCHv2 3/4] ethtool: Use the full 32 bit speed range in ethtool's set_settings
From: David Decotigny @ 2011-04-27 22:05 UTC (permalink / raw)
To: Ben Hutchings
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303932477.2875.130.camel@bwh-desktop>
Hi,
On 04/27/11 12:27, Ben Hutchings wrote:
>> diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
>> index b13c6b0..f8d26bf 100644
>> --- a/drivers/net/tulip/de2104x.c
>> +++ b/drivers/net/tulip/de2104x.c
>> @@ -1549,10 +1549,11 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
>> {
>> u32 new_media;
>> unsigned int media_lock;
>> + u32 speed = ethtool_cmd_speed(ecmd);
>>
>> - if (ecmd->speed != SPEED_10 && ecmd->speed != 5 && ecmd->speed != 2)
>> + if (speed != SPEED_10 && speed != 5 && speed != 2)
>> return -EINVAL;
>> - if (de->de21040 && ecmd->speed == 2)
>> + if (de->de21040 && speed == 2)
>> return -EINVAL;
>> if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
>> return -EINVAL;
> [...]
>
> This implementation is absolute crap - it's using speed values as
> mnemonics for different physical ports! Please change it to report and
> accept only speed = 10. (Both get_settings and set_settings have to be
> changed at the same time.)
Well, I am really not sure about this. At first I thought you meant that
these non standard throughputs were a weird way to switch between
different ports because of some limitation in the ethtool API at the
time the driver was written. But looking at the history, this behavior
is there right from the very first revision of the driver checked in in
v2.5.0.9
(http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commit;h=b1507c9acd944c8703612c0e38ac580bf9064e8a),
and the ports could be switched the normal way with ecmd->port. So this
leads me to think that these speeds are actual speeds and make sense as
such, they are not a work-around over some ancient ethtool API
limitation. I have the patch ready but I would appreciate any feedback
on this.
Anyway, all your comments are really pertinent and ready to be sent.
Thank you!
Regards,
^ permalink raw reply
* Re: Linux TCP's Robustness to Multipath Packet Reordering
From: Yuchung Cheng @ 2011-04-27 21:41 UTC (permalink / raw)
To: Dominik Kaspar
Cc: Carsten Wolff, John Heffner, Eric Dumazet, netdev,
Zimmermann Alexander, Lennart Schulte, Arnd Hannemann
In-Reply-To: <BANLkTinsHuP3XSSghfpYET=os9VcJ3FRDA@mail.gmail.com>
AFAIK, FACK is disabled throughout the life of the connection after
sender detects reordering degree > 3.
But Alex said the reordering has some bugs. I suspect these bugs may
affect FACK/sack auto-tuning. Maybe Alex could describe the reordering
bugs?
On Wed, Apr 27, 2011 at 12:56 PM, Dominik Kaspar
<dokaspar.ietf@gmail.com> wrote:
> Hi Yuchung,
>
> Yes, FACK was enabled (as it is by default), but as Alexander already
> pointed out, it should be disabled automatically when TCP detects
> reordering.
>
> However, I am not so sure how well this automatic turning off FACK is
> done by Linux... I see a tendency that in situations with persistent
> packet reordering, TCP with FACK enabled gets a lower performance than
> if FACK is disabled right from the beginning of a connection.
>
> Greetings,
> Dominik
>
> On Wed, Apr 27, 2011 at 7:39 PM, Yuchung Cheng <ycheng@google.com> wrote:
>> Hi Dominik,
>>
>> On Wed, Apr 27, 2011 at 9:22 AM, Dominik Kaspar <dokaspar.ietf@gmail.com> wrote:
>>>
>>> Hi Carsten,
>>>
>>> Thanks for your feedback. I made some new tests with the same setup of
>>> packet-based forwarding over two emulated paths (600 KB/s, 10 ms) +
>>> (400 KB/s, 100 ms). In the first experiments, which showed a step-wise
>>> adaptation to reordering, SACK, DSACK, and Timestamps were all
>>> enabled. In the experiments, I individually disabled these three
>>> mechanisms and saw the following:
>>>
>>> - Disabling timestamps causes TCP to never adjust to reordering at all.
>>> - Disabling SACK allows TCP to adapt very rapidly ("perfect" aggregation!).
>>
>> Did you enable tcp_fack when sack is enabled? this may make a (big)
>> difference. FACK assumes little network reordering and mark packet
>> losses more aggressively.
>>
>>> - Disabling DSACK has no obvious impact (still a step-wise throughput).
>>>
>>> Is there an explanation for why turning off SACK can be beneficial in
>>> the presence of packet reordering? That sounds pretty
>>> counter-intuitive to me... I thought SACK=1 always performs better
>>> than SACK=0. The results are also illustrated in the following plot.
>>> For each setting, there are three runs, which all exhibit a similar
>>> behavior:
>>>
>>> http://home.simula.no/~kaspar/static/mptcp-emu-wlan-hspa-02-sack.png
>>>
>>> Greetings,
>>> Dominik
>>>
>>> On Wed, Apr 27, 2011 at 11:57 AM, Carsten Wolff <carsten@wolffcarsten.de> wrote:
>>> > Hi all,
>>> >
>>> > On Tuesday 26 April 2011, John Heffner wrote:
>>> >> First, TCP is definitely not designed to work under such conditions.
>>> >> For example, assumptions behind RTO calculation and fast retransmit
>>> >> heuristics are violated. However, in this particular case my first
>>> >> guess is that you are being limited by "cwnd moderation," which was
>>> >> the topic of recent discussion here. Under persistent reordering,
>>> >> cwnd moderation can inhibit the ability of cwnd to grow.
>>> >
>>> > it's not just cwnd moderation (of which I'm still in favor, even though I lost
>>> > the argument by inactivity ;-)).
>>> >
>>> > Anyway, there are a lot of things in reordering handling that can be improved.
>>> > Our group (Alexander, Lennart, Arnd, myself and others) has worked on the
>>> > problem for a long time now. This work resulted in an algorithm that is in
>>> > large parts TCP-NCR (RFC4653), but also utilizes information gathered by
>>> > reordering detection for determination of a good DupThresh, fixes a few
>>> > problems in RFC4653 and improves on the reordering detection in Linux when the
>>> > connection has no timestamps option. We implemented "pure" TCP-NCR and our own
>>> > variant in Linux using a modular framework similar to the congestion control
>>> > modules. A lot of measurements and evaluation have gone into the comparison of
>>> > the three algorithms. We are now very close(TM) to a final patch, that is more
>>> > suited for publication on this list and integrates our algorithm into tcp*.
>>> > [hc] without introducing the overhead of that modular framework.
>>> >
>>> > Greetings,
>>> > Carsten
>>> >
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
^ permalink raw reply
* Re: [PATCH rfc 2/5] r8169: rtl8169_set_speed_xmii cleanup.
From: Ben Hutchings @ 2011-04-27 21:13 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev, Realtek linux nic maintainers
In-Reply-To: <20110427203702.GE19708@electric-eye.fr.zoreil.com>
On Wed, 2011-04-27 at 22:37 +0200, Francois Romieu wrote:
> - use ADVERTISE_ALL
> - shorten chipset version test
>
> No functional change.
>
> Careful readers will notice that the 'supports_gmii' flag is deduced
> from the device PCI id. Though less specific than the chipset related
> RTL_GIGA_MAC_VER_XY, it is currently good enough to detect a GMII
> deprieved 810x.
> Some features may push for a device specific configuration (improved
> jumbo frame support for instance). 'supports_gmii' will follow this
> path if / when the device PCI id stops working.
>
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
> ---
> drivers/net/r8169.c | 14 ++------------
> 1 files changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> index 0bb0c0d..006f0df 100644
> --- a/drivers/net/r8169.c
> +++ b/drivers/net/r8169.c
> @@ -1242,8 +1242,7 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
> int auto_nego;
>
> auto_nego = rtl_readphy(tp, MII_ADVERTISE);
> - auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
> - ADVERTISE_100HALF | ADVERTISE_100FULL);
> + auto_nego &= ADVERTISE_ALL;
[...]
You mean ~ADVERTISE_ALL. Though ADVERTISE_ALL is really not a good name
and I think this is clearer with the individual advertising flags
spelled out.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH 1/4] ipv4: Respect 'saddr' and 'daddr' args to ip_build_and_send_pkt().
From: David Miller @ 2011-04-27 21:03 UTC (permalink / raw)
To: netdev
In-Reply-To: <20110426.151200.179925027.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Tue, 26 Apr 2011 15:12:00 -0700 (PDT)
>
> This function ignores the passed in addresses and forces their
> settings using rt->rt_dst and rt->rt_src.
>
> There is never a reason to do this, because the socket of the
> callers of this function must know what addresses it is using.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
I did not end up applying this one to net-next-2.6, it's not correct.
It would break things when the source routing is enabled on the
socket.
When that happens, we look up the route to the SRR options's first
entry, not the actual final destination. And that initial SRR option
address is the destination IP address we need to use in the IP header
this we need to use rt->rt_{src,dst}.
This could be implemented properly by doing something like:
if (opt && opt->srr)
iph->daddr = x;
else
iph->daddr = daddr;
I'll think about it.
^ permalink raw reply
* Re: [PATCH rfc 1/5] r8169: style cleanups.
From: David Miller @ 2011-04-27 21:00 UTC (permalink / raw)
To: joe; +Cc: romieu, netdev, nic_swsd
In-Reply-To: <1303937974.24299.92.camel@Joe-Laptop>
From: Joe Perches <joe@perches.com>
Date: Wed, 27 Apr 2011 13:59:34 -0700
> On Wed, 2011-04-27 at 22:36 +0200, Francois Romieu wrote:
>> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> []
>> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> []
>> @@ -3134,8 +3128,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
> []
>> - if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
>> - tp->mac_version == RTL_GIGA_MAC_VER_33)
>> + if ((tp->mac_version == RTL_GIGA_MAC_VER_32) ||
>> + (tp->mac_version == RTL_GIGA_MAC_VER_33))
>
> Shrug. I don't think this is better.
Yeah, same here.
^ permalink raw reply
* Re: [PATCH rfc 1/5] r8169: style cleanups.
From: Joe Perches @ 2011-04-27 20:59 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev, Realtek linux nic maintainers
In-Reply-To: <20110427203654.GD19708@electric-eye.fr.zoreil.com>
On Wed, 2011-04-27 at 22:36 +0200, Francois Romieu wrote:
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
[]
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
[]
> @@ -3134,8 +3128,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
[]
> - if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
> - tp->mac_version == RTL_GIGA_MAC_VER_33)
> + if ((tp->mac_version == RTL_GIGA_MAC_VER_32) ||
> + (tp->mac_version == RTL_GIGA_MAC_VER_33))
Shrug. I don't think this is better.
^ permalink raw reply
* Re: [PATCH net-next] r8169: fix merge conflict fix.
From: David Miller @ 2011-04-27 20:52 UTC (permalink / raw)
To: romieu; +Cc: sfr, netdev, linux-next, linux-kernel, nic_swsd
In-Reply-To: <20110427203640.GC19708@electric-eye.fr.zoreil.com>
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Wed, 27 Apr 2011 22:36:40 +0200
> - use adequate MAC_VER id
> (see 01dc7fec4025f6bb72b6b98ec88b375346b6dbbb)
> - remove duplicate rtl_firmware_info record
> - remove duplicate functions
>
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
Applied, thanks.
^ permalink raw reply
* [PATCH rfc] atm/iphase : removal of PCI space dereferences.
From: Francois Romieu @ 2011-04-27 20:38 UTC (permalink / raw)
To: netdev; +Cc: Chas Williams
Mostly PHY access and a few (ugly) debug statements for DMA control.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
Really RFCish. I ought to be able to give it some trivial crash testing.
drivers/atm/iphase.c | 263 ++++++++++++++++++---------------
drivers/atm/iphase.h | 391 ++++++++++++++++++++++++--------------------------
2 files changed, 333 insertions(+), 321 deletions(-)
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index dee4f01..68189c7 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -817,127 +817,150 @@ static void ia_hw_type(IADEV *iadev) {
}
-static void IaFrontEndIntr(IADEV *iadev) {
- volatile IA_SUNI *suni;
- volatile ia_mb25_t *mb25;
- volatile suni_pm7345_t *suni_pm7345;
-
- if(iadev->phy_type & FE_25MBIT_PHY) {
- mb25 = (ia_mb25_t*)iadev->phy;
- iadev->carrier_detect = Boolean(mb25->mb25_intr_status & MB25_IS_GSB);
- } else if (iadev->phy_type & FE_DS3_PHY) {
- suni_pm7345 = (suni_pm7345_t *)iadev->phy;
- /* clear FRMR interrupts */
- (void) suni_pm7345->suni_ds3_frm_intr_stat;
- iadev->carrier_detect =
- Boolean(!(suni_pm7345->suni_ds3_frm_stat & SUNI_DS3_LOSV));
- } else if (iadev->phy_type & FE_E3_PHY ) {
- suni_pm7345 = (suni_pm7345_t *)iadev->phy;
- (void) suni_pm7345->suni_e3_frm_maint_intr_ind;
- iadev->carrier_detect =
- Boolean(!(suni_pm7345->suni_e3_frm_fram_intr_ind_stat&SUNI_E3_LOS));
- }
- else {
- suni = (IA_SUNI *)iadev->phy;
- (void) suni->suni_rsop_status;
- iadev->carrier_detect = Boolean(!(suni->suni_rsop_status & SUNI_LOSV));
- }
- if (iadev->carrier_detect)
- printk("IA: SUNI carrier detected\n");
- else
- printk("IA: SUNI carrier lost signal\n");
- return;
+static u32 ia_phy_read32(struct iadev_priv *ia, unsigned int reg)
+{
+ return readl(ia->phy + reg);
+}
+
+static void ia_phy_write32(struct iadev_priv *ia, unsigned int reg, u32 val)
+{
+ writel(val, ia->phy + reg);
+}
+
+static void ia_frontend_intr(struct iadev_priv *iadev)
+{
+ u32 status;
+
+ if (iadev->phy_type & FE_25MBIT_PHY) {
+ status = ia_phy_read32(iadev, MB25_INTR_STATUS);
+ iadev->carrier_detect = (status & MB25_IS_GSB) ? 1 : 0;
+ } else if (iadev->phy_type & FE_DS3_PHY) {
+ status = ia_phy_read32(iadev, SUNI_DS3_FRM_STAT);
+ iadev->carrier_detect = (status & SUNI_DS3_LOSV) ? 0 : 1;
+ } else if (iadev->phy_type & FE_E3_PHY) {
+ status = ia_phy_read32(iadev, SUNI_E3_FRM_MAINT_INTR_IND);
+ iadev->carrier_detect = (status & SUNI_E3_LOS) ? 0 : 1;
+ } else {
+ status = ia_phy_read32(iadev, SUNI_RSOP_STATUS);
+ iadev->carrier_detect = (status & SUNI_LOSV) ? 0 : 1;
+ }
+
+ printk(KERN_INFO "IA: SUNI carrier %s\n",
+ iadev->carrier_detect ? "detected" : "lost signal");
}
-static void ia_mb25_init (IADEV *iadev)
+static void ia_mb25_init(struct iadev_priv *iadev)
{
- volatile ia_mb25_t *mb25 = (ia_mb25_t*)iadev->phy;
#if 0
mb25->mb25_master_ctrl = MB25_MC_DRIC | MB25_MC_DREC | MB25_MC_ENABLED;
#endif
- mb25->mb25_master_ctrl = MB25_MC_DRIC | MB25_MC_DREC;
- mb25->mb25_diag_control = 0;
- /*
- * Initialize carrier detect state
- */
- iadev->carrier_detect = Boolean(mb25->mb25_intr_status & MB25_IS_GSB);
- return;
-}
+ ia_phy_write32(iadev, MB25_MASTER_CTRL, MB25_MC_DRIC | MB25_MC_DREC);
+ ia_phy_write32(iadev, MB25_DIAG_CONTROL, 0);
+
+ iadev->carrier_detect =
+ (ia_phy_read32(iadev, MB25_INTR_STATUS) & MB25_IS_GSB) ? 1 : 0;
+}
-static void ia_suni_pm7345_init (IADEV *iadev)
+struct ia_reg {
+ u16 reg;
+ u16 val;
+};
+
+static void ia_phy_write(struct iadev_priv *iadev,
+ const struct ia_reg *regs, int len)
{
- volatile suni_pm7345_t *suni_pm7345 = (suni_pm7345_t *)iadev->phy;
- if (iadev->phy_type & FE_DS3_PHY)
- {
- iadev->carrier_detect =
- Boolean(!(suni_pm7345->suni_ds3_frm_stat & SUNI_DS3_LOSV));
- suni_pm7345->suni_ds3_frm_intr_enbl = 0x17;
- suni_pm7345->suni_ds3_frm_cfg = 1;
- suni_pm7345->suni_ds3_tran_cfg = 1;
- suni_pm7345->suni_config = 0;
- suni_pm7345->suni_splr_cfg = 0;
- suni_pm7345->suni_splt_cfg = 0;
- }
- else
- {
- iadev->carrier_detect =
- Boolean(!(suni_pm7345->suni_e3_frm_fram_intr_ind_stat & SUNI_E3_LOS));
- suni_pm7345->suni_e3_frm_fram_options = 0x4;
- suni_pm7345->suni_e3_frm_maint_options = 0x20;
- suni_pm7345->suni_e3_frm_fram_intr_enbl = 0x1d;
- suni_pm7345->suni_e3_frm_maint_intr_enbl = 0x30;
- suni_pm7345->suni_e3_tran_stat_diag_options = 0x0;
- suni_pm7345->suni_e3_tran_fram_options = 0x1;
- suni_pm7345->suni_config = SUNI_PM7345_E3ENBL;
- suni_pm7345->suni_splr_cfg = 0x41;
- suni_pm7345->suni_splt_cfg = 0x41;
- }
- /*
- * Enable RSOP loss of signal interrupt.
- */
- suni_pm7345->suni_intr_enbl = 0x28;
-
- /*
- * Clear error counters
- */
- suni_pm7345->suni_id_reset = 0;
-
- /*
- * Clear "PMCTST" in master test register.
- */
- suni_pm7345->suni_master_test = 0;
-
- suni_pm7345->suni_rxcp_ctrl = 0x2c;
- suni_pm7345->suni_rxcp_fctrl = 0x81;
-
- suni_pm7345->suni_rxcp_idle_pat_h1 =
- suni_pm7345->suni_rxcp_idle_pat_h2 =
- suni_pm7345->suni_rxcp_idle_pat_h3 = 0;
- suni_pm7345->suni_rxcp_idle_pat_h4 = 1;
-
- suni_pm7345->suni_rxcp_idle_mask_h1 = 0xff;
- suni_pm7345->suni_rxcp_idle_mask_h2 = 0xff;
- suni_pm7345->suni_rxcp_idle_mask_h3 = 0xff;
- suni_pm7345->suni_rxcp_idle_mask_h4 = 0xfe;
-
- suni_pm7345->suni_rxcp_cell_pat_h1 =
- suni_pm7345->suni_rxcp_cell_pat_h2 =
- suni_pm7345->suni_rxcp_cell_pat_h3 = 0;
- suni_pm7345->suni_rxcp_cell_pat_h4 = 1;
-
- suni_pm7345->suni_rxcp_cell_mask_h1 =
- suni_pm7345->suni_rxcp_cell_mask_h2 =
- suni_pm7345->suni_rxcp_cell_mask_h3 =
- suni_pm7345->suni_rxcp_cell_mask_h4 = 0xff;
-
- suni_pm7345->suni_txcp_ctrl = 0xa4;
- suni_pm7345->suni_txcp_intr_en_sts = 0x10;
- suni_pm7345->suni_txcp_idle_pat_h5 = 0x55;
-
- suni_pm7345->suni_config &= ~(SUNI_PM7345_LLB |
- SUNI_PM7345_CLB |
- SUNI_PM7345_DLB |
- SUNI_PM7345_PLB);
+ while (len--) {
+ ia_phy_write32(iadev, regs->reg, regs->val);
+ regs++;
+ }
+}
+
+static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev)
+{
+ static const struct ia_reg suni_ds3_init [] = {
+ { SUNI_DS3_FRM_INTR_ENBL, 0x17 },
+ { SUNI_DS3_FRM_CFG, 0x01 },
+ { SUNI_DS3_TRAN_CFG, 0x01 },
+ { SUNI_CONFIG, 0 },
+ { SUNI_SPLR_CFG, 0 },
+ { SUNI_SPLT_CFG, 0 }
+ };
+ u32 status;
+
+ status = ia_phy_read32(iadev, SUNI_DS3_FRM_STAT);
+ iadev->carrier_detect = (status & SUNI_DS3_LOSV) ? 0 : 1;
+
+ ia_phy_write(iadev, suni_ds3_init, ARRAY_SIZE(suni_ds3_init));
+}
+
+static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev)
+{
+ static const struct ia_reg suni_e3_init [] = {
+ { SUNI_E3_FRM_FRAM_OPTIONS, 0x04 },
+ { SUNI_E3_FRM_MAINT_OPTIONS, 0x20 },
+ { SUNI_E3_FRM_FRAM_INTR_ENBL, 0x1d },
+ { SUNI_E3_FRM_MAINT_INTR_ENBL, 0x30 },
+ { SUNI_E3_TRAN_STAT_DIAG_OPTIONS, 0 },
+ { SUNI_E3_TRAN_FRAM_OPTIONS, 0x01 },
+ { SUNI_CONFIG, SUNI_PM7345_E3ENBL },
+ { SUNI_SPLR_CFG, 0x41 },
+ { SUNI_SPLT_CFG, 0x41 }
+ };
+ u32 status;
+
+ status = ia_phy_read32(iadev, SUNI_E3_FRM_FRAM_INTR_IND_STAT);
+ iadev->carrier_detect = (status & SUNI_E3_LOS) ? 0 : 1;
+ ia_phy_write(iadev, suni_e3_init, ARRAY_SIZE(suni_e3_init));
+}
+
+static void ia_suni_pm7345_init(struct iadev_priv *iadev)
+{
+ static const struct ia_reg suni_init [] = {
+ /* Enable RSOP loss of signal interrupt. */
+ { SUNI_INTR_ENBL, 0x28 },
+ /* Clear error counters. */
+ { SUNI_ID_RESET, 0 },
+ /* Clear "PMCTST" in master test register. */
+ { SUNI_MASTER_TEST, 0 },
+
+ { SUNI_RXCP_CTRL, 0x2c },
+ { SUNI_RXCP_FCTRL, 0x81 },
+
+ { SUNI_RXCP_IDLE_PAT_H1, 0 },
+ { SUNI_RXCP_IDLE_PAT_H2, 0 },
+ { SUNI_RXCP_IDLE_PAT_H3, 0 },
+ { SUNI_RXCP_IDLE_PAT_H4, 0x01 },
+
+ { SUNI_RXCP_IDLE_MASK_H1, 0xff },
+ { SUNI_RXCP_IDLE_MASK_H2, 0xff },
+ { SUNI_RXCP_IDLE_MASK_H3, 0xff },
+ { SUNI_RXCP_IDLE_MASK_H4, 0xfe },
+
+ { SUNI_RXCP_CELL_PAT_H1, 0 },
+ { SUNI_RXCP_CELL_PAT_H2, 0 },
+ { SUNI_RXCP_CELL_PAT_H3, 0 },
+ { SUNI_RXCP_CELL_PAT_H4, 0x01 },
+
+ { SUNI_RXCP_CELL_MASK_H1, 0xff },
+ { SUNI_RXCP_CELL_MASK_H2, 0xff },
+ { SUNI_RXCP_CELL_MASK_H3, 0xff },
+ { SUNI_RXCP_CELL_MASK_H4, 0xff },
+
+ { SUNI_TXCP_CTRL, 0xa4 },
+ { SUNI_TXCP_INTR_EN_STS, 0x10 },
+ { SUNI_TXCP_IDLE_PAT_H5, 0x55 }
+ };
+
+ if (iadev->phy_type & FE_DS3_PHY)
+ ia_suni_pm7345_init_ds3(iadev);
+ else
+ ia_suni_pm7345_init_e3(iadev);
+
+ ia_phy_write(iadev, suni_init, ARRAY_SIZE(suni_init));
+
+ ia_phy_write32(iadev, SUNI_CONFIG, ia_phy_read32(iadev, SUNI_CONFIG) &
+ ~(SUNI_PM7345_LLB | SUNI_PM7345_CLB |
+ SUNI_PM7345_DLB | SUNI_PM7345_PLB));
#ifdef __SNMP__
suni_pm7345->suni_rxcp_intr_en_sts |= SUNI_OOCDE;
#endif /* __SNMP__ */
@@ -1424,10 +1447,10 @@ static int rx_init(struct atm_dev *dev)
iadev->dma + IPHASE5575_RX_LIST_ADDR);
IF_INIT(printk("Tx Dle list addr: 0x%p value: 0x%0x\n",
iadev->dma+IPHASE5575_TX_LIST_ADDR,
- *(u32*)(iadev->dma+IPHASE5575_TX_LIST_ADDR));
+ readl(iadev->dma + IPHASE5575_TX_LIST_ADDR));
printk("Rx Dle list addr: 0x%p value: 0x%0x\n",
iadev->dma+IPHASE5575_RX_LIST_ADDR,
- *(u32*)(iadev->dma+IPHASE5575_RX_LIST_ADDR));)
+ readl(iadev->dma + IPHASE5575_RX_LIST_ADDR));)
writew(0xffff, iadev->reass_reg+REASS_MASK_REG);
writew(0, iadev->reass_reg+MODE_REG);
@@ -2207,7 +2230,7 @@ static irqreturn_t ia_int(int irq, void *dev_id)
if (status & STAT_DLERINT)
{
/* Clear this bit by writing a 1 to it. */
- *(u_int *)(iadev->reg+IPHASE5575_BUS_STATUS_REG) = STAT_DLERINT;
+ writel(STAT_DLERINT, iadev->reg + IPHASE5575_BUS_STATUS_REG);
rx_dle_intr(dev);
}
if (status & STAT_SEGINT)
@@ -2218,13 +2241,13 @@ static irqreturn_t ia_int(int irq, void *dev_id)
}
if (status & STAT_DLETINT)
{
- *(u_int *)(iadev->reg+IPHASE5575_BUS_STATUS_REG) = STAT_DLETINT;
+ writel(STAT_DLETINT, iadev->reg + IPHASE5575_BUS_STATUS_REG);
tx_dle_intr(dev);
}
if (status & (STAT_FEINT | STAT_ERRINT | STAT_MARKINT))
{
if (status & STAT_FEINT)
- IaFrontEndIntr(iadev);
+ ia_frontend_intr(iadev);
}
}
return IRQ_RETVAL(handled);
@@ -2555,7 +2578,7 @@ static int __devinit ia_start(struct atm_dev *dev)
goto err_free_rx;
}
/* Get iadev->carrier_detect status */
- IaFrontEndIntr(iadev);
+ ia_frontend_intr(iadev);
}
return 0;
@@ -2826,7 +2849,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
case 0xb:
if (!capable(CAP_NET_ADMIN)) return -EPERM;
- IaFrontEndIntr(iadev);
+ ia_frontend_intr(iadev);
break;
case 0xa:
if (!capable(CAP_NET_ADMIN)) return -EPERM;
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h
index 077735e..a4027b3 100644
--- a/drivers/atm/iphase.h
+++ b/drivers/atm/iphase.h
@@ -889,79 +889,71 @@ typedef struct ia_rtn_q {
} IARTN_Q;
#define SUNI_LOSV 0x04
-typedef struct {
- u32 suni_master_reset; /* SUNI Master Reset and Identity */
- u32 suni_master_config; /* SUNI Master Configuration */
- u32 suni_master_intr_stat; /* SUNI Master Interrupt Status */
- u32 suni_reserved1; /* Reserved */
- u32 suni_master_clk_monitor;/* SUNI Master Clock Monitor */
- u32 suni_master_control; /* SUNI Master Clock Monitor */
- u32 suni_reserved2[10]; /* Reserved */
-
- u32 suni_rsop_control; /* RSOP Control/Interrupt Enable */
- u32 suni_rsop_status; /* RSOP Status/Interrupt States */
- u32 suni_rsop_section_bip8l;/* RSOP Section BIP-8 LSB */
- u32 suni_rsop_section_bip8m;/* RSOP Section BIP-8 MSB */
-
- u32 suni_tsop_control; /* TSOP Control */
- u32 suni_tsop_diag; /* TSOP Disgnostics */
- u32 suni_tsop_reserved[2]; /* TSOP Reserved */
-
- u32 suni_rlop_cs; /* RLOP Control/Status */
- u32 suni_rlop_intr; /* RLOP Interrupt Enable/Status */
- u32 suni_rlop_line_bip24l; /* RLOP Line BIP-24 LSB */
- u32 suni_rlop_line_bip24; /* RLOP Line BIP-24 */
- u32 suni_rlop_line_bip24m; /* RLOP Line BIP-24 MSB */
- u32 suni_rlop_line_febel; /* RLOP Line FEBE LSB */
- u32 suni_rlop_line_febe; /* RLOP Line FEBE */
- u32 suni_rlop_line_febem; /* RLOP Line FEBE MSB */
-
- u32 suni_tlop_control; /* TLOP Control */
- u32 suni_tlop_disg; /* TLOP Disgnostics */
- u32 suni_tlop_reserved[14]; /* TLOP Reserved */
-
- u32 suni_rpop_cs; /* RPOP Status/Control */
- u32 suni_rpop_intr; /* RPOP Interrupt/Status */
- u32 suni_rpop_reserved; /* RPOP Reserved */
- u32 suni_rpop_intr_ena; /* RPOP Interrupt Enable */
- u32 suni_rpop_reserved1[3]; /* RPOP Reserved */
- u32 suni_rpop_path_sig; /* RPOP Path Signal Label */
- u32 suni_rpop_bip8l; /* RPOP Path BIP-8 LSB */
- u32 suni_rpop_bip8m; /* RPOP Path BIP-8 MSB */
- u32 suni_rpop_febel; /* RPOP Path FEBE LSB */
- u32 suni_rpop_febem; /* RPOP Path FEBE MSB */
- u32 suni_rpop_reserved2[4]; /* RPOP Reserved */
-
- u32 suni_tpop_cntrl_daig; /* TPOP Control/Disgnostics */
- u32 suni_tpop_pointer_ctrl; /* TPOP Pointer Control */
- u32 suni_tpop_sourcer_ctrl; /* TPOP Source Control */
- u32 suni_tpop_reserved1[2]; /* TPOP Reserved */
- u32 suni_tpop_arb_prtl; /* TPOP Arbitrary Pointer LSB */
- u32 suni_tpop_arb_prtm; /* TPOP Arbitrary Pointer MSB */
- u32 suni_tpop_reserved2; /* TPOP Reserved */
- u32 suni_tpop_path_sig; /* TPOP Path Signal Lable */
- u32 suni_tpop_path_status; /* TPOP Path Status */
- u32 suni_tpop_reserved3[6]; /* TPOP Reserved */
-
- u32 suni_racp_cs; /* RACP Control/Status */
- u32 suni_racp_intr; /* RACP Interrupt Enable/Status */
- u32 suni_racp_hdr_pattern; /* RACP Match Header Pattern */
- u32 suni_racp_hdr_mask; /* RACP Match Header Mask */
- u32 suni_racp_corr_hcs; /* RACP Correctable HCS Error Count */
- u32 suni_racp_uncorr_hcs; /* RACP Uncorrectable HCS Error Count */
- u32 suni_racp_reserved[10]; /* RACP Reserved */
-
- u32 suni_tacp_control; /* TACP Control */
- u32 suni_tacp_idle_hdr_pat; /* TACP Idle Cell Header Pattern */
- u32 suni_tacp_idle_pay_pay; /* TACP Idle Cell Payld Octet Pattern */
- u32 suni_tacp_reserved[5]; /* TACP Reserved */
-
- u32 suni_reserved3[24]; /* Reserved */
-
- u32 suni_master_test; /* SUNI Master Test */
- u32 suni_reserved_test; /* SUNI Reserved for Test */
-} IA_SUNI;
-
+enum ia_suni {
+ SUNI_MASTER_RESET = 0x000, /* SUNI Master Reset and Identity */
+ SUNI_MASTER_CONFIG = 0x004, /* SUNI Master Configuration */
+ SUNI_MASTER_INTR_STAT = 0x008, /* SUNI Master Interrupt Status */
+ SUNI_RESERVED1 = 0x00c, /* Reserved */
+ SUNI_MASTER_CLK_MONITOR = 0x010, /* SUNI Master Clock Monitor */
+ SUNI_MASTER_CONTROL = 0x014, /* SUNI Master Clock Monitor */
+ /* Reserved (10) */
+ SUNI_RSOP_CONTROL = 0x040, /* RSOP Control/Interrupt Enable */
+ SUNI_RSOP_STATUS = 0x044, /* RSOP Status/Interrupt States */
+ SUNI_RSOP_SECTION_BIP8L = 0x048, /* RSOP Section BIP-8 LSB */
+ SUNI_RSOP_SECTION_BIP8M = 0x04c, /* RSOP Section BIP-8 MSB */
+
+ SUNI_TSOP_CONTROL = 0x050, /* TSOP Control */
+ SUNI_TSOP_DIAG = 0x054, /* TSOP Disgnostics */
+ /* Reserved (2) */
+ SUNI_RLOP_CS = 0x060, /* RLOP Control/Status */
+ SUNI_RLOP_INTR = 0x064, /* RLOP Interrupt Enable/Status */
+ SUNI_RLOP_LINE_BIP24L = 0x068, /* RLOP Line BIP-24 LSB */
+ SUNI_RLOP_LINE_BIP24 = 0x06c, /* RLOP Line BIP-24 */
+ SUNI_RLOP_LINE_BIP24M = 0x070, /* RLOP Line BIP-24 MSB */
+ SUNI_RLOP_LINE_FEBEL = 0x074, /* RLOP Line FEBE LSB */
+ SUNI_RLOP_LINE_FEBE = 0x078, /* RLOP Line FEBE */
+ SUNI_RLOP_LINE_FEBEM = 0x07c, /* RLOP Line FEBE MSB */
+
+ SUNI_TLOP_CONTROL = 0x080, /* TLOP Control */
+ SUNI_TLOP_DISG = 0x084, /* TLOP Disgnostics */
+ /* Reserved (14) */
+ SUNI_RPOP_CS = 0x0c0, /* RPOP Status/Control */
+ SUNI_RPOP_INTR = 0x0c4, /* RPOP Interrupt/Status */
+ SUNI_RPOP_RESERVED = 0x0c8, /* RPOP Reserved */
+ SUNI_RPOP_INTR_ENA = 0x0cc, /* RPOP Interrupt Enable */
+ /* Reserved (3) */
+ SUNI_RPOP_PATH_SIG = 0x0dc, /* RPOP Path Signal Label */
+ SUNI_RPOP_BIP8L = 0x0e0, /* RPOP Path BIP-8 LSB */
+ SUNI_RPOP_BIP8M = 0x0e4, /* RPOP Path BIP-8 MSB */
+ SUNI_RPOP_FEBEL = 0x0e8, /* RPOP Path FEBE LSB */
+ SUNI_RPOP_FEBEM = 0x0ec, /* RPOP Path FEBE MSB */
+ /* Reserved (4) */
+ SUNI_TPOP_CNTRL_DAIG = 0x100, /* TPOP Control/Disgnostics */
+ SUNI_TPOP_POINTER_CTRL = 0x104, /* TPOP Pointer Control */
+ SUNI_TPOP_SOURCER_CTRL = 0x108, /* TPOP Source Control */
+ /* Reserved (2) */
+ SUNI_TPOP_ARB_PRTL = 0x114, /* TPOP Arbitrary Pointer LSB */
+ SUNI_TPOP_ARB_PRTM = 0x118, /* TPOP Arbitrary Pointer MSB */
+ SUNI_TPOP_RESERVED2 = 0x11c, /* TPOP Reserved */
+ SUNI_TPOP_PATH_SIG = 0x120, /* TPOP Path Signal Lable */
+ SUNI_TPOP_PATH_STATUS = 0x124, /* TPOP Path Status */
+ /* Reserved (6) */
+ SUNI_RACP_CS = 0x140, /* RACP Control/Status */
+ SUNI_RACP_INTR = 0x144, /* RACP Interrupt Enable/Status */
+ SUNI_RACP_HDR_PATTERN = 0x148, /* RACP Match Header Pattern */
+ SUNI_RACP_HDR_MASK = 0x14c, /* RACP Match Header Mask */
+ SUNI_RACP_CORR_HCS = 0x150, /* RACP Correctable HCS Error Count */
+ SUNI_RACP_UNCORR_HCS = 0x154, /* RACP Uncorrectable HCS Err Count */
+ /* Reserved (10) */
+ SUNI_TACP_CONTROL = 0x180, /* TACP Control */
+ SUNI_TACP_IDLE_HDR_PAT = 0x184, /* TACP Idle Cell Header Pattern */
+ SUNI_TACP_IDLE_PAY_PAY = 0x188, /* TACP Idle Cell Payld Octet Patrn */
+ /* Reserved (5) */
+ /* Reserved (24) */
+ /* FIXME: unused but name conflicts.
+ * SUNI_MASTER_TEST = 0x200, SUNI Master Test */
+ SUNI_RESERVED_TEST = 0x204 /* SUNI Reserved for Test */
+};
typedef struct _SUNI_STATS_
{
@@ -993,13 +985,11 @@ typedef struct _SUNI_STATS_
u32 racp_uchcs_count; // uncorrectable HCS error count
} IA_SUNI_STATS;
-typedef struct iadev_t {
+typedef struct iadev_priv {
/*-----base pointers into (i)chipSAR+ address space */
- u32 __iomem *phy; /* base pointer into phy(SUNI) */
- u32 __iomem *dma; /* base pointer into DMA control
- registers */
- u32 __iomem *reg; /* base pointer to SAR registers
- - Bus Interface Control Regs */
+ u32 __iomem *phy; /* Base pointer into phy (SUNI). */
+ u32 __iomem *dma; /* Base pointer into DMA control registers. */
+ u32 __iomem *reg; /* Base pointer to SAR registers. */
u32 __iomem *seg_reg; /* base pointer to segmentation engine
internal registers */
u32 __iomem *reass_reg; /* base pointer to reassemble engine
@@ -1071,14 +1061,14 @@ typedef struct iadev_t {
#define INPH_IA_VCC(v) ((struct ia_vcc *) (v)->dev_data)
/******************* IDT77105 25MB/s PHY DEFINE *****************************/
-typedef struct {
- u_int mb25_master_ctrl; /* Master control */
- u_int mb25_intr_status; /* Interrupt status */
- u_int mb25_diag_control; /* Diagnostic control */
- u_int mb25_led_hec; /* LED driver and HEC status/control */
- u_int mb25_low_byte_counter; /* Low byte counter */
- u_int mb25_high_byte_counter; /* High byte counter */
-} ia_mb25_t;
+enum ia_mb25 {
+ MB25_MASTER_CTRL = 0x00, /* Master control */
+ MB25_INTR_STATUS = 0x04, /* Interrupt status */
+ MB25_DIAG_CONTROL = 0x08, /* Diagnostic control */
+ MB25_LED_HEC = 0x0c, /* LED driver and HEC status/control */
+ MB25_LOW_BYTE_COUNTER = 0x10,
+ MB25_HIGH_BYTE_COUNTER = 0x14
+};
/*
* Master Control
@@ -1127,122 +1117,121 @@ typedef struct {
#define FE_E3_PHY 0x0090 /* E3 */
/*********************** SUNI_PM7345 PHY DEFINE HERE *********************/
-typedef struct _suni_pm7345_t
-{
- u_int suni_config; /* SUNI Configuration */
- u_int suni_intr_enbl; /* SUNI Interrupt Enable */
- u_int suni_intr_stat; /* SUNI Interrupt Status */
- u_int suni_control; /* SUNI Control */
- u_int suni_id_reset; /* SUNI Reset and Identity */
- u_int suni_data_link_ctrl;
- u_int suni_rboc_conf_intr_enbl;
- u_int suni_rboc_stat;
- u_int suni_ds3_frm_cfg;
- u_int suni_ds3_frm_intr_enbl;
- u_int suni_ds3_frm_intr_stat;
- u_int suni_ds3_frm_stat;
- u_int suni_rfdl_cfg;
- u_int suni_rfdl_enbl_stat;
- u_int suni_rfdl_stat;
- u_int suni_rfdl_data;
- u_int suni_pmon_chng;
- u_int suni_pmon_intr_enbl_stat;
- u_int suni_reserved1[0x13-0x11];
- u_int suni_pmon_lcv_evt_cnt_lsb;
- u_int suni_pmon_lcv_evt_cnt_msb;
- u_int suni_pmon_fbe_evt_cnt_lsb;
- u_int suni_pmon_fbe_evt_cnt_msb;
- u_int suni_pmon_sez_det_cnt_lsb;
- u_int suni_pmon_sez_det_cnt_msb;
- u_int suni_pmon_pe_evt_cnt_lsb;
- u_int suni_pmon_pe_evt_cnt_msb;
- u_int suni_pmon_ppe_evt_cnt_lsb;
- u_int suni_pmon_ppe_evt_cnt_msb;
- u_int suni_pmon_febe_evt_cnt_lsb;
- u_int suni_pmon_febe_evt_cnt_msb;
- u_int suni_ds3_tran_cfg;
- u_int suni_ds3_tran_diag;
- u_int suni_reserved2[0x23-0x21];
- u_int suni_xfdl_cfg;
- u_int suni_xfdl_intr_st;
- u_int suni_xfdl_xmit_data;
- u_int suni_xboc_code;
- u_int suni_splr_cfg;
- u_int suni_splr_intr_en;
- u_int suni_splr_intr_st;
- u_int suni_splr_status;
- u_int suni_splt_cfg;
- u_int suni_splt_cntl;
- u_int suni_splt_diag_g1;
- u_int suni_splt_f1;
- u_int suni_cppm_loc_meters;
- u_int suni_cppm_chng_of_cppm_perf_meter;
- u_int suni_cppm_b1_err_cnt_lsb;
- u_int suni_cppm_b1_err_cnt_msb;
- u_int suni_cppm_framing_err_cnt_lsb;
- u_int suni_cppm_framing_err_cnt_msb;
- u_int suni_cppm_febe_cnt_lsb;
- u_int suni_cppm_febe_cnt_msb;
- u_int suni_cppm_hcs_err_cnt_lsb;
- u_int suni_cppm_hcs_err_cnt_msb;
- u_int suni_cppm_idle_un_cell_cnt_lsb;
- u_int suni_cppm_idle_un_cell_cnt_msb;
- u_int suni_cppm_rcv_cell_cnt_lsb;
- u_int suni_cppm_rcv_cell_cnt_msb;
- u_int suni_cppm_xmit_cell_cnt_lsb;
- u_int suni_cppm_xmit_cell_cnt_msb;
- u_int suni_rxcp_ctrl;
- u_int suni_rxcp_fctrl;
- u_int suni_rxcp_intr_en_sts;
- u_int suni_rxcp_idle_pat_h1;
- u_int suni_rxcp_idle_pat_h2;
- u_int suni_rxcp_idle_pat_h3;
- u_int suni_rxcp_idle_pat_h4;
- u_int suni_rxcp_idle_mask_h1;
- u_int suni_rxcp_idle_mask_h2;
- u_int suni_rxcp_idle_mask_h3;
- u_int suni_rxcp_idle_mask_h4;
- u_int suni_rxcp_cell_pat_h1;
- u_int suni_rxcp_cell_pat_h2;
- u_int suni_rxcp_cell_pat_h3;
- u_int suni_rxcp_cell_pat_h4;
- u_int suni_rxcp_cell_mask_h1;
- u_int suni_rxcp_cell_mask_h2;
- u_int suni_rxcp_cell_mask_h3;
- u_int suni_rxcp_cell_mask_h4;
- u_int suni_rxcp_hcs_cs;
- u_int suni_rxcp_lcd_cnt_threshold;
- u_int suni_reserved3[0x57-0x54];
- u_int suni_txcp_ctrl;
- u_int suni_txcp_intr_en_sts;
- u_int suni_txcp_idle_pat_h1;
- u_int suni_txcp_idle_pat_h2;
- u_int suni_txcp_idle_pat_h3;
- u_int suni_txcp_idle_pat_h4;
- u_int suni_txcp_idle_pat_h5;
- u_int suni_txcp_idle_payload;
- u_int suni_e3_frm_fram_options;
- u_int suni_e3_frm_maint_options;
- u_int suni_e3_frm_fram_intr_enbl;
- u_int suni_e3_frm_fram_intr_ind_stat;
- u_int suni_e3_frm_maint_intr_enbl;
- u_int suni_e3_frm_maint_intr_ind;
- u_int suni_e3_frm_maint_stat;
- u_int suni_reserved4;
- u_int suni_e3_tran_fram_options;
- u_int suni_e3_tran_stat_diag_options;
- u_int suni_e3_tran_bip_8_err_mask;
- u_int suni_e3_tran_maint_adapt_options;
- u_int suni_ttb_ctrl;
- u_int suni_ttb_trail_trace_id_stat;
- u_int suni_ttb_ind_addr;
- u_int suni_ttb_ind_data;
- u_int suni_ttb_exp_payload_type;
- u_int suni_ttb_payload_type_ctrl_stat;
- u_int suni_pad5[0x7f-0x71];
- u_int suni_master_test;
- u_int suni_pad6[0xff-0x80];
-}suni_pm7345_t;
+enum suni_pm7345 {
+ SUNI_CONFIG = 0x000, /* SUNI Configuration */
+ SUNI_INTR_ENBL = 0x004, /* SUNI Interrupt Enable */
+ SUNI_INTR_STAT = 0x008, /* SUNI Interrupt Status */
+ SUNI_CONTROL = 0x00c, /* SUNI Control */
+ SUNI_ID_RESET = 0x010, /* SUNI Reset and Identity */
+ SUNI_DATA_LINK_CTRL = 0x014,
+ SUNI_RBOC_CONF_INTR_ENBL = 0x018,
+ SUNI_RBOC_STAT = 0x01c,
+ SUNI_DS3_FRM_CFG = 0x020,
+ SUNI_DS3_FRM_INTR_ENBL = 0x024,
+ SUNI_DS3_FRM_INTR_STAT = 0x028,
+ SUNI_DS3_FRM_STAT = 0x02c,
+ SUNI_RFDL_CFG = 0x030,
+ SUNI_RFDL_ENBL_STAT = 0x034,
+ SUNI_RFDL_STAT = 0x038,
+ SUNI_RFDL_DATA = 0x03c,
+ SUNI_PMON_CHNG = 0x040,
+ SUNI_PMON_INTR_ENBL_STAT = 0x044,
+ /* SUNI_RESERVED1 (0x13 - 0x11) */
+ SUNI_PMON_LCV_EVT_CNT_LSB = 0x050,
+ SUNI_PMON_LCV_EVT_CNT_MSB = 0x054,
+ SUNI_PMON_FBE_EVT_CNT_LSB = 0x058,
+ SUNI_PMON_FBE_EVT_CNT_MSB = 0x05c,
+ SUNI_PMON_SEZ_DET_CNT_LSB = 0x060,
+ SUNI_PMON_SEZ_DET_CNT_MSB = 0x064,
+ SUNI_PMON_PE_EVT_CNT_LSB = 0x068,
+ SUNI_PMON_PE_EVT_CNT_MSB = 0x06c,
+ SUNI_PMON_PPE_EVT_CNT_LSB = 0x070,
+ SUNI_PMON_PPE_EVT_CNT_MSB = 0x074,
+ SUNI_PMON_FEBE_EVT_CNT_LSB = 0x078,
+ SUNI_PMON_FEBE_EVT_CNT_MSB = 0x07c,
+ SUNI_DS3_TRAN_CFG = 0x080,
+ SUNI_DS3_TRAN_DIAG = 0x084,
+ /* SUNI_RESERVED2 (0x23 - 0x21) */
+ SUNI_XFDL_CFG = 0x090,
+ SUNI_XFDL_INTR_ST = 0x094,
+ SUNI_XFDL_XMIT_DATA = 0x098,
+ SUNI_XBOC_CODE = 0x09c,
+ SUNI_SPLR_CFG = 0x0a0,
+ SUNI_SPLR_INTR_EN = 0x0a4,
+ SUNI_SPLR_INTR_ST = 0x0a8,
+ SUNI_SPLR_STATUS = 0x0ac,
+ SUNI_SPLT_CFG = 0x0b0,
+ SUNI_SPLT_CNTL = 0x0b4,
+ SUNI_SPLT_DIAG_G1 = 0x0b8,
+ SUNI_SPLT_F1 = 0x0bc,
+ SUNI_CPPM_LOC_METERS = 0x0c0,
+ SUNI_CPPM_CHG_OF_CPPM_PERF_METR = 0x0c4,
+ SUNI_CPPM_B1_ERR_CNT_LSB = 0x0c8,
+ SUNI_CPPM_B1_ERR_CNT_MSB = 0x0cc,
+ SUNI_CPPM_FRAMING_ERR_CNT_LSB = 0x0d0,
+ SUNI_CPPM_FRAMING_ERR_CNT_MSB = 0x0d4,
+ SUNI_CPPM_FEBE_CNT_LSB = 0x0d8,
+ SUNI_CPPM_FEBE_CNT_MSB = 0x0dc,
+ SUNI_CPPM_HCS_ERR_CNT_LSB = 0x0e0,
+ SUNI_CPPM_HCS_ERR_CNT_MSB = 0x0e4,
+ SUNI_CPPM_IDLE_UN_CELL_CNT_LSB = 0x0e8,
+ SUNI_CPPM_IDLE_UN_CELL_CNT_MSB = 0x0ec,
+ SUNI_CPPM_RCV_CELL_CNT_LSB = 0x0f0,
+ SUNI_CPPM_RCV_CELL_CNT_MSB = 0x0f4,
+ SUNI_CPPM_XMIT_CELL_CNT_LSB = 0x0f8,
+ SUNI_CPPM_XMIT_CELL_CNT_MSB = 0x0fc,
+ SUNI_RXCP_CTRL = 0x100,
+ SUNI_RXCP_FCTRL = 0x104,
+ SUNI_RXCP_INTR_EN_STS = 0x108,
+ SUNI_RXCP_IDLE_PAT_H1 = 0x10c,
+ SUNI_RXCP_IDLE_PAT_H2 = 0x110,
+ SUNI_RXCP_IDLE_PAT_H3 = 0x114,
+ SUNI_RXCP_IDLE_PAT_H4 = 0x118,
+ SUNI_RXCP_IDLE_MASK_H1 = 0x11c,
+ SUNI_RXCP_IDLE_MASK_H2 = 0x120,
+ SUNI_RXCP_IDLE_MASK_H3 = 0x124,
+ SUNI_RXCP_IDLE_MASK_H4 = 0x128,
+ SUNI_RXCP_CELL_PAT_H1 = 0x12c,
+ SUNI_RXCP_CELL_PAT_H2 = 0x130,
+ SUNI_RXCP_CELL_PAT_H3 = 0x134,
+ SUNI_RXCP_CELL_PAT_H4 = 0x138,
+ SUNI_RXCP_CELL_MASK_H1 = 0x13c,
+ SUNI_RXCP_CELL_MASK_H2 = 0x140,
+ SUNI_RXCP_CELL_MASK_H3 = 0x144,
+ SUNI_RXCP_CELL_MASK_H4 = 0x148,
+ SUNI_RXCP_HCS_CS = 0x14c,
+ SUNI_RXCP_LCD_CNT_THRESHOLD = 0x150,
+ /* SUNI_RESERVED3 (0x57 - 0x54) */
+ SUNI_TXCP_CTRL = 0x160,
+ SUNI_TXCP_INTR_EN_STS = 0x164,
+ SUNI_TXCP_IDLE_PAT_H1 = 0x168,
+ SUNI_TXCP_IDLE_PAT_H2 = 0x16c,
+ SUNI_TXCP_IDLE_PAT_H3 = 0x170,
+ SUNI_TXCP_IDLE_PAT_H4 = 0x174,
+ SUNI_TXCP_IDLE_PAT_H5 = 0x178,
+ SUNI_TXCP_IDLE_PAYLOAD = 0x17c,
+ SUNI_E3_FRM_FRAM_OPTIONS = 0x180,
+ SUNI_E3_FRM_MAINT_OPTIONS = 0x184,
+ SUNI_E3_FRM_FRAM_INTR_ENBL = 0x188,
+ SUNI_E3_FRM_FRAM_INTR_IND_STAT = 0x18c,
+ SUNI_E3_FRM_MAINT_INTR_ENBL = 0x190,
+ SUNI_E3_FRM_MAINT_INTR_IND = 0x194,
+ SUNI_E3_FRM_MAINT_STAT = 0x198,
+ SUNI_RESERVED4 = 0x19c,
+ SUNI_E3_TRAN_FRAM_OPTIONS = 0x1a0,
+ SUNI_E3_TRAN_STAT_DIAG_OPTIONS = 0x1a4,
+ SUNI_E3_TRAN_BIP_8_ERR_MASK = 0x1a8,
+ SUNI_E3_TRAN_MAINT_ADAPT_OPTS = 0x1ac,
+ SUNI_TTB_CTRL = 0x1b0,
+ SUNI_TTB_TRAIL_TRACE_ID_STAT = 0x1b4,
+ SUNI_TTB_IND_ADDR = 0x1b8,
+ SUNI_TTB_IND_DATA = 0x1bc,
+ SUNI_TTB_EXP_PAYLOAD_TYPE = 0x1c0,
+ SUNI_TTB_PAYLOAD_TYPE_CTRL_STAT = 0x1c4,
+ /* SUNI_PAD5 (0x7f - 0x71) */
+ SUNI_MASTER_TEST = 0x200,
+ /* SUNI_PAD6 (0xff - 0x80) */
+};
#define SUNI_PM7345_T suni_pm7345_t
#define SUNI_PM7345 0x20 /* Suni chip type */
--
1.7.4.4
^ permalink raw reply related
* [PATCH rfc 5/5] r8169: provide some firmware information via ethtool.
From: Francois Romieu @ 2011-04-27 20:37 UTC (permalink / raw)
To: netdev
Cc: Ciprian Docan, Fejes József, Borislav Petkov,
Realtek linux nic maintainers, Ben Hutchings
There is no real firmware version yet but the manpage of ethtool
is rather terse about the driver information.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Ciprian Docan <docan@eden.rutgers.edu>
Cc: Fejes József <fejes@joco.name>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 45 +++++++++++++++++++++++++--------------------
1 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 2606a20..76e81ac 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1190,6 +1190,19 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
return 0;
}
+static const char *rtl_lookup_firmware_name(struct rtl8169_private *tp)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(rtl_firmware_infos); i++) {
+ const struct rtl_firmware_info *info = rtl_firmware_infos + i;
+
+ if (info->mac_version == tp->mac_version)
+ return info->fw_name;
+ }
+ return NULL;
+}
+
static void rtl8169_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
@@ -1198,6 +1211,8 @@ static void rtl8169_get_drvinfo(struct net_device *dev,
strcpy(info->driver, MODULENAME);
strcpy(info->version, RTL8169_VERSION);
strcpy(info->bus_info, pci_name(tp->pci_dev));
+ strncpy(info->fw_version, IS_ERR_OR_NULL(tp->fw) ? "N/A" :
+ rtl_lookup_firmware_name(tp), sizeof(info->fw_version));
}
static int rtl8169_get_regs_len(struct net_device *dev)
@@ -3502,33 +3517,23 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
static void rtl_request_firmware(struct rtl8169_private *tp)
{
- int i;
-
/* Return early if the firmware is already loaded / cached. */
- if (!IS_ERR(tp->fw))
- goto out;
-
- for (i = 0; i < ARRAY_SIZE(rtl_firmware_infos); i++) {
- const struct rtl_firmware_info *info = rtl_firmware_infos + i;
+ if (IS_ERR(tp->fw)) {
+ const char *name;
- if (info->mac_version == tp->mac_version) {
- const char *name = info->fw_name;
+ name = rtl_lookup_firmware_name(tp);
+ if (name) {
int rc;
rc = request_firmware(&tp->fw, name, &tp->pci_dev->dev);
- if (rc < 0) {
- netif_warn(tp, ifup, tp->dev, "unable to load "
- "firmware patch %s (%d)\n", name, rc);
- goto out_disable_request_firmware;
- }
- goto out;
+ if (rc >= 0)
+ return;
+
+ netif_warn(tp, ifup, tp->dev, "unable to load "
+ "firmware patch %s (%d)\n", name, rc);
}
+ tp->fw = NULL;
}
-
-out_disable_request_firmware:
- tp->fw = NULL;
-out:
- return;
}
static int rtl8169_open(struct net_device *dev)
--
1.7.4.4
^ permalink raw reply related
* [PATCH rfc 4/5] r8169: remove non-NAPI context invocation of rtl8169_rx_interrupt.
From: Francois Romieu @ 2011-04-27 20:37 UTC (permalink / raw)
To: netdev; +Cc: Realtek linux nic maintainers
Invocation of rtl8169_rx_interrupt from rtl8169_reset_task was originally
intended to retrieve as much packets as possible from the rx ring when a
reset was needed. Nowadays rtl8169_reset_task is only scheduled, with
some delay
a. from the tx timeout watchdog
b. when resuming
c. from rtl8169_rx_interrupt itself (no-brainer).
It's dubious that the loss of outdated packets will matter much for a)
and b).
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 32 +++++++++-----------------------
1 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 9acfd65..2606a20 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -4585,6 +4585,7 @@ static void rtl8169_reset_task(struct work_struct *work)
struct rtl8169_private *tp =
container_of(work, struct rtl8169_private, task.work);
struct net_device *dev = tp->dev;
+ int i;
rtnl_lock();
@@ -4593,19 +4594,15 @@ static void rtl8169_reset_task(struct work_struct *work)
rtl8169_wait_for_quiescence(dev);
- rtl8169_rx_interrupt(dev, tp, tp->mmio_addr, ~(u32)0);
+ for (i = 0; i < NUM_RX_DESC; i++)
+ rtl8169_mark_to_asic(tp->RxDescArray + i, rx_buf_sz);
+
rtl8169_tx_clear(tp);
- if (tp->dirty_rx == tp->cur_rx) {
- rtl8169_init_ring_indexes(tp);
- rtl_hw_start(dev);
- netif_wake_queue(dev);
- rtl8169_check_link_status(dev, tp, tp->mmio_addr);
- } else {
- if (net_ratelimit())
- netif_emerg(tp, intr, dev, "Rx buffers shortage\n");
- rtl8169_schedule_work(dev, rtl8169_reset_task);
- }
+ rtl8169_init_ring_indexes(tp);
+ rtl_hw_start(dev);
+ netif_wake_queue(dev);
+ rtl8169_check_link_status(dev, tp, tp->mmio_addr);
out_unlock:
rtnl_unlock();
@@ -4910,20 +4907,12 @@ static struct sk_buff *rtl8169_try_rx_copy(void *data,
return skb;
}
-/*
- * Warning : rtl8169_rx_interrupt() might be called :
- * 1) from NAPI (softirq) context
- * (polling = 1 : we should call netif_receive_skb())
- * 2) from process context (rtl8169_reset_task())
- * (polling = 0 : we must call netif_rx() instead)
- */
static int rtl8169_rx_interrupt(struct net_device *dev,
struct rtl8169_private *tp,
void __iomem *ioaddr, u32 budget)
{
unsigned int cur_rx, rx_left;
unsigned int count;
- int polling = (budget != ~(u32)0) ? 1 : 0;
cur_rx = tp->cur_rx;
rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx;
@@ -4983,10 +4972,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
rtl8169_rx_vlan_tag(desc, skb);
- if (likely(polling))
- napi_gro_receive(&tp->napi, skb);
- else
- netif_rx(skb);
+ napi_gro_receive(&tp->napi, skb);
dev->stats.rx_bytes += pkt_size;
dev->stats.rx_packets++;
--
1.7.4.4
^ permalink raw reply related
* [PATCH rfc 3/5] r8169: link speed selection timer rework.
From: Francois Romieu @ 2011-04-27 20:37 UTC (permalink / raw)
To: netdev; +Cc: Realtek linux nic maintainers
The implementation was a bit krusty.
The 10s rtl8169_phy_timer timer has been (was ?) required with older
8169 for adequate phy operation when full gigabit is advertised in
autonegotiated mode. The timer does nothing if the link is up.
Otherwise it keeps resetting the phy until things improve.
- the device private data field phy_1000_ctrl_reg was used to
schedule the timer. Avoid it and save a few bytes.
- rtl8169_set_settings
pending timer is disabled before changing the link settings as
rtl8169_phy_timer is not always needed (see the removed test in
rtl8169_phy_timer).
- rtl8169_set_speed
bail out early on failure.
- rtl8169_open
Calling rtl8169_request_timer duplicates
-> rtl8169_init_phy
-> rtl8169_set_speed
-> mod_timer
NB : the latter does not care about RTL_GIGA_MAC_VER_01.
- rtl8169_request_timer : unused yet. Removed.
- rtl8169_delete_timer : useless. Bloat. Removed.
Side effect : the timer may kick in if the TBI is enabled. I do not
know if the TBI has ever been used inr eal life.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 44 +++++++++-----------------------------------
1 files changed, 9 insertions(+), 35 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 006f0df..9acfd65 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -617,7 +617,6 @@ struct rtl8169_private {
u16 intr_event;
u16 napi_event;
u16 intr_mask;
- int phy_1000_ctrl_reg;
struct mdio_ops {
void (*write)(void __iomem *, int, int);
@@ -1289,8 +1288,6 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
bmcr |= BMCR_FULLDPLX;
}
- tp->phy_1000_ctrl_reg = giga_ctrl;
-
rtl_writephy(tp, MII_BMCR, bmcr);
if ((tp->mac_version == RTL_GIGA_MAC_VER_02) ||
@@ -1316,10 +1313,14 @@ static int rtl8169_set_speed(struct net_device *dev,
int ret;
ret = tp->set_speed(dev, autoneg, speed, duplex, advertising);
+ if (ret < 0)
+ goto out;
- if (netif_running(dev) && (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL))
+ if (netif_running(dev) && (autoneg == AUTONEG_ENABLE) &&
+ (advertising & ADVERTISED_1000baseT_Full)) {
mod_timer(&tp->timer, jiffies + RTL8169_PHY_TIMEOUT);
-
+ }
+out:
return ret;
}
@@ -1329,6 +1330,8 @@ static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
unsigned long flags;
int ret;
+ del_timer_sync(&tp->timer);
+
spin_lock_irqsave(&tp->lock, flags);
ret = rtl8169_set_speed(dev,
cmd->autoneg, cmd->speed, cmd->duplex, cmd->advertising);
@@ -2710,9 +2713,6 @@ static void rtl8169_phy_timer(unsigned long __opaque)
assert(tp->mac_version > RTL_GIGA_MAC_VER_01);
- if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL))
- return;
-
spin_lock_irq(&tp->lock);
if (tp->phy_reset_pending(tp)) {
@@ -2737,28 +2737,6 @@ out_unlock:
spin_unlock_irq(&tp->lock);
}
-static inline void rtl8169_delete_timer(struct net_device *dev)
-{
- struct rtl8169_private *tp = netdev_priv(dev);
- struct timer_list *timer = &tp->timer;
-
- if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
- return;
-
- del_timer_sync(timer);
-}
-
-static inline void rtl8169_request_timer(struct net_device *dev)
-{
- struct rtl8169_private *tp = netdev_priv(dev);
- struct timer_list *timer = &tp->timer;
-
- if (tp->mac_version <= RTL_GIGA_MAC_VER_01)
- return;
-
- mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT);
-}
-
#ifdef CONFIG_NET_POLL_CONTROLLER
/*
* Polling 'interrupt' - used by things like netconsole to send skbs
@@ -3405,8 +3383,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
tp->phy_reset_pending = rtl8169_tbi_reset_pending;
tp->link_ok = rtl8169_tbi_link_ok;
tp->do_ioctl = rtl_tbi_ioctl;
-
- tp->phy_1000_ctrl_reg = ADVERTISE_1000FULL; /* Implied by TBI */
} else {
tp->set_speed = rtl8169_set_speed_xmii;
tp->get_settings = rtl8169_gset_xmii;
@@ -3604,8 +3580,6 @@ static int rtl8169_open(struct net_device *dev)
rtl_hw_start(dev);
- rtl8169_request_timer(dev);
-
tp->saved_wolopts = 0;
pm_runtime_put_noidle(&pdev->dev);
@@ -5168,7 +5142,7 @@ static void rtl8169_down(struct net_device *dev)
struct rtl8169_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->mmio_addr;
- rtl8169_delete_timer(dev);
+ del_timer_sync(&tp->timer);
netif_stop_queue(dev);
--
1.7.4.4
^ permalink raw reply related
* [PATCH rfc 2/5] r8169: rtl8169_set_speed_xmii cleanup.
From: Francois Romieu @ 2011-04-27 20:37 UTC (permalink / raw)
To: netdev; +Cc: Realtek linux nic maintainers
- use ADVERTISE_ALL
- shorten chipset version test
No functional change.
Careful readers will notice that the 'supports_gmii' flag is deduced
from the device PCI id. Though less specific than the chipset related
RTL_GIGA_MAC_VER_XY, it is currently good enough to detect a GMII
deprieved 810x.
Some features may push for a device specific configuration (improved
jumbo frame support for instance). 'supports_gmii' will follow this
path if / when the device PCI id stops working.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 0bb0c0d..006f0df 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1242,8 +1242,7 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
int auto_nego;
auto_nego = rtl_readphy(tp, MII_ADVERTISE);
- auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
- ADVERTISE_100HALF | ADVERTISE_100FULL);
+ auto_nego &= ADVERTISE_ALL;
if (adv & ADVERTISED_10baseT_Half)
auto_nego |= ADVERTISE_10HALF;
@@ -1260,16 +1259,7 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF);
/* The 8100e/8101e/8102e do Fast Ethernet only. */
- if ((tp->mac_version != RTL_GIGA_MAC_VER_07) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_08) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_09) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_10) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_13) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_14) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_15) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_16) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_29) &&
- (tp->mac_version != RTL_GIGA_MAC_VER_30)) {
+ if (tp->mii.supports_gmii) {
if (adv & ADVERTISED_1000baseT_Half)
giga_ctrl |= ADVERTISE_1000HALF;
if (adv & ADVERTISED_1000baseT_Full)
--
1.7.4.4
^ permalink raw reply related
* [PATCH rfc 1/5] r8169: style cleanups.
From: Francois Romieu @ 2011-04-27 20:36 UTC (permalink / raw)
To: netdev; +Cc: Realtek linux nic maintainers
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 80 +++++++++++++++++++++++---------------------------
1 files changed, 37 insertions(+), 43 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 025dedd..0bb0c0d 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -346,7 +346,7 @@ enum rtl8168_registers {
#define OCPAR_GPHY_READ_CMD 0x0000f060
RDSAR1 = 0xd0, /* 8168c only. Undocumented on 8168dp */
MISC = 0xf0, /* 8168e only. */
- txpla_rst = (1 << 29)
+#define TXPLA_RST (1 << 29)
};
enum rtl_register_content {
@@ -424,7 +424,7 @@ enum rtl_register_content {
BWF = (1 << 6), /* Accept Broadcast wakeup frame */
MWF = (1 << 5), /* Accept Multicast wakeup frame */
UWF = (1 << 4), /* Accept Unicast wakeup frame */
- spi_en = (1 << 3),
+ Spi_en = (1 << 3),
LanWake = (1 << 1), /* LanWake enable/disable */
PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */
@@ -731,17 +731,19 @@ static void rtl8168_oob_notify(struct rtl8169_private *tp, u8 cmd)
#define OOB_CMD_DRIVER_START 0x05
#define OOB_CMD_DRIVER_STOP 0x06
+static u16 rtl8168_get_ocp_reg(struct rtl8169_private *tp)
+{
+ return (tp->mac_version == RTL_GIGA_MAC_VER_31) ? 0xb8 : 0x10;
+}
+
static void rtl8168_driver_start(struct rtl8169_private *tp)
{
+ u16 reg;
int i;
- u32 reg;
rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START);
- if (tp->mac_version == RTL_GIGA_MAC_VER_31)
- reg = 0xb8;
- else
- reg = 0x10;
+ reg = rtl8168_get_ocp_reg(tp);
for (i = 0; i < 10; i++) {
msleep(10);
@@ -752,15 +754,12 @@ static void rtl8168_driver_start(struct rtl8169_private *tp)
static void rtl8168_driver_stop(struct rtl8169_private *tp)
{
+ u16 reg;
int i;
- u32 reg;
rtl8168_oob_notify(tp, OOB_CMD_DRIVER_STOP);
- if (tp->mac_version == RTL_GIGA_MAC_VER_31)
- reg = 0xb8;
- else
- reg = 0x10;
+ reg = rtl8168_get_ocp_reg(tp);
for (i = 0; i < 10; i++) {
msleep(10);
@@ -771,17 +770,9 @@ static void rtl8168_driver_stop(struct rtl8169_private *tp)
static int r8168dp_check_dash(struct rtl8169_private *tp)
{
- u32 reg;
-
- if (tp->mac_version == RTL_GIGA_MAC_VER_31)
- reg = 0xb8;
- else
- reg = 0x10;
+ u16 reg = rtl8168_get_ocp_reg(tp);
- if (ocp_read(tp, 0xF, reg) & 0x00008000)
- return 1;
- else
- return 0;
+ return (ocp_read(tp, 0x0f, reg) & 0x00008000) ? 1 : 0;
}
static void r8169_mdio_write(void __iomem *ioaddr, int reg_addr, int value)
@@ -2546,7 +2537,7 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
/* For impedance matching */
rtl_writephy(tp, 0x1f, 0x0002);
rtl_w1w0_phy(tp, 0x08, 0x8000, 0x7f00);
- rtl_writephy(tp, 0x1F, 0x0000);
+ rtl_writephy(tp, 0x1f, 0x0000);
/* PHY auto speed down */
rtl_writephy(tp, 0x1f, 0x0007);
@@ -2704,6 +2695,9 @@ static void rtl_hw_phy_config(struct net_device *dev)
case RTL_GIGA_MAC_VER_30:
rtl8105e_hw_phy_config(tp);
break;
+ case RTL_GIGA_MAC_VER_31:
+ /* None. */
+ break;
case RTL_GIGA_MAC_VER_32:
rtl8168e_1_hw_phy_config(tp);
break;
@@ -3134,8 +3128,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
return;
}
- if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
- tp->mac_version == RTL_GIGA_MAC_VER_33)
+ if ((tp->mac_version == RTL_GIGA_MAC_VER_32) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_33))
rtl_ephy_write(ioaddr, 0x19, 0xff64);
if (__rtl8169_get_wol(tp) & WAKE_ANY) {
@@ -3652,12 +3646,11 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
/* Disable interrupts */
rtl8169_irq_mask_and_ack(ioaddr);
- if (tp->mac_version == RTL_GIGA_MAC_VER_27 ||
- tp->mac_version == RTL_GIGA_MAC_VER_28 ||
- tp->mac_version == RTL_GIGA_MAC_VER_31) {
+ if ((tp->mac_version == RTL_GIGA_MAC_VER_27) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_28) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_31)) {
while (RTL_R8(TxPoll) & NPQ)
udelay(20);
-
}
/* Reset the chipset */
@@ -4117,10 +4110,10 @@ static void rtl_hw_start_8168e(void __iomem *ioaddr, struct pci_dev *pdev)
rtl_disable_clock_request(pdev);
/* Reset tx FIFO pointer */
- RTL_W32(MISC, RTL_R32(MISC) | txpla_rst);
- RTL_W32(MISC, RTL_R32(MISC) & ~txpla_rst);
+ RTL_W32(MISC, RTL_R32(MISC) | TXPLA_RST);
+ RTL_W32(MISC, RTL_R32(MISC) & ~TXPLA_RST);
- RTL_W8(Config5, RTL_R8(Config5) & ~spi_en);
+ RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en);
}
static void rtl_hw_start_8168(struct net_device *dev)
@@ -4142,8 +4135,8 @@ static void rtl_hw_start_8168(struct net_device *dev)
RTL_W16(IntrMitigate, 0x5151);
/* Work around for RxFIFO overflow. */
- if (tp->mac_version == RTL_GIGA_MAC_VER_11 ||
- tp->mac_version == RTL_GIGA_MAC_VER_22) {
+ if ((tp->mac_version == RTL_GIGA_MAC_VER_11) ||
+ (tp->mac_version == RTL_GIGA_MAC_VER_22)) {
tp->intr_event |= RxFIFOOver | PCSTimeout;
tp->intr_event &= ~RxOverflow;
}
@@ -4204,6 +4197,7 @@ static void rtl_hw_start_8168(struct net_device *dev)
case RTL_GIGA_MAC_VER_28:
rtl_hw_start_8168d_4(ioaddr, pdev);
break;
+
case RTL_GIGA_MAC_VER_31:
rtl_hw_start_8168dp(ioaddr, pdev);
break;
@@ -5414,15 +5408,15 @@ static int rtl8169_runtime_idle(struct device *device)
}
static const struct dev_pm_ops rtl8169_pm_ops = {
- .suspend = rtl8169_suspend,
- .resume = rtl8169_resume,
- .freeze = rtl8169_suspend,
- .thaw = rtl8169_resume,
- .poweroff = rtl8169_suspend,
- .restore = rtl8169_resume,
- .runtime_suspend = rtl8169_runtime_suspend,
- .runtime_resume = rtl8169_runtime_resume,
- .runtime_idle = rtl8169_runtime_idle,
+ .suspend = rtl8169_suspend,
+ .resume = rtl8169_resume,
+ .freeze = rtl8169_suspend,
+ .thaw = rtl8169_resume,
+ .poweroff = rtl8169_suspend,
+ .restore = rtl8169_resume,
+ .runtime_suspend = rtl8169_runtime_suspend,
+ .runtime_resume = rtl8169_runtime_resume,
+ .runtime_idle = rtl8169_runtime_idle,
};
#define RTL8169_PM_OPS (&rtl8169_pm_ops)
--
1.7.4.4
^ permalink raw reply related
* Re: r8169 : always copying the rx buffer to new skb
From: Francois Romieu @ 2011-04-27 20:35 UTC (permalink / raw)
To: John Lumby; +Cc: netdev, Ben Hutchings, nic_swsd
In-Reply-To: <4DB77D03.9070507@hotmail.com>
John Lumby <johnlumby@hotmail.com> :
> Anyone have any further thoughts on the proposal to avoid
> memcpy'ing? (see earlier post)
The patch mixes different changes. Please avoid it.
Your MUA damaged the patch. Documentation/SubmittingPatches
could help if you have not read it yet.
The patch makes some gratuitous changes which needlessly
increase the differences (dirty_xy rename for instance).
A set_ringparam() method which does nothing until open()
is used does not exactly ring like "least surprize behavior"
to me.
The behavior under memory pressure is still unknown.
I am mildly convinced by the implementation.
--
Ueimor
^ permalink raw reply
* Re: rtl8169 related kernel splat in 2.6.38.4
From: Francois Romieu @ 2011-04-27 20:34 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
In-Reply-To: <4DB7413A.1020208@candelatech.com>
Ben Greear <greearb@candelatech.com> :
[...]
> WARNING: at /home/greearb/git/linux-2.6.dev.38.y/kernel/timer.c:983 del_timer_sync+0x25/0x37()
[...]
> [<c043094b>] ? warn_slowpath_common+0x65/0x7a
> [<c04398a0>] ? del_timer_sync+0x25/0x37
> [<c043096f>] ? warn_slowpath_null+0xf/0x13
> [<c04398a0>] ? del_timer_sync+0x25/0x37
> [<c06e94f3>] ? linkwatch_schedule_work+0x68/0x83
> [<c06e95b6>] ? linkwatch_fire_event+0xa8/0xad
> [<c06ef193>] ? netif_carrier_on+0x23/0x34
> [<f8af1b32>] ? __rtl8169_check_link_status+0x4f/0xaf [r8169]
linkwatch_schedule_work
-> cancel_delayed_work
-> del_timer_sync
-> *466bd3030973910118ca601da8072be97a1e2209 was here*
At first sight it should happen in -git too. I'll search a fix
back home.
--
Ueimor
^ permalink raw reply
* [PATCH net-next] r8169: fix merge conflict fix.
From: Francois Romieu @ 2011-04-27 20:36 UTC (permalink / raw)
To: David Miller
Cc: sfr, netdev, linux-next, linux-kernel,
Realtek linux nic maintainers
- use adequate MAC_VER id
(see 01dc7fec4025f6bb72b6b98ec88b375346b6dbbb)
- remove duplicate rtl_firmware_info record
- remove duplicate functions
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
---
drivers/net/r8169.c | 25 +++++--------------------
1 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 025dedd..6364e0b 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -191,9 +191,8 @@ static const struct rtl_firmware_info {
{ .mac_version = RTL_GIGA_MAC_VER_26, .fw_name = FIRMWARE_8168D_2 },
{ .mac_version = RTL_GIGA_MAC_VER_29, .fw_name = FIRMWARE_8105E_1 },
{ .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 },
- { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 },
- { .mac_version = RTL_GIGA_MAC_VER_31, .fw_name = FIRMWARE_8168E_1 },
- { .mac_version = RTL_GIGA_MAC_VER_32, .fw_name = FIRMWARE_8168E_2 }
+ { .mac_version = RTL_GIGA_MAC_VER_32, .fw_name = FIRMWARE_8168E_1 },
+ { .mac_version = RTL_GIGA_MAC_VER_33, .fw_name = FIRMWARE_8168E_2 }
};
enum cfg_version {
@@ -2535,6 +2534,8 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
{ 0x1f, 0x0000 }
};
+ rtl_apply_firmware(tp);
+
rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
/* DCO enable for 10M IDLE Power */
@@ -2576,20 +2577,6 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x0d, 0x0000);
}
-static void rtl8168e_1_hw_phy_config(struct rtl8169_private *tp)
-{
- rtl_apply_firmware(tp);
-
- rtl8168e_hw_phy_config(tp);
-}
-
-static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
-{
- rtl_apply_firmware(tp);
-
- rtl8168e_hw_phy_config(tp);
-}
-
static void rtl8102e_hw_phy_config(struct rtl8169_private *tp)
{
static const struct phy_reg phy_reg_init[] = {
@@ -2705,10 +2692,8 @@ static void rtl_hw_phy_config(struct net_device *dev)
rtl8105e_hw_phy_config(tp);
break;
case RTL_GIGA_MAC_VER_32:
- rtl8168e_1_hw_phy_config(tp);
- break;
case RTL_GIGA_MAC_VER_33:
- rtl8168e_2_hw_phy_config(tp);
+ rtl8168e_hw_phy_config(tp);
break;
default:
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH net-next-2.6 0/5 v2] SCTP updates for net-next-2.6
From: David Miller @ 2011-04-27 20:20 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
In-Reply-To: <4DB7C73D.3000406@cn.fujitsu.com>
From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Wed, 27 Apr 2011 15:35:25 +0800
> Hi David
>
> Here is a set of SCTP patches for net-next-2.6, the last part
> from vlad's lksctp-dev tree, update SCTP IPv6 routing and IPSec
> issues. Please apply.
>
> Changelog:
> - redo the intermediate builds test and function test.
> - remove useless ->dst_saddr member of sctp_pf
> - merge some fix for original patch
Applied, thanks!
^ permalink raw reply
* Re: Linux TCP's Robustness to Multipath Packet Reordering
From: Dominik Kaspar @ 2011-04-27 19:56 UTC (permalink / raw)
To: Yuchung Cheng
Cc: Carsten Wolff, John Heffner, Eric Dumazet, netdev,
Zimmermann Alexander, Lennart Schulte, Arnd Hannemann
In-Reply-To: <BANLkTi=i5ZftuL++ORuy=n_yM_futWYoZw@mail.gmail.com>
Hi Yuchung,
Yes, FACK was enabled (as it is by default), but as Alexander already
pointed out, it should be disabled automatically when TCP detects
reordering.
However, I am not so sure how well this automatic turning off FACK is
done by Linux... I see a tendency that in situations with persistent
packet reordering, TCP with FACK enabled gets a lower performance than
if FACK is disabled right from the beginning of a connection.
Greetings,
Dominik
On Wed, Apr 27, 2011 at 7:39 PM, Yuchung Cheng <ycheng@google.com> wrote:
> Hi Dominik,
>
> On Wed, Apr 27, 2011 at 9:22 AM, Dominik Kaspar <dokaspar.ietf@gmail.com> wrote:
>>
>> Hi Carsten,
>>
>> Thanks for your feedback. I made some new tests with the same setup of
>> packet-based forwarding over two emulated paths (600 KB/s, 10 ms) +
>> (400 KB/s, 100 ms). In the first experiments, which showed a step-wise
>> adaptation to reordering, SACK, DSACK, and Timestamps were all
>> enabled. In the experiments, I individually disabled these three
>> mechanisms and saw the following:
>>
>> - Disabling timestamps causes TCP to never adjust to reordering at all.
>> - Disabling SACK allows TCP to adapt very rapidly ("perfect" aggregation!).
>
> Did you enable tcp_fack when sack is enabled? this may make a (big)
> difference. FACK assumes little network reordering and mark packet
> losses more aggressively.
>
>> - Disabling DSACK has no obvious impact (still a step-wise throughput).
>>
>> Is there an explanation for why turning off SACK can be beneficial in
>> the presence of packet reordering? That sounds pretty
>> counter-intuitive to me... I thought SACK=1 always performs better
>> than SACK=0. The results are also illustrated in the following plot.
>> For each setting, there are three runs, which all exhibit a similar
>> behavior:
>>
>> http://home.simula.no/~kaspar/static/mptcp-emu-wlan-hspa-02-sack.png
>>
>> Greetings,
>> Dominik
>>
>> On Wed, Apr 27, 2011 at 11:57 AM, Carsten Wolff <carsten@wolffcarsten.de> wrote:
>> > Hi all,
>> >
>> > On Tuesday 26 April 2011, John Heffner wrote:
>> >> First, TCP is definitely not designed to work under such conditions.
>> >> For example, assumptions behind RTO calculation and fast retransmit
>> >> heuristics are violated. However, in this particular case my first
>> >> guess is that you are being limited by "cwnd moderation," which was
>> >> the topic of recent discussion here. Under persistent reordering,
>> >> cwnd moderation can inhibit the ability of cwnd to grow.
>> >
>> > it's not just cwnd moderation (of which I'm still in favor, even though I lost
>> > the argument by inactivity ;-)).
>> >
>> > Anyway, there are a lot of things in reordering handling that can be improved.
>> > Our group (Alexander, Lennart, Arnd, myself and others) has worked on the
>> > problem for a long time now. This work resulted in an algorithm that is in
>> > large parts TCP-NCR (RFC4653), but also utilizes information gathered by
>> > reordering detection for determination of a good DupThresh, fixes a few
>> > problems in RFC4653 and improves on the reordering detection in Linux when the
>> > connection has no timestamps option. We implemented "pure" TCP-NCR and our own
>> > variant in Linux using a modular framework similar to the congestion control
>> > modules. A lot of measurements and evaluation have gone into the comparison of
>> > the three algorithms. We are now very close(TM) to a final patch, that is more
>> > suited for publication on this list and integrates our algorithm into tcp*.
>> > [hc] without introducing the overhead of that modular framework.
>> >
>> > Greetings,
>> > Carsten
>> >
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH] usbnet: add support for some Huawei modems with cdc-ether ports
From: Dan Williams @ 2011-04-27 19:54 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Oliver Neukum, linux-usb-u79uwXL29TY76Z2rM5mHXA
Some newer Huawei devices (T-Mobile Rocket, others) have cdc-ether
compatible ports, so recognize and expose them.
Signed-off-by: Dan Williams <dcbw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
--- a/drivers/net/usb/cdc_ether.c 2011-04-25 13:49:56.928255316 -0500
+++ b/drivers/net/usb/cdc_ether.c 2011-04-25 13:50:05.487148317 -0500
@@ -458,7 +458,7 @@
.manage_power = cdc_manage_power,
};
-static const struct driver_info mbm_info = {
+static const struct driver_info wwan_info = {
.description = "Mobile Broadband Network Device",
.flags = FLAG_WWAN,
.bind = cdc_bind,
@@ -469,6 +469,7 @@
/*-------------------------------------------------------------------------*/
+#define HUAWEI_VENDOR_ID 0x12D1
static const struct usb_device_id products [] = {
/*
@@ -578,8 +579,17 @@
}, {
USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
USB_CDC_PROTO_NONE),
- .driver_info = (unsigned long)&mbm_info,
+ .driver_info = (unsigned long)&wwan_info,
+}, {
+ /* Various Huawei modems with a network port like the UMG1831 */
+ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = HUAWEI_VENDOR_ID,
+ .bInterfaceClass = USB_CLASS_COMM,
+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
+ .bInterfaceProtocol = 255,
+ .driver_info = (unsigned long)&wwan_info,
},
{ }, // END
};
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCHv2 4/4] ethtool: cosmetic: Use ethtool ethtool_cmd_speed API
From: Ben Hutchings @ 2011-04-27 19:43 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-5-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This updates the network drivers so that they don't access the
> ethtool_cmd::speed field directly, but use ethtoo_cmd_speed() instead.
>
> For most of the drivers, these changes are purely cosmetic and don't
> fix any problem, such as for those 1GbE/10GbE drivers that indirectly
> call their own ethtool get_settings()/mii_ethtool_gset(). The changes
> are meant to enforce code consistency and provide robustness with
> future larger throughputs, at the expense of a few CPU cycles for each
> ethtool operation.
>
> All the drivers compiled with make allyesconfig ion x86_64 have been
> updated.
>
> Tested: make allyesconfig on x86_64 + e1000e/bnx2x work
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> --- a/drivers/net/mdio.c
> +++ b/drivers/net/mdio.c
> @@ -290,33 +290,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
> if (modes & (ADVERTISED_10000baseT_Full |
> ADVERTISED_10000baseKX4_Full |
> ADVERTISED_10000baseKR_Full)) {
> - ecmd->speed = SPEED_10000;
> + ethtool_cmd_speed_set(ecmd, SPEED_10000);
> ecmd->duplex = DUPLEX_FULL;
> } else if (modes & (ADVERTISED_1000baseT_Full |
> ADVERTISED_1000baseT_Half |
> ADVERTISED_1000baseKX_Full)) {
> - ecmd->speed = SPEED_1000;
> + ethtool_cmd_speed_set(ecmd, SPEED_1000);
> ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half);
> } else if (modes & (ADVERTISED_100baseT_Full |
> ADVERTISED_100baseT_Half)) {
> - ecmd->speed = SPEED_100;
> + ethtool_cmd_speed_set(ecmd, SPEED_100);
> ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full);
> } else {
> - ecmd->speed = SPEED_10;
> + ethtool_cmd_speed_set(ecmd, SPEED_10);
> ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full);
> }
> } else {
> /* Report forced settings */
> + u32 speed;
> reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
> MDIO_CTRL1);
> - ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) *
> - ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
> + speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1)
> + * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10));
> ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX ||
> - ecmd->speed == SPEED_10000);
> + speed == SPEED_10000);
> + ethtool_cmd_speed_set(ecmd, speed);
> }
>
> /* 10GBASE-T MDI/MDI-X */
> - if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) {
> + if (ecmd->port == PORT_TP
> + && (ethtool_cmd_speed(ecmd) == SPEED_10000)) {
> switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
> MDIO_PMA_10GBT_SWAPPOL)) {
> case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX:
It seems like the scope of speed should be the whole function. Then you
could just have one call to ethtool_cmd_speed_set() after the
'if (ecmd->autoneg) ... else ...' statement, and no need to use
ethtool_cmd_speed().
[...]
> --- a/drivers/net/tulip/de2104x.c
> +++ b/drivers/net/tulip/de2104x.c
> @@ -1518,15 +1518,15 @@ static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd)
> switch (de->media_type) {
> case DE_MEDIA_AUI:
> ecmd->port = PORT_AUI;
> - ecmd->speed = 5;
> + ethtool_cmd_speed_set(ecmd, 5);
> break;
> case DE_MEDIA_BNC:
> ecmd->port = PORT_BNC;
> - ecmd->speed = 2;
> + ethtool_cmd_speed_set(ecmd, 2);
> break;
> default:
> ecmd->port = PORT_TP;
> - ecmd->speed = SPEED_10;
> + ethtool_cmd_speed_set(ecmd, SPEED_10);
> break;
> }
[...]
As I commented on the previous patch, this should always report a speed
of 10.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCHv2 3/4] ethtool: Use the full 32 bit speed range in ethtool's set_settings
From: Ben Hutchings @ 2011-04-27 19:27 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-4-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This makes sure the ethtool's set_settings() callback of network
> drivers don't ignore the 16 most significant bits when ethtool calls
> their set_settings().
>
> All the driver compiled with make allyesconfig on x86_64 have been
> updated.
>
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> --- a/drivers/net/cxgb4/cxgb4_main.c
> +++ b/drivers/net/cxgb4/cxgb4_main.c
> @@ -1460,6 +1460,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> unsigned int cap;
> struct port_info *p = netdev_priv(dev);
> struct link_config *lc = &p->link_cfg;
> + u32 speed = ethtool_cmd_speed(cmd);
>
> if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */
> return -EINVAL;
> @@ -1470,16 +1471,16 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> * being requested.
> */
> if (cmd->autoneg == AUTONEG_DISABLE &&
> - (lc->supported & speed_to_caps(cmd->speed)))
> - return 0;
> + (lc->supported & speed_to_caps(speed)))
> + return 0;
> return -EINVAL;
> }
>
> if (cmd->autoneg == AUTONEG_DISABLE) {
> - cap = speed_to_caps(cmd->speed);
> + cap = speed_to_caps(speed);
>
> - if (!(lc->supported & cap) || cmd->speed == SPEED_1000 ||
> - cmd->speed == SPEED_10000)
> + if (!(lc->supported & cap) || (speed == SPEED_1000) ||
> + (ethtool_cmd_speed(cmd) == SPEED_10000))
This second call to ethtool_cmd_speed() is unnecessary.
[...]
> diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
> index c05db60..ed3cb6a 100644
> --- a/drivers/net/dl2k.c
> +++ b/drivers/net/dl2k.c
> @@ -1219,31 +1219,26 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> } else {
> np->an_enable = 0;
> if (np->speed == 1000) {
> - cmd->speed = SPEED_100;
> + ethtool_cmd_speed_set(cmd, SPEED_100);
> cmd->duplex = DUPLEX_FULL;
> printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
Ugh, this is totally bogus. You don't have to fix it but it should
really be removed.
> }
> - switch(cmd->speed + cmd->duplex) {
> + switch (ethtool_cmd_speed(cmd)) {
>
> - case SPEED_10 + DUPLEX_HALF:
> + case SPEED_10:
> np->speed = 10;
> - np->full_duplex = 0;
> + np->full_duplex = (cmd->duplex == DUPLEX_FULL) ? 1 : 0;
The '==' operator already yields 1 or 0, so don't use ?: as well.
> break;
>
> - case SPEED_10 + DUPLEX_FULL:
> - np->speed = 10;
> - np->full_duplex = 1;
> - break;
> - case SPEED_100 + DUPLEX_HALF:
> + case SPEED_100:
> np->speed = 100;
> - np->full_duplex = 0;
> + np->full_duplex = (cmd->duplex == DUPLEX_FULL) ? 1 : 0;
> break;
> - case SPEED_100 + DUPLEX_FULL:
> - np->speed = 100;
> - np->full_duplex = 1;
> +
> + case SPEED_1000:
> + /* handled above */
No it isn't; you're confusing cmd->speed and np-speed. This should fall
through to the default case (or simply be removed).
[...]
> diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
> index 2c37a38..66037b1 100644
> --- a/drivers/net/ksz884x.c
> +++ b/drivers/net/ksz884x.c
> @@ -5998,6 +5998,7 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> struct dev_priv *priv = netdev_priv(dev);
> struct dev_info *hw_priv = priv->adapter;
> struct ksz_port *port = &priv->port;
> + u32 speed = ethtool_cmd_speed(cmd);
> int rc;
>
> /*
> @@ -6006,11 +6007,11 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> */
> if (cmd->autoneg && priv->advertising == cmd->advertising) {
> cmd->advertising |= ADVERTISED_ALL;
> - if (10 == cmd->speed)
> + if (SPEED_10 == speed)
> cmd->advertising &=
> ~(ADVERTISED_100baseT_Full |
> ADVERTISED_100baseT_Half);
> - else if (100 == cmd->speed)
> + else if (SPEED_100 == speed)
> cmd->advertising &=
> ~(ADVERTISED_10baseT_Full |
> ADVERTISED_10baseT_Half);
> @@ -6032,8 +6033,8 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> port->force_link = 0;
> } else {
> port->duplex = cmd->duplex + 1;
> - if (cmd->speed != 1000)
> - port->speed = cmd->speed;
> + if (speed != SPEED_1000)
> + port->speed = speed;
> if (cmd->autoneg)
> port->force_link = 0;
> else
There's no good reason for the SPEED macros, so please don't add uses.
[...]
> diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
> index c35d105..98587dc 100644
> --- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
> +++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
> @@ -109,12 +109,13 @@ static int pch_gbe_set_settings(struct net_device *netdev,
> {
> struct pch_gbe_adapter *adapter = netdev_priv(netdev);
> struct pch_gbe_hw *hw = &adapter->hw;
> + u32 speed = ethtool_cmd_speed(ecmd);
> int ret;
>
> pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET);
>
> - if (ecmd->speed == USHRT_MAX) {
> - ecmd->speed = SPEED_1000;
> + if (speed == USHRT_MAX) {
When the link is down, the driver reports speed = -1 (which is dumb, but
sadly common practice). If the user changes some other setting but not
speed, then the driver will see speed == USHRT_MAX here, and this is
meant to allow for that.
This is fine so far, but your next change is going to break this because
the driver will set the high 16 bits of speed and then it will see speed
== UINT_MAX here.
[...]
> diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
> index b13c6b0..f8d26bf 100644
> --- a/drivers/net/tulip/de2104x.c
> +++ b/drivers/net/tulip/de2104x.c
> @@ -1549,10 +1549,11 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd)
> {
> u32 new_media;
> unsigned int media_lock;
> + u32 speed = ethtool_cmd_speed(ecmd);
>
> - if (ecmd->speed != SPEED_10 && ecmd->speed != 5 && ecmd->speed != 2)
> + if (speed != SPEED_10 && speed != 5 && speed != 2)
> return -EINVAL;
> - if (de->de21040 && ecmd->speed == 2)
> + if (de->de21040 && speed == 2)
> return -EINVAL;
> if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
> return -EINVAL;
[...]
This implementation is absolute crap - it's using speed values as
mnemonics for different physical ports! Please change it to report and
accept only speed = 10. (Both get_settings and set_settings have to be
changed at the same time.)
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [net-next-2.6 00/12][pull request] Intel Wired LAN Driver Update
From: David Miller @ 2011-04-27 19:13 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips
In-Reply-To: <1303896891-16006-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 27 Apr 2011 02:34:39 -0700
> The following series contains updates to e1000e and ixgbe.
>
> - e1000e: convert to new set_phys_id interface
>
> - ixgbe: several cleanups and fixes, as well as the conversion
> to the new set_phys_id interface and driver version bump.
>
> The following are changes since commit 2bd93d7af1581d40e3c4b25242472661cb7c637a:
> Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
> and are available in the git repository at:
> master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6 master
Pulled, thanks Jeff.
^ permalink raw reply
* Re: [PATCHv2 2/4] ethtool: Call ethtool's get/set_settings callbacks with cleaned data
From: Ben Hutchings @ 2011-04-27 18:53 UTC (permalink / raw)
To: David Decotigny
Cc: David S. Miller, mirq-linux, Stanislaw Gruszka, Alexander Duyck,
Eilon Greenstein, linux-kernel, netdev
In-Reply-To: <1303929290-21037-3-git-send-email-decot@google.com>
On Wed, 2011-04-27 at 11:34 -0700, David Decotigny wrote:
> This makes sure that when a driver calls the ethtool's
> get/set_settings() callback of another driver, the data passed to it
> is clean. This guarantees that speed_hi will be zeroed correctly if
> the called callback doesn't explicitely set it: we are sure we don't
> get a corrupted speed from the underlying driver. We also take care of
> setting the cmd field appropriately (ETHTOOL_GSET/SSET).
>
> This applies to dev_ethtool_get_settings(), which now makes sure it
> sets up that ethtool command parameter correctly before passing it to
> drivers. This also means that whoever calls dev_ethtool_get_settings()
> does not have to clean the ethtool command parameter. This function
> also becomes an exported symbol instead of an inline.
>
> All drivers visible to make allyesconfig under x86_64 have been
> updated.
>
> Signed-off-by: David Decotigny <decot@google.com>
[...]
> diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
> index e85bf04..2e717a2 100644
> --- a/drivers/net/mdio.c
> +++ b/drivers/net/mdio.c
> @@ -176,6 +176,9 @@ static u32 mdio45_get_an(const struct mdio_if_info *mdio, u16 addr)
> * @npage_adv: Modes currently advertised on next pages
> * @npage_lpa: Modes advertised by link partner on next pages
> *
> + * The @ecmd parameter is expected to have been cleared before calling
> + * mii_ethtool_gset().
Copy-pasta: should say mdio45_get_an() not mii_ethtool_gset().
[...]
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 3bbb4c2..36e57fb 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4496,6 +4496,30 @@ void dev_set_rx_mode(struct net_device *dev)
> }
>
> /**
> + * dev_ethtool_get_settings - call device's ethtool::get_settings()
> + * @dev: device
> + * @cmd: memory area for ethtool_cmd::get_settings() result
> + *
> + * The cmd arg is initialized properly (cleared and
> + * ethtoo_cmd::cmd field set to ETHTOOL_GSET).
Typo: 'ethtoo_cmd' should be 'ethtool_cmd'.
> + * Return device's ethtool_cmd::get_settings() result value or
> + * -EOPNOTSUPP when device doesn't expose
> + * ethtool_cmd::get_settings() operation.
[...]
The operation is ethtool_ops::get_settings, not ethtool::get_settings or
ethtool_cmd::get_settings.
Other than that, this looks fine.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox