* Re: [PATCH] Remove write-only variable from pktgen_thread
From: sukadev @ 2007-08-29 21:33 UTC (permalink / raw)
To: Pavel Emelyanov
Cc: Andrew Morton, Oleg Nesterov, Linux Containers,
Linux Kernel Mailing List, Linux Netdev List
In-Reply-To: <46D572FA.9090302@openvz.org>
Pavel Emelianov [xemul@openvz.org] wrote:
| The pktgen_thread.pid is set to current->pid and is never used
| after this. So remove this at all.
|
| Found during isolating the explicit pid/tgid usage.
|
| Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Good observation that its not being used :-)
Acked-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
|
| ---
|
| diff --git a/net/core/pktgen.c b/net/core/pktgen.c
| index 3a3154e..93695c2 100644
| --- a/net/core/pktgen.c
| +++ b/net/core/pktgen.c
| @@ -380,7 +380,6 @@ struct pktgen_thread {
| /* Field for thread to receive "posted" events terminate, stop ifs
| etc. */
|
| u32 control;
| - int pid;
| int cpu;
|
| wait_queue_head_t queue;
| @@ -3462,8 +3461,6 @@ static int pktgen_thread_worker(void *ar
|
| init_waitqueue_head(&t->queue);
|
| - t->pid = current->pid;
| -
| pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu,
| task_pid_nr(current));
|
| max_before_softirq = t->max_before_softirq;
^ permalink raw reply
* Re: [PATCH] make _minimum_ TCP retransmission timeout configurable
From: Ian McDonald @ 2007-08-29 21:32 UTC (permalink / raw)
To: Rick Jones; +Cc: netdev
In-Reply-To: <200708292052.NAA21975@tardy.cup.hp.com>
On 8/30/07, Rick Jones <rick.jones2@hp.com> wrote:
> Enable configuration of the minimum TCP Retransmission Timeout via
> a new sysctl "tcp_rto_min" to help those who's networks (eg cellular)
> have quite variable RTTs avoid spurrious RTOs.
>
> Signed-off-by: Rick Jones <rick.jones2@hp.com>
> Signed-off-by: Lamont Jones <lamont@hp.com>
> ---
>
> diff -r 1559df81a153 Documentation/networking/ip-sysctl.txt
> --- a/Documentation/networking/ip-sysctl.txt Mon Aug 13 05:00:33 2007 +0000
> +++ b/Documentation/networking/ip-sysctl.txt Wed Aug 22 10:42:55 2007 -0700
> @@ -339,6 +339,13 @@ tcp_rmem - vector of 3 INTEGERs: min, de
> selected receiver buffers for TCP socket. This value does not override
> net.core.rmem_max, "static" selection via SO_RCVBUF does not use this.
> Default: 87380*2 bytes.
> +
> +tcp_rto_min - INTEGER
> + The minimum value for the TCP Retransmission Timeout, expressed
> + in milliseconds for the convenience of the user.
> + This is bounded at the low-end by TCP_RTO_MIN and by TCP_RTO_MAX at
> + the high-end.
> + Default: 200.
>
Hmmm... RFC2988 says:
(2.4) Whenever RTO is computed, if it is less than 1 second then the
RTO SHOULD be rounded up to 1 second.
Traditionally, TCP implementations use coarse grain clocks to
measure the RTT and trigger the RTO, which imposes a large
minimum value on the RTO. Research suggests that a large
minimum RTO is needed to keep TCP conservative and avoid
spurious retransmissions [AP99]. Therefore, this
specification requires a large minimum RTO as a conservative
approach, while at the same time acknowledging that at some
future point, research may show that a smaller minimum RTO is
acceptable or superior.
I went and had a look and this RFC has not been obsoleted. RFC3390
also backs this assertion up.
So I'm suspecting that the default should be changed to 1000 to match
the RFC which would solve this issue. I note that the RFC is a SHOULD
rather than a MUST. I had a quick look around and not sure why Linux
overrides the RFC on this one.
Ian
--
Web1: http://wand.net.nz/~iam4/
Web2: http://www.jandi.co.nz
Blog: http://iansblog.jandi.co.nz
^ permalink raw reply
* Re: [patch 0/1][RFC] add a private field to the sock structure
From: Daniel Lezcano @ 2007-08-29 21:15 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, David Miller, dlezcano, netdev, ralf,
hch
In-Reply-To: <20070829191831.GA16184@ghostprotocols.net>
Arnaldo Carvalho de Melo wrote:
> Em Wed, Aug 29, 2007 at 11:23:16AM -0700, David Miller escreveu:
>> From: dlezcano@fr.ibm.com
>> Date: Wed, 29 Aug 2007 18:41:14 +0200
>>
>>> When a socket is created it is sometime useful to store a specific information
>>> for this socket.
>>>
>>> This information can be for examples:
>>> * a creation time
>>> * a pid
>>> * a uid/gid
>>> * a container identifier
>>> * a pointer to a more specific structure
>>> * ...
>>>
>>> The following patch is a proposition to add a private anonymous pointer
>>> field to the common part of the sock structure.
>> We got rid of the private field a long time ago because not only
>> is it not needed, it tends to get abused.
>
> Nah, it still there, sk_protinfo, its just ax25 that uses it
> (nudge(Ralf)). How do we state that a struct field is deprecated and
> will be removed soon(tm)?
>
> There is another, sk_user_data, that is used only by the rpc, pppol2tp,
> iscsi, ncpfs, smbfs and dlm guys, see? We need a deprecate flag for
> sk_protinfo, if not people will use it! :-)
Thank you for your feedbacks. I will play with the sk_user_data.
Is there a chance to have this field in the timewait sockets ? :)
Regards
--Daniel
^ permalink raw reply
* Re: [PATCH] make _minimum_ TCP retransmission timeout configurable
From: Eric Dumazet @ 2007-08-29 21:13 UTC (permalink / raw)
To: Rick Jones; +Cc: netdev
In-Reply-To: <200708292052.NAA21975@tardy.cup.hp.com>
Rick Jones a écrit :
> Enable configuration of the minimum TCP Retransmission Timeout via
> a new sysctl "tcp_rto_min" to help those who's networks (eg cellular)
> have quite variable RTTs avoid spurrious RTOs.
>
> Signed-off-by: Rick Jones <rick.jones2@hp.com>
> Signed-off-by: Lamont Jones <lamont@hp.com>
> ---
>
> diff -r 1559df81a153 include/linux/sysctl.h
> --- a/include/linux/sysctl.h Mon Aug 13 05:00:33 2007 +0000
> +++ b/include/linux/sysctl.h Wed Aug 22 10:42:55 2007 -0700
> @@ -441,6 +441,7 @@ enum
> NET_TCP_ALLOWED_CONG_CONTROL=123,
> NET_TCP_MAX_SSTHRESH=124,
> NET_TCP_FRTO_RESPONSE=125,
> + NET_TCP_RTO_MIN=126,
> };
>
> enum {
I am sure you can use CTL_UNNUMBERED instead of adding yet another sysctl
value, as advised in include/linux/sysctl.h
** For new interfaces unless you really need a binary number
** please use CTL_UNNUMBERED.
Thank you
^ permalink raw reply
* [PATCH] make _minimum_ TCP retransmission timeout configurable
From: Rick Jones @ 2007-08-29 20:52 UTC (permalink / raw)
To: netdev
Enable configuration of the minimum TCP Retransmission Timeout via
a new sysctl "tcp_rto_min" to help those who's networks (eg cellular)
have quite variable RTTs avoid spurrious RTOs.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: Lamont Jones <lamont@hp.com>
---
diff -r 1559df81a153 Documentation/networking/ip-sysctl.txt
--- a/Documentation/networking/ip-sysctl.txt Mon Aug 13 05:00:33 2007 +0000
+++ b/Documentation/networking/ip-sysctl.txt Wed Aug 22 10:42:55 2007 -0700
@@ -339,6 +339,13 @@ tcp_rmem - vector of 3 INTEGERs: min, de
selected receiver buffers for TCP socket. This value does not override
net.core.rmem_max, "static" selection via SO_RCVBUF does not use this.
Default: 87380*2 bytes.
+
+tcp_rto_min - INTEGER
+ The minimum value for the TCP Retransmission Timeout, expressed
+ in milliseconds for the convenience of the user.
+ This is bounded at the low-end by TCP_RTO_MIN and by TCP_RTO_MAX at
+ the high-end.
+ Default: 200.
tcp_sack - BOOLEAN
Enable select acknowledgments (SACKS).
diff -r 1559df81a153 include/linux/sysctl.h
--- a/include/linux/sysctl.h Mon Aug 13 05:00:33 2007 +0000
+++ b/include/linux/sysctl.h Wed Aug 22 10:42:55 2007 -0700
@@ -441,6 +441,7 @@ enum
NET_TCP_ALLOWED_CONG_CONTROL=123,
NET_TCP_MAX_SSTHRESH=124,
NET_TCP_FRTO_RESPONSE=125,
+ NET_TCP_RTO_MIN=126,
};
enum {
diff -r 1559df81a153 include/net/tcp.h
--- a/include/net/tcp.h Mon Aug 13 05:00:33 2007 +0000
+++ b/include/net/tcp.h Wed Aug 22 10:42:55 2007 -0700
@@ -232,6 +232,7 @@ extern int sysctl_tcp_workaround_signed_
extern int sysctl_tcp_workaround_signed_windows;
extern int sysctl_tcp_slow_start_after_idle;
extern int sysctl_tcp_max_ssthresh;
+extern unsigned int sysctl_tcp_rto_min;
extern atomic_t tcp_memory_allocated;
extern atomic_t tcp_sockets_allocated;
diff -r 1559df81a153 net/ipv4/sysctl_net_ipv4.c
--- a/net/ipv4/sysctl_net_ipv4.c Mon Aug 13 05:00:33 2007 +0000
+++ b/net/ipv4/sysctl_net_ipv4.c Wed Aug 22 10:42:55 2007 -0700
@@ -186,6 +186,36 @@ static int strategy_allowed_congestion_c
}
+/* if there is ever a proc_dointvec_ms_jiffies_minmax we can get rid
+ of this routine */
+
+static int proc_tcp_rto_min(ctl_table *ctl, int write, struct file *filp,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ int *valp = ctl->data;
+ int oldval = *valp;
+ int ret;
+
+ ret = proc_dointvec_ms_jiffies(ctl, write, filp, buffer, lenp, ppos);
+ if (ret)
+ return ret;
+
+ /* some bounds checking would be in order */
+ if (write && *valp != oldval) {
+ if (*valp < (int)TCP_RTO_MIN) {
+ *valp = oldval;
+ return -EINVAL;
+ }
+ if (*valp > (int)TCP_RTO_MAX) {
+ *valp = oldval;
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
+
ctl_table ipv4_table[] = {
{
.ctl_name = NET_IPV4_TCP_TIMESTAMPS,
@@ -819,6 +849,14 @@ ctl_table ipv4_table[] = {
.mode = 0644,
.proc_handler = &proc_dointvec,
},
+ {
+ .ctl_name = NET_TCP_RTO_MIN,
+ .procname = "tcp_rto_min",
+ .data = &sysctl_tcp_rto_min,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_tcp_rto_min
+ },
{ .ctl_name = 0 }
};
diff -r 1559df81a153 net/ipv4/tcp_input.c
--- a/net/ipv4/tcp_input.c Mon Aug 13 05:00:33 2007 +0000
+++ b/net/ipv4/tcp_input.c Wed Aug 22 10:42:55 2007 -0700
@@ -91,6 +91,8 @@ int sysctl_tcp_nometrics_save __read_mos
int sysctl_tcp_moderate_rcvbuf __read_mostly = 1;
int sysctl_tcp_abc __read_mostly;
+
+unsigned int sysctl_tcp_rto_min __read_mostly = TCP_RTO_MIN;
#define FLAG_DATA 0x01 /* Incoming frame contained data. */
#define FLAG_WIN_UPDATE 0x02 /* Incoming ACK was a window update. */
@@ -616,13 +618,13 @@ static void tcp_rtt_estimator(struct soc
if (tp->mdev_max < tp->rttvar)
tp->rttvar -= (tp->rttvar-tp->mdev_max)>>2;
tp->rtt_seq = tp->snd_nxt;
- tp->mdev_max = TCP_RTO_MIN;
+ tp->mdev_max = sysctl_tcp_rto_min;
}
} else {
/* no previous measure. */
tp->srtt = m<<3; /* take the measured time to be rtt */
tp->mdev = m<<1; /* make sure rto = 3*rtt */
- tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN);
+ tp->mdev_max = tp->rttvar = max(tp->mdev, sysctl_tcp_rto_min);
tp->rtt_seq = tp->snd_nxt;
}
}
@@ -843,7 +845,7 @@ static void tcp_init_metrics(struct sock
}
if (dst_metric(dst, RTAX_RTTVAR) > tp->mdev) {
tp->mdev = dst_metric(dst, RTAX_RTTVAR);
- tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN);
+ tp->mdev_max = tp->rttvar = max(tp->mdev, sysctl_tcp_rto_min);
}
tcp_set_rto(sk);
tcp_bound_rto(sk);
^ permalink raw reply
* Re: Tc bug (kernel crash) more info
From: slavon @ 2007-08-29 20:16 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: netdev
In-Reply-To: <20070829133042.GA4038@ff.dom.local>
Quoting Jarek Poplawski <jarkao2@o2.pl>:
> On Wed, Aug 29, 2007 at 04:53:52PM +0400, Badalian Vyacheslav wrote:
> ...
>> we have this kernel panic (then delete HTB) at all 2.6.18-x versions.
>> on older kernel (2.6.x) we have another panic (then delete tc filter)...
>> summary we have TC panics 1 year ago ;) Sysctl option "reboot on panic"
>
> I'm not sure: do you mean it was less often? Did you try to report it
> here? (Delete HTB: qdisc or classes?)
>
i was can't catch bug. now i have configured netconsole to catch panics.
for every clinet run command like:
### command to recreate HTB
tc filter del dev eth1 protocol ip parent 1:0 prio 5 handle 4:9:a1 u32
tc filter del dev eth0 protocol ip parent 1:0 prio 5 handle 4:9:a1 u32
tc class del dev eth1 parent 1:6 classid 1:1c
tc class del dev eth0 parent 1:6 classid 1:1c
tc class del dev eth1 parent 1:8 classid 1:1c
tc class del dev eth0 parent 1:8 classid 1:1c
tc class add dev eth1 parent 1:8 classid 1:1c htb rate 1kbit ceil
5000kbit burst 1b cburst 625b quantum 1500
tc qdisc add dev eth1 parent 1:1c handle 28 sfq perturb 10
tc class add dev eth0 parent 1:8 classid 1:1c htb rate 1kbit ceil
5000kbit burst 1b cburst 625b quantum 1500
tc qdisc add dev eth0 parent 1:1c handle 28 sfq perturb 10
tc filter add dev eth1 protocol ip parent 1:0 prio 5 handle 8:73:6 u32
ht 8:73: match ip dst 87.255.6.115 flowid 1:1c
tc filter add dev eth0 protocol ip parent 1:0 prio 5 handle 8:73:6 u32
ht 8:73: match ip src 87.255.6.115 flowid 1:1c
tc filter add dev eth1 protocol ip parent 1:0 prio 5 handle 4:9:a1 u32
ht 4:9: match ip dst 172.16.161.9 flowid 1:1c
tc filter add dev eth0 protocol ip parent 1:0 prio 5 handle 4:9:a1 u32
ht 4:9: match ip src 172.16.161.9 flowid 1:1c
###
i try delete class "parent 1:6" and "parent 1:8" because i not know
what parent was. (limited speed class 1:6 or unlimited speed class 1:8)
if i delete class - qdisc delete automatic.
if computer not have traffic - all normal (test system work 3 week).
if we have lot of traffic system have 1-5 kernel panics at week.
>> save us. Now we up 2 backup computers and may try any patches to fix
>> this problem.
>>
>> Also on 2.6.22 have strange dead. Black screen, no response to keyboard,
>> no info in netconsole, HardDisk led is stable red. "Black Dead"
>>
>
> Yes, with all black it could be harder... Maybe 'set -x' at the
> beginning (after #!/bin/sh line) of a script could manage to save
> something before reboot or send with netconsole (but there could be
> a lot of this with a large script...). Netconsole could be troublesome
> too. One HTB deadlock problem during similar deleting was fixed in
> 2.6.23-rc (HTB timer problem) but the log was different. Anyway,
> we probably need some more information (and trying).
In my desktop system i have "Black dead" (2.6.22-r5) All freeze (on
monitor KDE desctop. mouse, keyboard, network and other not work. HDD
led is on. No panics.)
Say that info you need. I will try get it.
PS. And also have we have strange bug in another computer (2.6.22-r5).
Have computer XEON_CPUx2 (4 CPU)
after boot have CPU0 and CPU3 SI = ~50%
after some time CPU0 SI = 0% and ksoftirqd/2 process have 100% cpu usage!
nat-new ~ # cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
0: 403 0 0 0 IO-APIC-edge timer
1: 448 0 0 0 IO-APIC-edge i8042
6: 3 0 0 0 IO-APIC-edge floppy
8: 3 0 0 0 IO-APIC-edge rtc
9: 18 0 0 0 IO-APIC-fasteoi acpi
12: 4 0 0 0 IO-APIC-edge i8042
16: 100838998 0 656832858 0 IO-APIC-fasteoi eth0
17: 756133415 0 124233955 1 IO-APIC-fasteoi eth1
18: 0 0 0 0 IO-APIC-fasteoi
uhci_hcd:usb1
19: 27167 0 0 0 IO-APIC-fasteoi gdth
20: 0 0 0 0 IO-APIC-fasteoi
uhci_hcd:usb2
NMI: 0 0 0 0
LOC: 89312505 89314019 89310139 89313972
ERR: 0
MIS: 0
changes only LOC interrupts!
Maybe its info intresting for you. =)
Best regals.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
^ permalink raw reply
* [PATCH 11/12] sky2: avoid divide in receive path
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-rx-ring-mod.patch --]
[-- Type: text/plain, Size: 687 bytes --]
Avoid divide (modulus) in receive buffer handling path.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-08-29 11:41:23.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:45:00.000000000 -0700
@@ -2140,7 +2140,8 @@ static struct sk_buff *sky2_receive(stru
printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
dev->name, sky2->rx_next, status, length);
- sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
+ if (++sky2->rx_next >= sky2->rx_pending)
+ sky2->rx_next = 0;
prefetch(sky2->rx_ring + sky2->rx_next);
if (status & GMR_FS_ANY_ERR)
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 05/12] sky2: advanced error reporting
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-recoverable.patch --]
[-- Type: text/plain, Size: 5963 bytes --]
Use the kernel interfaces for advanced error reporting.
This should be cleaner and clear up errors on boot.
For those systems with busted BIOS's that don't correctly
support mmconfig, advanced error reporting will be disabled.
The PCI registers for advanced error reporting start at 0x100 which
is too large to be accessed by legacy functions.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/sky2.c | 51 +++++++++++++++++++++++++++------------------------
drivers/net/sky2.h | 41 -----------------------------------------
2 files changed, 27 insertions(+), 65 deletions(-)
--- a/drivers/net/sky2.c 2007-08-29 11:40:53.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:41:07.000000000 -0700
@@ -31,6 +31,7 @@
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/pci.h>
+#include <linux/aer.h>
#include <linux/ip.h>
#include <net/ip.h>
#include <linux/tcp.h>
@@ -2369,7 +2370,11 @@ static void sky2_hw_error(struct sky2_hw
static void sky2_hw_intr(struct sky2_hw *hw)
{
+ struct pci_dev *pdev = hw->pdev;
u32 status = sky2_read32(hw, B0_HWE_ISRC);
+ u32 hwmsk = sky2_read32(hw, B0_HWE_IMSK);
+
+ status &= hwmsk;
if (status & Y2_IS_TIST_OV)
sky2_write8(hw, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
@@ -2379,7 +2384,7 @@ static void sky2_hw_intr(struct sky2_hw
pci_err = sky2_pci_read16(hw, PCI_STATUS);
if (net_ratelimit())
- dev_err(&hw->pdev->dev, "PCI hardware error (0x%x)\n",
+ dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
pci_err);
sky2_pci_write16(hw, PCI_STATUS,
@@ -2388,22 +2393,13 @@ static void sky2_hw_intr(struct sky2_hw
if (status & Y2_IS_PCI_EXP) {
/* PCI-Express uncorrectable Error occurred */
- u32 pex_err;
-
- pex_err = sky2_pci_read32(hw, PEX_UNC_ERR_STAT);
-
- if (net_ratelimit())
- dev_err(&hw->pdev->dev, "PCI Express error (0x%x)\n",
- pex_err);
+ int pos = pci_find_aer_capability(hw->pdev);
+ u32 err;
- /* clear the interrupt */
- sky2_pci_write32(hw, PEX_UNC_ERR_STAT,
- 0xffffffffUL);
- if (pex_err & PEX_FATAL_ERRORS) {
- u32 hwmsk = sky2_read32(hw, B0_HWE_IMSK);
- hwmsk &= ~Y2_IS_PCI_EXP;
- sky2_write32(hw, B0_HWE_IMSK, hwmsk);
- }
+ pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_STATUS, &err);
+ if (net_ratelimit())
+ dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
+ pci_cleanup_aer_uncorrect_error_status(pdev);
}
if (status & Y2_HWE_L1_MASK)
@@ -2641,8 +2637,10 @@ static int __devinit sky2_init(struct sk
static void sky2_reset(struct sky2_hw *hw)
{
+ struct pci_dev *pdev = hw->pdev;
u16 status;
- int i;
+ int i, cap;
+ u32 hwe_mask = Y2_HWE_ALL_MASK;
/* disable ASF */
if (hw->chip_id == CHIP_ID_YUKON_EX) {
@@ -2666,10 +2664,19 @@ static void sky2_reset(struct sky2_hw *h
sky2_write8(hw, B0_CTST, CS_MRST_CLR);
- /* clear any PEX errors */
- if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP))
- sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 0xffffffffUL);
+ cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+ if (cap) {
+ /* Check for advanced error reporting */
+ pci_cleanup_aer_uncorrect_error_status(pdev);
+ pci_cleanup_aer_correct_error_status(pdev);
+
+ /* If error bit is stuck on ignore it */
+ if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP)
+ dev_info(&pdev->dev, "ignoring stuck error report bit\n");
+ else if (pci_enable_pcie_error_reporting(pdev))
+ hwe_mask |= Y2_IS_PCI_EXP;
+ }
sky2_power_on(hw);
@@ -2721,7 +2728,7 @@ static void sky2_reset(struct sky2_hw *h
sky2_write8(hw, RAM_BUFFER(i, B3_RI_RTO_XS2), SK_RI_TO_53);
}
- sky2_write32(hw, B0_HWE_IMSK, Y2_HWE_ALL_MASK);
+ sky2_write32(hw, B0_HWE_IMSK, hwe_mask);
for (i = 0; i < hw->ports; i++)
sky2_gmac_reset(hw, i);
--- a/drivers/net/sky2.h 2007-08-29 11:40:51.000000000 -0700
+++ b/drivers/net/sky2.h 2007-08-29 11:41:07.000000000 -0700
@@ -18,14 +18,6 @@ enum {
PCI_CFG_REG_1 = 0x94,
};
-enum {
- PEX_DEV_CAP = 0xe4,
- PEX_DEV_CTRL = 0xe8,
- PEX_DEV_STA = 0xea,
- PEX_LNK_STAT = 0xf2,
- PEX_UNC_ERR_STAT= 0x104,
-};
-
/* Yukon-2 */
enum pci_dev_reg_1 {
PCI_Y2_PIG_ENA = 1<<31, /* Enable Plug-in-Go (YUKON-2) */
@@ -151,38 +143,6 @@ enum pci_cfg_reg1 {
PCI_STATUS_REC_TARGET_ABORT | \
PCI_STATUS_PARITY)
-enum pex_dev_ctrl {
- PEX_DC_MAX_RRS_MSK = 7<<12, /* Bit 14..12: Max. Read Request Size */
- PEX_DC_EN_NO_SNOOP = 1<<11,/* Enable No Snoop */
- PEX_DC_EN_AUX_POW = 1<<10,/* Enable AUX Power */
- PEX_DC_EN_PHANTOM = 1<<9, /* Enable Phantom Functions */
- PEX_DC_EN_EXT_TAG = 1<<8, /* Enable Extended Tag Field */
- PEX_DC_MAX_PLS_MSK = 7<<5, /* Bit 7.. 5: Max. Payload Size Mask */
- PEX_DC_EN_REL_ORD = 1<<4, /* Enable Relaxed Ordering */
- PEX_DC_EN_UNS_RQ_RP = 1<<3, /* Enable Unsupported Request Reporting */
- PEX_DC_EN_FAT_ER_RP = 1<<2, /* Enable Fatal Error Reporting */
- PEX_DC_EN_NFA_ER_RP = 1<<1, /* Enable Non-Fatal Error Reporting */
- PEX_DC_EN_COR_ER_RP = 1<<0, /* Enable Correctable Error Reporting */
-};
-#define PEX_DC_MAX_RD_RQ_SIZE(x) (((x)<<12) & PEX_DC_MAX_RRS_MSK)
-
-/* PEX_UNC_ERR_STAT PEX Uncorrectable Errors Status Register (Yukon-2) */
-enum pex_err {
- PEX_UNSUP_REQ = 1<<20, /* Unsupported Request Error */
-
- PEX_MALFOR_TLP = 1<<18, /* Malformed TLP */
-
- PEX_UNEXP_COMP = 1<<16, /* Unexpected Completion */
-
- PEX_COMP_TO = 1<<14, /* Completion Timeout */
- PEX_FLOW_CTRL_P = 1<<13, /* Flow Control Protocol Error */
- PEX_POIS_TLP = 1<<12, /* Poisoned TLP */
-
- PEX_DATA_LINK_P = 1<<4, /* Data Link Protocol Error */
- PEX_FATAL_ERRORS= (PEX_MALFOR_TLP | PEX_FLOW_CTRL_P | PEX_DATA_LINK_P),
-};
-
-
enum csr_regs {
B0_RAP = 0x0000,
B0_CTST = 0x0004,
@@ -419,7 +379,6 @@ enum {
Y2_IS_PAR_RX2 | Y2_IS_TCP_TXS2| Y2_IS_TCP_TXA2,
Y2_HWE_ALL_MASK = Y2_IS_TIST_OV | Y2_IS_MST_ERR | Y2_IS_IRQ_STAT |
- Y2_IS_PCI_EXP |
Y2_HWE_L1_MASK | Y2_HWE_L2_MASK,
};
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 03/12] sky2: document GPHY_CTRL bits
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-gphy-doc.patch --]
[-- Type: text/plain, Size: 1380 bytes --]
Add documentation of GPHY_CTRL register bits even if driver
is not using them (yet).
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.h 2007-08-29 11:38:37.000000000 -0700
+++ b/drivers/net/sky2.h 2007-08-29 11:40:12.000000000 -0700
@@ -1846,6 +1846,28 @@ enum {
/* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */
enum {
+ GPC_TX_PAUSE = 1<<30, /* Tx pause enabled (ro) */
+ GPC_RX_PAUSE = 1<<29, /* Rx pause enabled (ro) */
+ GPC_SPEED = 3<<27, /* PHY speed (ro) */
+ GPC_LINK = 1<<26, /* Link up (ro) */
+ GPC_DUPLEX = 1<<25, /* Duplex (ro) */
+ GPC_CLOCK = 1<<24, /* 125Mhz clock stable (ro) */
+
+ GPC_PDOWN = 1<<23, /* Internal regulator 2.5 power down */
+ GPC_TSTMODE = 1<<22, /* Test mode */
+ GPC_REG18 = 1<<21, /* Reg18 Power down */
+ GPC_REG12SEL = 3<<19, /* Reg12 power setting */
+ GPC_REG18SEL = 3<<17, /* Reg18 power setting */
+ GPC_SPILOCK = 1<<16, /* SPI lock (ASF) */
+
+ GPC_LEDMUX = 3<<14, /* LED Mux */
+ GPC_INTPOL = 1<<13, /* Interrupt polarity */
+ GPC_DETECT = 1<<12, /* Energy detect */
+ GPC_1000HD = 1<<11, /* Enable 1000Mbit HD */
+ GPC_SLAVE = 1<<10, /* Slave mode */
+ GPC_PAUSE = 1<<9, /* Pause enable */
+ GPC_LEDCTL = 3<<6, /* GPHY Leds */
+
GPC_RST_CLR = 1<<1, /* Clear GPHY Reset */
GPC_RST_SET = 1<<0, /* Set GPHY Reset */
};
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 08/12] ktime_sub_ns: analog of ktime_add_ns
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: ktime_sub_ns.patch --]
[-- Type: text/plain, Size: 2030 bytes --]
Add macro/function to subtract constant nanoseconds.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/include/linux/ktime.h 2007-08-29 11:31:59.000000000 -0700
+++ b/include/linux/ktime.h 2007-08-29 11:41:19.000000000 -0700
@@ -102,6 +102,13 @@ static inline ktime_t ktime_set(const lo
#define ktime_add_ns(kt, nsval) \
({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
+/*
+ * Subtract a ktime_t variable and a scalar nanosecond value.
+ * res = kt - nsval:
+ */
+#define ktime_sub_ns(kt, nsval) \
+ ({ (ktime_t){ .tv64 = (kt).tv64 - (nsval) }; })
+
/* convert a timespec to ktime_t format: */
static inline ktime_t timespec_to_ktime(struct timespec ts)
{
@@ -200,6 +207,15 @@ static inline ktime_t ktime_add(const kt
extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
/**
+ * ktime_sub_ns - Subtract a scalar nanoseconds value to a ktime_t variable
+ * @kt: minuend
+ * @nsec: subtrahend in nanoseconds
+ *
+ * Returns the difference of @kt and @nsec in ktime_t format
+ */
+extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
+
+/**
* timespec_to_ktime - convert a timespec to ktime_t format
* @ts: the timespec variable to convert
*
--- a/kernel/hrtimer.c 2007-08-29 11:31:59.000000000 -0700
+++ b/kernel/hrtimer.c 2007-08-29 11:41:19.000000000 -0700
@@ -277,6 +277,30 @@ ktime_t ktime_add_ns(const ktime_t kt, u
}
EXPORT_SYMBOL_GPL(ktime_add_ns);
+
+/**
+ * ktime_sub_ns - Subract a scalar nanoseconds value to a ktime_t variable
+ * @kt: minuend
+ * @nsec: subtrahend in nanoseconds
+ *
+ * Returns the difference of kt and nsec in ktime_t format
+ */
+ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec)
+{
+ ktime_t tmp;
+
+ if (likely(nsec < NSEC_PER_SEC)) {
+ tmp.tv64 = nsec;
+ } else {
+ unsigned long rem = do_div(nsec, NSEC_PER_SEC);
+
+ tmp = ktime_set((long)nsec, rem);
+ }
+
+ return ktime_sub(kt, tmp);
+}
+
+EXPORT_SYMBOL_GPL(ktime_add_ns);
# endif /* !CONFIG_KTIME_SCALAR */
/*
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 06/12] sky2: use pci_config access functions
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-pci-func.patch --]
[-- Type: text/plain, Size: 9045 bytes --]
Use the PCI layer config access functions. The driver was using the
memory mapped window in device, to workaround issues accessing the
advanced error reporting registers.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/sky2.c | 91 +++++++++++++++++++++++++++++------------------------
drivers/net/sky2.h | 21 ------------
2 files changed, 50 insertions(+), 62 deletions(-)
--- a/drivers/net/sky2.c 2007-08-29 11:41:07.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:41:10.000000000 -0700
@@ -222,21 +222,22 @@ static void sky2_power_on(struct sky2_hw
if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
hw->chip_id == CHIP_ID_YUKON_EX) {
+ struct pci_dev *pdev = hw->pdev;
u32 reg;
- sky2_pci_write32(hw, PCI_DEV_REG3, 0);
+ pci_write_config_dword(pdev, PCI_DEV_REG3, 0);
- reg = sky2_pci_read32(hw, PCI_DEV_REG4);
+ pci_read_config_dword(pdev, PCI_DEV_REG4, ®);
/* set all bits to 0 except bits 15..12 and 8 */
reg &= P_ASPM_CONTROL_MSK;
- sky2_pci_write32(hw, PCI_DEV_REG4, reg);
+ pci_write_config_dword(pdev, PCI_DEV_REG4, reg);
- reg = sky2_pci_read32(hw, PCI_DEV_REG5);
+ pci_read_config_dword(pdev, PCI_DEV_REG5, ®);
/* set all bits to 0 except bits 28 & 27 */
reg &= P_CTL_TIM_VMAIN_AV_MSK;
- sky2_pci_write32(hw, PCI_DEV_REG5, reg);
+ pci_write_config_dword(pdev, PCI_DEV_REG5, reg);
- sky2_pci_write32(hw, PCI_CFG_REG_1, 0);
+ pci_write_config_dword(pdev, PCI_CFG_REG_1, 0);
/* Enable workaround for dev 4.107 on Yukon-Ultra & Extreme */
reg = sky2_read32(hw, B2_GP_IO);
@@ -596,6 +597,7 @@ static void sky2_phy_init(struct sky2_hw
static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
{
+ struct pci_dev *pdev = hw->pdev;
u32 reg1;
static const u32 phy_power[]
= { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
@@ -604,15 +606,16 @@ static void sky2_phy_power(struct sky2_h
if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
onoff = !onoff;
- reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
+ pci_read_config_dword(pdev, PCI_DEV_REG1, ®1);
if (onoff)
/* Turn off phy power saving */
reg1 &= ~phy_power[port];
else
reg1 |= phy_power[port];
- sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
- sky2_pci_read32(hw, PCI_DEV_REG1);
+ pci_write_config_dword(pdev, PCI_DEV_REG1, reg1);
+ pci_read_config_dword(pdev, PCI_DEV_REG1, ®1);
+
udelay(100);
}
@@ -680,9 +683,9 @@ static void sky2_wol_init(struct sky2_po
sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
/* Turn on legacy PCI-Express PME mode */
- reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
+ pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®1);
reg1 |= PCI_Y2_PME_LEGACY;
- sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
+ pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg1);
/* block receiver */
sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
@@ -1281,9 +1284,9 @@ static int sky2_up(struct net_device *de
struct sky2_port *osky2 = netdev_priv(otherdev);
u16 cmd;
- cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
+ pci_read_config_word(hw->pdev, cap + PCI_X_CMD, &cmd);
cmd &= ~PCI_X_CMD_MAX_SPLIT;
- sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
+ pci_write_config_word(hw->pdev, cap + PCI_X_CMD, cmd);
sky2->rx_csum = 0;
osky2->rx_csum = 0;
@@ -2382,13 +2385,13 @@ static void sky2_hw_intr(struct sky2_hw
if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
u16 pci_err;
- pci_err = sky2_pci_read16(hw, PCI_STATUS);
+ pci_read_config_word(pdev, PCI_STATUS, &pci_err);
if (net_ratelimit())
dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
pci_err);
- sky2_pci_write16(hw, PCI_STATUS,
- pci_err | PCI_STATUS_ERROR_BITS);
+ pci_write_config_word(pdev, PCI_STATUS,
+ pci_err | PCI_STATUS_ERROR_BITS);
}
if (status & Y2_IS_PCI_EXP) {
@@ -2599,10 +2602,13 @@ static inline u32 sky2_clk2us(const stru
static int __devinit sky2_init(struct sky2_hw *hw)
{
+ int rc;
u8 t8;
- /* Enable all clocks */
- sky2_pci_write32(hw, PCI_DEV_REG3, 0);
+ /* Enable all clocks and check for bad PCI access */
+ rc = pci_write_config_dword(hw->pdev, PCI_DEV_REG3, 0);
+ if (rc)
+ return rc;
sky2_write8(hw, B0_CTST, CS_RST_CLR);
@@ -2657,10 +2663,9 @@ static void sky2_reset(struct sky2_hw *h
sky2_write8(hw, B0_CTST, CS_RST_CLR);
/* clear PCI errors, if any */
- status = sky2_pci_read16(hw, PCI_STATUS);
-
- sky2_pci_write16(hw, PCI_STATUS, status | PCI_STATUS_ERROR_BITS);
-
+ pci_read_config_word(pdev, PCI_STATUS, &status);
+ status |= PCI_STATUS_ERROR_BITS;
+ pci_write_config_word(pdev, PCI_STATUS, status);
sky2_write8(hw, B0_CTST, CS_MRST_CLR);
@@ -3477,26 +3482,31 @@ static int sky2_get_eeprom_len(struct ne
struct sky2_port *sky2 = netdev_priv(dev);
u16 reg2;
- reg2 = sky2_pci_read32(sky2->hw, PCI_DEV_REG2);
+ pci_read_config_word(sky2->hw->pdev, PCI_DEV_REG2, ®2);
return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
}
-static u32 sky2_vpd_read(struct sky2_hw *hw, int cap, u16 offset)
+static u32 sky2_vpd_read(struct pci_dev *pdev, int cap, u16 offset)
{
- sky2_pci_write16(hw, cap + PCI_VPD_ADDR, offset);
+ u32 val;
- while (!(sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F))
- cpu_relax();
- return sky2_pci_read32(hw, cap + PCI_VPD_DATA);
+ pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset);
+
+ do {
+ pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset);
+ } while (!(offset & PCI_VPD_ADDR_F));
+
+ pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val);
+ return val;
}
-static void sky2_vpd_write(struct sky2_hw *hw, int cap, u16 offset, u32 val)
+static void sky2_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val)
{
- sky2_pci_write32(hw, cap + PCI_VPD_DATA, val);
- sky2_pci_write16(hw, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F);
+ pci_write_config_word(pdev, cap + PCI_VPD_DATA, val);
+ pci_write_config_dword(pdev, cap + PCI_VPD_ADDR, offset | PCI_VPD_ADDR_F);
do {
- cpu_relax();
- } while (sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F);
+ pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset);
+ } while (offset & PCI_VPD_ADDR_F);
}
static int sky2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
@@ -3513,7 +3523,7 @@ static int sky2_get_eeprom(struct net_de
eeprom->magic = SKY2_EEPROM_MAGIC;
while (length > 0) {
- u32 val = sky2_vpd_read(sky2->hw, cap, offset);
+ u32 val = sky2_vpd_read(sky2->hw->pdev, cap, offset);
int n = min_t(int, length, sizeof(val));
memcpy(data, &val, n);
@@ -3543,10 +3553,10 @@ static int sky2_set_eeprom(struct net_de
int n = min_t(int, length, sizeof(val));
if (n < sizeof(val))
- val = sky2_vpd_read(sky2->hw, cap, offset);
+ val = sky2_vpd_read(sky2->hw->pdev, cap, offset);
memcpy(&val, data, n);
- sky2_vpd_write(sky2->hw, cap, offset, val);
+ sky2_vpd_write(sky2->hw->pdev, cap, offset, val);
length -= n;
data += n;
@@ -3990,15 +4000,14 @@ static int __devinit sky2_probe(struct p
*/
{
u32 reg;
- reg = sky2_pci_read32(hw, PCI_DEV_REG2);
+ pci_read_config_dword(pdev,PCI_DEV_REG2, ®);
reg &= ~PCI_REV_DESC;
- sky2_pci_write32(hw, PCI_DEV_REG2, reg);
+ pci_write_config_dword(pdev, PCI_DEV_REG2, reg);
}
#endif
/* ring for status responses */
- hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES,
- &hw->st_dma);
+ hw->st_le = pci_alloc_consistent(pdev, STATUS_LE_BYTES, &hw->st_dma);
if (!hw->st_le)
goto err_out_iounmap;
@@ -4073,7 +4082,7 @@ err_out_free_netdev:
free_netdev(dev);
err_out_free_pci:
sky2_write8(hw, B0_CTST, CS_RST_SET);
- pci_free_consistent(hw->pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
+ pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
err_out_iounmap:
iounmap(hw->regs);
err_out_free_hw:
@@ -4184,7 +4193,7 @@ static int sky2_resume(struct pci_dev *p
/* Re-enable all clocks */
if (hw->chip_id == CHIP_ID_YUKON_EX || hw->chip_id == CHIP_ID_YUKON_EC_U)
- sky2_pci_write32(hw, PCI_DEV_REG3, 0);
+ pci_write_config_dword(pdev, PCI_DEV_REG3, 0);
sky2_reset(hw);
--- a/drivers/net/sky2.h 2007-08-29 11:41:07.000000000 -0700
+++ b/drivers/net/sky2.h 2007-08-29 11:41:10.000000000 -0700
@@ -2115,25 +2115,4 @@ static inline void gma_set_addr(struct s
gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8));
gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8));
}
-
-/* PCI config space access */
-static inline u32 sky2_pci_read32(const struct sky2_hw *hw, unsigned reg)
-{
- return sky2_read32(hw, Y2_CFG_SPC + reg);
-}
-
-static inline u16 sky2_pci_read16(const struct sky2_hw *hw, unsigned reg)
-{
- return sky2_read16(hw, Y2_CFG_SPC + reg);
-}
-
-static inline void sky2_pci_write32(struct sky2_hw *hw, unsigned reg, u32 val)
-{
- sky2_write32(hw, Y2_CFG_SPC + reg, val);
-}
-
-static inline void sky2_pci_write16(struct sky2_hw *hw, unsigned reg, u16 val)
-{
- sky2_write16(hw, Y2_CFG_SPC + reg, val);
-}
#endif
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 12/12] sky2: 1.18
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-1.18 --]
[-- Type: text/plain, Size: 476 bytes --]
Since ther is new functionality (timestamping), increase
the version.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-08-29 11:45:00.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:46:25.000000000 -0700
@@ -53,7 +53,7 @@
#include "sky2.h"
#define DRV_NAME "sky2"
-#define DRV_VERSION "1.17"
+#define DRV_VERSION "1.18"
#define PFX DRV_NAME " "
/*
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 10/12] sky2: hardware receive timestamp counter
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-rx-time.patch --]
[-- Type: text/plain, Size: 5021 bytes --]
Use hardware timestamp counter to stamp receive packets.
It allows for higher resolution values without the hardware overhead
of doing gettimeofday.
Even though the network stack is smart enough to not stamp
packets unless needed, any installation with dhcpd ends up
using af_packet and that turns on timestamping by default.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/sky2.c | 159 +++++++++++++++++++++++++++++++++++++++--------------
drivers/net/sky2.h | 5 +
2 files changed, 124 insertions(+), 40 deletions(-)
--- a/drivers/net/sky2.c 2007-08-29 11:41:16.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:41:23.000000000 -0700
@@ -26,6 +26,7 @@
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/module.h>
+#include <linux/reciprocal_div.h>
#include <linux/netdevice.h>
#include <linux/dma-mapping.h>
#include <linux/etherdevice.h>
@@ -2186,6 +2187,36 @@ error:
goto resubmit;
}
+static inline u32 sky2_tist2ns(const struct sky2_hw *hw, u32 clk)
+{
+ return reciprocal_divide(clk * 1000, hw->tist_rate);
+}
+
+/*
+ * Convert hardware timestamp clock into a real time value
+ */
+static void sky2_set_timestamp(struct sk_buff *skb,
+ const struct sky2_hw *hw, u32 stamp)
+{
+ unsigned long seq;
+
+ do {
+ s32 delta;
+
+ seq = read_seqbegin(&hw->tist_lock);
+
+ /* ticks since last synchronization */
+ delta = stamp - hw->tist_base;
+
+ if (delta > 0)
+ skb->tstamp = ktime_add_ns(hw->tist_real,
+ sky2_tist2ns(hw, delta));
+ else
+ skb->tstamp = ktime_sub_ns(hw->tist_real,
+ sky2_tist2ns(hw, -delta));
+ } while (read_seqretry(&hw->tist_lock, seq));
+}
+
/* Transmit complete */
static inline void sky2_tx_done(struct net_device *dev, u16 last)
{
@@ -2262,6 +2293,16 @@ static int sky2_status_intr(struct sky2_
break;
#ifdef SKY2_VLAN_TAG_USED
+ case OP_RXTIMEVLAN:
+ sky2->rx_tag = length;
+ /* fall through */
+#endif
+ case OP_RXTIMESTAMP:
+ skb = sky2->rx_ring[sky2->rx_next].skb;
+ sky2_set_timestamp(skb, hw, status);
+ break;
+
+#ifdef SKY2_VLAN_TAG_USED
case OP_RXVLAN:
sky2->rx_tag = length;
break;
@@ -2457,11 +2498,15 @@ static void sky2_le_error(struct sky2_hw
sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK);
}
-/* Check for lost IRQ once a second */
+/* Once a second timer for safety checking and polling for timestamp
+ *
+ * Note: receive and timer processing both happen under softirq
+ */
static void sky2_watchdog(unsigned long arg)
{
struct sky2_hw *hw = (struct sky2_hw *) arg;
+ /* Look for lost IRQ */
if (sky2_read32(hw, B0_ISRC)) {
struct net_device *dev = hw->dev[0];
@@ -2469,6 +2514,14 @@ static void sky2_watchdog(unsigned long
__netif_rx_schedule(dev);
}
+ /* Snapshot current system realtime at current timestamp value
+ * @ 150Mhz counter wraps in 28.6 secs
+ */
+ write_seqlock(&hw->tist_lock);
+ hw->tist_real = ktime_get_real();
+ hw->tist_base = sky2_read32(hw, GMAC_TI_ST_VAL);
+ write_sequnlock(&hw->tist_lock);
+
if (hw->active > 0)
mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ));
}
@@ -2707,9 +2760,8 @@ static void sky2_reset(struct sky2_hw *h
/* Turn off descriptor polling */
sky2_write32(hw, B28_DPT_CTRL, DPT_STOP);
- /* Turn off receive timestamp */
- sky2_write8(hw, GMAC_TI_ST_CTRL, GMT_ST_STOP);
- sky2_write8(hw, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
+ /* Turn on receive timestamp */
+ sky2_write8(hw, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ|GMT_ST_START);
/* enable the Tx Arbiters */
for (i = 0; i < hw->ports; i++)
@@ -4061,6 +4113,9 @@ static int __devinit sky2_probe(struct p
sky2_show_addr(dev1);
}
+ seqlock_init(&hw->tist_lock);
+ hw->tist_rate = reciprocal_value(sky2_mhz(hw));
+
setup_timer(&hw->watchdog_timer, sky2_watchdog, (unsigned long) hw);
INIT_WORK(&hw->restart_work, sky2_restart);
--- a/drivers/net/sky2.h 2007-08-29 11:41:16.000000000 -0700
+++ b/drivers/net/sky2.h 2007-08-29 11:41:23.000000000 -0700
@@ -352,7 +352,7 @@ enum {
/* Hardware error interrupt mask for Yukon 2 */
enum {
- Y2_IS_TIST_OV = 1<<29,/* Time Stamp Timer overflow interrupt */
+ Y2_IS_TIST_OV = 1<<29, /* Time Stamp Timer overflow interrupt */
Y2_IS_SENSOR = 1<<28, /* Sensor interrupt */
Y2_IS_MST_ERR = 1<<27, /* Master error interrupt */
Y2_IS_IRQ_STAT = 1<<26, /* Status exception interrupt */
@@ -378,7 +378,7 @@ enum {
Y2_HWE_L2_MASK = Y2_IS_PAR_RD2 | Y2_IS_PAR_WR2 | Y2_IS_PAR_MAC2 |
Y2_IS_PAR_RX2 | Y2_IS_TCP_TXS2| Y2_IS_TCP_TXA2,
- Y2_HWE_ALL_MASK = Y2_IS_TIST_OV | Y2_IS_MST_ERR | Y2_IS_IRQ_STAT |
+ Y2_HWE_ALL_MASK = Y2_IS_MST_ERR | Y2_IS_IRQ_STAT |
Y2_HWE_L1_MASK | Y2_HWE_L2_MASK,
};
@@ -2032,6 +2032,11 @@ struct sky2_hw {
u8 ports;
u8 active;
+ seqlock_t tist_lock;
+ ktime_t tist_real;
+ u32 tist_base;
+ u32 tist_rate;
+
struct sky2_status_le *st_le;
u32 st_idx;
dma_addr_t st_dma;
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 09/12] export reciprocal_value for modules
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: reciprocal_export.patch --]
[-- Type: text/plain, Size: 538 bytes --]
Need this in later sky2 code.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/lib/reciprocal_div.c 2007-06-25 09:03:23.000000000 -0700
+++ b/lib/reciprocal_div.c 2007-08-29 11:30:38.000000000 -0700
@@ -1,5 +1,6 @@
#include <asm/div64.h>
#include <linux/reciprocal_div.h>
+#include <linux/module.h>
u32 reciprocal_value(u32 k)
{
@@ -7,3 +8,4 @@ u32 reciprocal_value(u32 k)
do_div(val, k);
return (u32)val;
}
+EXPORT_SYMBOL(reciprocal_value);
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 07/12] sky2: use net_device internal stats
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-int-stats.patch --]
[-- Type: text/plain, Size: 3462 bytes --]
This driver can just use the internal network stats block.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-08-29 11:41:10.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:41:16.000000000 -0700
@@ -1606,8 +1606,8 @@ static void sky2_tx_complete(struct sky2
printk(KERN_DEBUG "%s: tx done %u\n",
dev->name, idx);
- sky2->net_stats.tx_packets++;
- sky2->net_stats.tx_bytes += re->skb->len;
+ dev->stats.tx_packets++;
+ dev->stats.tx_bytes += re->skb->len;
dev_kfree_skb_any(re->skb);
sky2->tx_next = RING_NEXT(idx, TX_RING_SIZE);
@@ -2163,12 +2163,12 @@ resubmit:
len_mismatch:
/* Truncation of overlength packets
causes PHY length to not match MAC length */
- ++sky2->net_stats.rx_length_errors;
+ ++dev->stats.rx_length_errors;
error:
- ++sky2->net_stats.rx_errors;
+ ++dev->stats.rx_errors;
if (status & GMR_FS_RX_FF_OV) {
- sky2->net_stats.rx_over_errors++;
+ dev->stats.rx_over_errors++;
goto resubmit;
}
@@ -2177,11 +2177,11 @@ error:
dev->name, status, length);
if (status & (GMR_FS_LONG_ERR | GMR_FS_UN_SIZE))
- sky2->net_stats.rx_length_errors++;
+ dev->stats.rx_length_errors++;
if (status & GMR_FS_FRAGMENT)
- sky2->net_stats.rx_frame_errors++;
+ dev->stats.rx_frame_errors++;
if (status & GMR_FS_CRC_ERR)
- sky2->net_stats.rx_crc_errors++;
+ dev->stats.rx_crc_errors++;
goto resubmit;
}
@@ -2228,7 +2228,7 @@ static int sky2_status_intr(struct sky2_
++rx[port];
skb = sky2_receive(dev, length, status);
if (unlikely(!skb)) {
- sky2->net_stats.rx_dropped++;
+ dev->stats.rx_dropped++;
break;
}
@@ -2243,8 +2243,8 @@ static int sky2_status_intr(struct sky2_
}
skb->protocol = eth_type_trans(skb, dev);
- sky2->net_stats.rx_packets++;
- sky2->net_stats.rx_bytes += skb->len;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += skb->len;
dev->last_rx = jiffies;
#ifdef SKY2_VLAN_TAG_USED
@@ -2429,12 +2429,12 @@ static void sky2_mac_intr(struct sky2_hw
gma_read16(hw, port, GM_TX_IRQ_SRC);
if (status & GM_IS_RX_FF_OR) {
- ++sky2->net_stats.rx_fifo_errors;
+ ++dev->stats.rx_fifo_errors;
sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO);
}
if (status & GM_IS_TX_FF_UR) {
- ++sky2->net_stats.tx_fifo_errors;
+ ++dev->stats.tx_fifo_errors;
sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU);
}
}
@@ -3087,12 +3087,6 @@ static void sky2_get_strings(struct net_
}
}
-static struct net_device_stats *sky2_get_stats(struct net_device *dev)
-{
- struct sky2_port *sky2 = netdev_priv(dev);
- return &sky2->net_stats;
-}
-
static int sky2_set_mac_address(struct net_device *dev, void *p)
{
struct sky2_port *sky2 = netdev_priv(dev);
@@ -3802,7 +3796,7 @@ static __devinit struct net_device *sky2
dev->stop = sky2_down;
dev->do_ioctl = sky2_ioctl;
dev->hard_start_xmit = sky2_xmit_frame;
- dev->get_stats = sky2_get_stats;
+
dev->set_multicast_list = sky2_set_multicast;
dev->set_mac_address = sky2_set_mac_address;
dev->change_mtu = sky2_change_mtu;
--- a/drivers/net/sky2.h 2007-08-29 11:41:10.000000000 -0700
+++ b/drivers/net/sky2.h 2007-08-29 11:41:16.000000000 -0700
@@ -2019,8 +2019,6 @@ struct sky2_port {
#ifdef CONFIG_SKY2_DEBUG
struct dentry *debugfs;
#endif
- struct net_device_stats net_stats;
-
};
struct sky2_hw {
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 04/12] sky2: dont restrict config space access
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-no-cfg-disable --]
[-- Type: text/plain, Size: 2664 bytes --]
Take out the code that protects driver from accessing the
PCI config space.
We are old enough to run with scissors now.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/sky2.c | 9 ---------
1 file changed, 9 deletions(-)
--- a/drivers/net/sky2.c 2007-08-29 11:40:09.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:40:53.000000000 -0700
@@ -603,7 +603,6 @@ static void sky2_phy_power(struct sky2_h
if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
onoff = !onoff;
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
if (onoff)
/* Turn off phy power saving */
@@ -613,7 +612,6 @@ static void sky2_phy_power(struct sky2_h
sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
sky2_pci_read32(hw, PCI_DEV_REG1);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
udelay(100);
}
@@ -681,11 +679,9 @@ static void sky2_wol_init(struct sky2_po
sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
/* Turn on legacy PCI-Express PME mode */
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
reg1 |= PCI_Y2_PME_LEGACY;
sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
/* block receiver */
sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
@@ -2386,10 +2382,8 @@ static void sky2_hw_intr(struct sky2_hw
dev_err(&hw->pdev->dev, "PCI hardware error (0x%x)\n",
pci_err);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
sky2_pci_write16(hw, PCI_STATUS,
pci_err | PCI_STATUS_ERROR_BITS);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
}
if (status & Y2_IS_PCI_EXP) {
@@ -2403,11 +2397,8 @@ static void sky2_hw_intr(struct sky2_hw
pex_err);
/* clear the interrupt */
- sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
sky2_pci_write32(hw, PEX_UNC_ERR_STAT,
0xffffffffUL);
- sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-
if (pex_err & PEX_FATAL_ERRORS) {
u32 hwmsk = sky2_read32(hw, B0_HWE_IMSK);
hwmsk &= ~Y2_IS_PCI_EXP;
@@ -2670,7 +2661,6 @@ static void sky2_reset(struct sky2_hw *h
/* clear PCI errors, if any */
status = sky2_pci_read16(hw, PCI_STATUS);
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
sky2_pci_write16(hw, PCI_STATUS, status | PCI_STATUS_ERROR_BITS);
@@ -2693,8 +2683,6 @@ static void sky2_reset(struct sky2_hw *h
| GMC_BYP_RETR_ON);
}
- sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-
/* Clear I2C IRQ noise */
sky2_write32(hw, B2_I2C_IRQ, 1);
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 02/12] sky2: use debugfs rename
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-debugfs-rename.patch --]
[-- Type: text/plain, Size: 1994 bytes --]
Use debugfs rename to handle device neame changes.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-08-29 11:36:04.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:40:09.000000000 -0700
@@ -3712,42 +3712,34 @@ static int sky2_device_event(struct noti
unsigned long event, void *ptr)
{
struct net_device *dev = ptr;
+ struct sky2_port *sky2 = netdev_priv(dev);
- if (dev->open == sky2_up) {
- struct sky2_port *sky2 = netdev_priv(dev);
+ if (dev->open != sky2_up || !sky2_debug)
+ return NOTIFY_DONE;
- switch(event) {
- case NETDEV_CHANGENAME:
- if (!netif_running(dev))
- break;
- /* fallthrough */
- case NETDEV_DOWN:
- case NETDEV_GOING_DOWN:
- if (sky2->debugfs) {
- printk(KERN_DEBUG PFX "%s: remove debugfs\n",
- dev->name);
- debugfs_remove(sky2->debugfs);
- sky2->debugfs = NULL;
- }
+ switch(event) {
+ case NETDEV_CHANGENAME:
+ if (sky2->debugfs) {
+ sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
+ sky2_debug, dev->name);
+ }
+ break;
- if (event != NETDEV_CHANGENAME)
- break;
- /* fallthrough for changename */
- case NETDEV_UP:
- if (sky2_debug) {
- struct dentry *d;
- d = debugfs_create_file(dev->name, S_IRUGO,
- sky2_debug, dev,
- &sky2_debug_fops);
- if (d == NULL || IS_ERR(d))
- printk(KERN_INFO PFX
- "%s: debugfs create failed\n",
- dev->name);
- else
- sky2->debugfs = d;
- }
- break;
+ case NETDEV_GOING_DOWN:
+ if (sky2->debugfs) {
+ printk(KERN_DEBUG PFX "%s: remove debugfs\n",
+ dev->name);
+ debugfs_remove(sky2->debugfs);
+ sky2->debugfs = NULL;
}
+ break;
+
+ case NETDEV_UP:
+ sky2->debugfs = debugfs_create_file(dev->name, S_IRUGO,
+ sky2_debug, dev,
+ &sky2_debug_fops);
+ if (IS_ERR(sky2->debugfs))
+ sky2->debugfs = NULL;
}
return NOTIFY_DONE;
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* [PATCH 01/12] sky2: fe+ chip support
From: Stephen Hemminger @ 2007-08-29 19:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <20070829193922.078561651@linux-foundation.org>
[-- Attachment #1: sky2-fe-p.patch --]
[-- Type: text/plain, Size: 6737 bytes --]
Add support for new Marvell 100mbit chips.
This code is ported from the SysKonnect 10.20.3.3 driver.
It is *untested* because I don't have access to this hardware.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-08-29 11:31:59.000000000 -0700
+++ b/drivers/net/sky2.c 2007-08-29 11:36:04.000000000 -0700
@@ -118,12 +118,15 @@ static const struct pci_device_id sky2_i
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, /* 88E8036 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88E8033 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4365) }, /* 88E8070 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */
@@ -147,6 +150,7 @@ static const char *yukon2_name[] = {
"Extreme", /* 0xb5 */
"EC", /* 0xb6 */
"FE", /* 0xb7 */
+ "FE+", /* 0xb8 */
};
/* Access to external PHY */
@@ -332,7 +336,8 @@ static void sky2_phy_init(struct sky2_hw
ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
if (sky2_is_copper(hw)) {
- if (hw->chip_id == CHIP_ID_YUKON_FE) {
+ if (hw->chip_id == CHIP_ID_YUKON_FE ||
+ hw->chip_id == CHIP_ID_YUKON_FE_P) {
/* enable automatic crossover */
ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO) >> 1;
} else {
@@ -453,7 +458,7 @@ static void sky2_phy_init(struct sky2_hw
gma_write16(hw, port, GM_GP_CTRL, reg);
- if (hw->chip_id != CHIP_ID_YUKON_FE)
+ if (sky2_is_gigabit(hw))
gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000);
gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);
@@ -477,6 +482,22 @@ static void sky2_phy_init(struct sky2_hw
gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, ctrl);
break;
+ case CHIP_ID_YUKON_FE_P:
+ /* Enable Link Partner Next Page */
+ ctrl |= PHY_M_PC_ENA_LIP_NP;
+
+ /* disable Energy Detect and enable scrambler */
+ ctrl &= ~(PHY_M_PC_ENA_ENE_DT | PHY_M_PC_DIS_SCRAMB);
+ gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
+
+ /* set LED2 -> ACT, LED1 -> LINK, LED0 -> SPEED */
+ ctrl = PHY_M_FELP_LED2_CTRL(LED_PAR_CTRL_ACT_BL) |
+ PHY_M_FELP_LED1_CTRL(LED_PAR_CTRL_LINK) |
+ PHY_M_FELP_LED0_CTRL(LED_PAR_CTRL_SPEED);
+
+ gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, ctrl);
+ break;
+
case CHIP_ID_YUKON_XL:
pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
@@ -546,7 +567,13 @@ static void sky2_phy_init(struct sky2_hw
/* set page register to 0 */
gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0);
+ } else if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
+ hw->chip_rev == CHIP_REV_YU_FE2_A0) {
+ /* apply workaround for integrated resistors calibration */
+ gm_phy_write(hw, port, PHY_MARV_PAGE_ADDR, 17);
+ gm_phy_write(hw, port, PHY_MARV_PAGE_DATA, 0x3f60);
} else if (hw->chip_id != CHIP_ID_YUKON_EX) {
+ /* no effect on Yukon-XL */
gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) {
@@ -1709,8 +1736,12 @@ static u16 sky2_phy_speed(const struct s
if (!sky2_is_copper(hw))
return SPEED_1000;
- if (hw->chip_id == CHIP_ID_YUKON_FE)
- return (aux & PHY_M_PS_SPEED_100) ? SPEED_100 : SPEED_10;
+ if (!sky2_is_gigabit(hw)) {
+ if (aux & PHY_M_PS_SPEED_100)
+ return SPEED_100;
+ else
+ return SPEED_10;
+ }
switch (aux & PHY_M_PS_SPEED_MSK) {
case PHY_M_PS_SPEED_1000:
@@ -1956,7 +1987,9 @@ static int sky2_change_mtu(struct net_de
if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
return -EINVAL;
- if (new_mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_FE)
+ if (new_mtu > ETH_DATA_LEN &&
+ (hw->chip_id == CHIP_ID_YUKON_FE ||
+ hw->chip_id == CHIP_ID_YUKON_FE_P))
return -EINVAL;
if (!netif_running(dev)) {
@@ -2544,17 +2577,25 @@ static void sky2_netpoll(struct net_devi
#endif
/* Chip internal frequency for clock calculations */
-static inline u32 sky2_mhz(const struct sky2_hw *hw)
+static u32 sky2_mhz(const struct sky2_hw *hw)
{
switch (hw->chip_id) {
case CHIP_ID_YUKON_EC:
case CHIP_ID_YUKON_EC_U:
case CHIP_ID_YUKON_EX:
- return 125; /* 125 Mhz */
+ return 125;
+
case CHIP_ID_YUKON_FE:
- return 100; /* 100 Mhz */
- default: /* YUKON_XL */
- return 156; /* 156 Mhz */
+ return 100;
+
+ case CHIP_ID_YUKON_FE_P:
+ return 50;
+
+ case CHIP_ID_YUKON_XL:
+ return 156;
+
+ default:
+ BUG();
}
}
@@ -2579,7 +2620,8 @@ static int __devinit sky2_init(struct sk
sky2_write8(hw, B0_CTST, CS_RST_CLR);
hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
- if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) {
+ if (hw->chip_id < CHIP_ID_YUKON_XL ||
+ hw->chip_id > CHIP_ID_YUKON_FE_P) {
dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n",
hw->chip_id);
return -EOPNOTSUPP;
--- a/drivers/net/sky2.h 2007-08-29 11:31:59.000000000 -0700
+++ b/drivers/net/sky2.h 2007-08-29 11:38:37.000000000 -0700
@@ -470,18 +470,24 @@ enum {
CHIP_ID_YUKON_EX = 0xb5, /* Chip ID for YUKON-2 Extreme */
CHIP_ID_YUKON_EC = 0xb6, /* Chip ID for YUKON-2 EC */
CHIP_ID_YUKON_FE = 0xb7, /* Chip ID for YUKON-2 FE */
-
+ CHIP_ID_YUKON_FE_P = 0xb8, /* Chip ID for YUKON-2 FE+ */
+};
+enum yukon_ec_rev {
CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */
CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */
CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */
-
+};
+enum yukon_ec_u_rev {
CHIP_REV_YU_EC_U_A0 = 1,
CHIP_REV_YU_EC_U_A1 = 2,
CHIP_REV_YU_EC_U_B0 = 3,
-
+};
+enum yukon_fe_rev {
CHIP_REV_YU_FE_A1 = 1,
CHIP_REV_YU_FE_A2 = 2,
-
+};
+enum yukon_fe_p_rev {
+ CHIP_REV_YU_FE2_A0 = 0,
};
enum yukon_ex_rev {
CHIP_REV_YU_EX_A0 = 1,
@@ -2062,6 +2068,12 @@ static inline int sky2_is_copper(const s
return !(hw->pmd_type == 'L' || hw->pmd_type == 'S' || hw->pmd_type == 'P');
}
+static inline int sky2_is_gigabit(const struct sky2_hw *hw)
+{
+ return !(hw->chip_id == CHIP_ID_YUKON_FE
+ || hw->chip_id == CHIP_ID_YUKON_FE_P);
+}
+
/* Register accessor for memory mapped device */
static inline u32 sky2_read32(const struct sky2_hw *hw, unsigned reg)
{
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* Re: [ofa-general] Re: [PATCH V4 10/10] net/bonding: Destroy bonding master when last slave is gone
From: Jay Vosburgh @ 2007-08-29 19:50 UTC (permalink / raw)
To: Moni Shoua; +Cc: Moni Shoua, netdev, rdreier, davem, general
In-Reply-To: <46D57D5D.3060706@gmail.com>
Moni Shoua <monisonlists@gmail.com> wrote:
>Jay Vosburgh wrote:
>> Moni Shoua <monis@voltaire.com> wrote:
>>
>>> When bonding enslaves non Ethernet devices it takes pointers to functions
>>> in the module that owns the slaves. In this case it becomes unsafe
>>> to keep the bonding master registered after last slave was unenslaved
>>> because we don't know if the pointers are still valid. Destroying the bond when slave_cnt is zero
>>> ensures that these functions be used anymore.
>>
>> Would it not be simpler to run the bonding master through
>> ether_setup() again when the final slave is released (to reset all of
>> the pointers to their "ethernet" values)? I'm presuming here the
>> pointers of questionable validity are the ones set in the
>> bond_setup_by_slave() copied from the slave_dev->hard_header, et al.
>>
>> Having the bonding master disappear (but only sometimes) after
>> the last slave is removed is a semantic change I'd rather not introduce
>> if it's not necessary.
>
>Thanks for the comments.
>
>Having the master disappear is one way I could think of to solve the problem of leaving
>the bonding module with pointers to illegal addresses.
>The other way is to increase the usage count, with try_module_get(), of the module which owns of the slave.
>To do that I have to restore the field owner in structure net_device (it was removed in 2.6).
What I was asking above is really whether or not it's feasible
to simply reset the affected pointers back to the "ethernet" values from
ether_setup(). I would think this should return the bonding master back
to the original state it started in before any slaves were added.
Unless I'm missing something; I'm willing to believe there's some
IB-specific tidbit I'm unaware of that makes this more complicated than
it seems.
This presumes that I'm correct in thinking that the pointers
you're talking about (as being unsafe after removal of last slave) are
the ones copied in your new function bond_setup_by_slave().
I don't think it's desirable to acquire a reference to the slave
driver module.
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* [PATCH 0/0] sky2: update for 2.6.24
From: Stephen Hemminger @ 2007-08-29 19:39 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
This version includes some new features:
* support for new FE+ chips (not tested)
* use PCI functions. The only reason the driver
wasn't doing it was the advanced error bits weren't
accessbile on busted AMD chipsets without MMCONFIG
access.
* use PCI error recovery functions to access those
functions. If no mmconfig then driver has to ignore
PCI Express errors.
* provide receive skb timestamping in driver. This is
a big win because it saves an expensive time of day
access per packet.
Tested on most chips already.
It would be good to put these in -mm to catch any
early problems.
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* Re: [PATCH 4/5] Net: ath5k, license is GPLv2
From: Alan Cox @ 2007-08-29 19:45 UTC (permalink / raw)
To: Jon Smirl
Cc: Valdis.Kletnieks@vt.edu, Christoph Hellwig, Jiri Slaby, linville,
linux-kernel, linux-wireless, netdev
In-Reply-To: <9e4733910708291233h3c4022a9n6e46733c5c50e222@mail.gmail.com>
> Aren't patches made against the kernel GPL'd if the author doesn't
> explicitly grant them more liberal BSD license in addition?
That would be the normal assumption.
> The problem then comes in taking the patches that were only made
> available against GPL code and reshipping them under the BSD license
> without the author explicitly agreeing to this.
>
> What if a patch spans both code that is pure GPL and code imported
> from BSD, how do you license it?
See the acpi codebase for a worked example.
Alan
^ permalink raw reply
* Re: [PATCH 4/5] Net: ath5k, license is GPLv2
From: Michael Buesch @ 2007-08-29 19:37 UTC (permalink / raw)
To: Jon Smirl
Cc: Alan Cox, Valdis.Kletnieks-PjAqaU27lzQ@public.gmane.org,
Christoph Hellwig, Jiri Slaby, linville-2XuSBdqkA4R54TAoqtyWWQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <9e4733910708291233h3c4022a9n6e46733c5c50e222-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wednesday 29 August 2007 21:33:43 Jon Smirl wrote:
> What if a patch spans both code that is pure GPL and code imported
> from BSD, how do you license it?
I think it's a valid assumption, if we say that the author
of the patch read the license header of a file and agreed with it.
So the patch is licensed to whatever the fileheader says. And if
there's none, it's licensed with the COPYING terms.
If a patch author likes some other license conditions, he must
explicitely add them with the patch to the file, saying that this
and that part have these and those conditions. Of course they must
be compatible with the original license.
--
Greetings Michael.
^ permalink raw reply
* Re: [PATCH 4/5] Net: ath5k, license is GPLv2
From: Jon Smirl @ 2007-08-29 19:33 UTC (permalink / raw)
To: Alan Cox
Cc: Valdis.Kletnieks-PjAqaU27lzQ@public.gmane.org, Christoph Hellwig,
Jiri Slaby, linville-2XuSBdqkA4R54TAoqtyWWQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20070829192858.75aa6542-v58gJUvfdfWUJIigds3554dd74u8MsAO@public.gmane.org>
On 8/29/07, Alan Cox <alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org> wrote:
> > > to remove the BSD/other license. Jiri can release *his* code as GPLv2
> > > only, but I suspect the files as a whole really should be dual BSD/GPLv2,
> > > due to the numerous other stakeholders in those files.
> >
> > This mess has been occurring in the kernel for years. The DRM graphics
> > drivers are used in both BSD and Linux. It is quite easy to contribute
> > something to this code via LKML and think you are doing it under the
> > GPL. Doesn't a patch against the kernel have to be GPL? When these
> > patches get pulled back into BSD and distributed with it, did BSD get
> > infected with the GPL? AFAIK this has never been legally sorted out.
>
> I'm not aware anyone has felt it needed "sorting out". Its not exactly
> complicated.
>
> BSD non advertising is compatible with GPL
>
> The GPL says:
> "when you distribute the same sections as part of a whole which
> is a work based on the Program, the distribution of the whole
> must be on the terms of this License, "
>
> The BSD license doesn't conflict with that
>
> The GPL (and copyright law also say)
>
> "If identifiable sections of that work are not derived from the Program,
> and can be reasonably considered independent and separate works in
> themselves, then this License, and its terms, do not apply to ..."
>
> All a bit irrelevant anyway as Ath5K code (not the .h file) say:
>
> * Alternatively, this software may be distributed under the terms of the
> * GNU General Public License ("GPL") version 2 as published by the Free
> * Software Foundation.
>
> So Jiri is choosing to distribute it under the GPL, and with his changes
> GPL only.
>
> So whats the problem ?
BSD code can definitely be brought into a GPL project as you describe.
The problem is the other direction.
Aren't patches made against the kernel GPL'd if the author doesn't
explicitly grant them more liberal BSD license in addition?
The problem then comes in taking the patches that were only made
available against GPL code and reshipping them under the BSD license
without the author explicitly agreeing to this.
What if a patch spans both code that is pure GPL and code imported
from BSD, how do you license it?
--
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
^ permalink raw reply
* Re: [patch 0/1][RFC] add a private field to the sock structure
From: Arnaldo Carvalho de Melo @ 2007-08-29 19:18 UTC (permalink / raw)
To: David Miller; +Cc: dlezcano, netdev, ralf
In-Reply-To: <20070829.112316.98862875.davem@davemloft.net>
Em Wed, Aug 29, 2007 at 11:23:16AM -0700, David Miller escreveu:
> From: dlezcano@fr.ibm.com
> Date: Wed, 29 Aug 2007 18:41:14 +0200
>
> > When a socket is created it is sometime useful to store a specific information
> > for this socket.
> >
> > This information can be for examples:
> > * a creation time
> > * a pid
> > * a uid/gid
> > * a container identifier
> > * a pointer to a more specific structure
> > * ...
> >
> > The following patch is a proposition to add a private anonymous pointer
> > field to the common part of the sock structure.
>
> We got rid of the private field a long time ago because not only
> is it not needed, it tends to get abused.
Nah, it still there, sk_protinfo, its just ax25 that uses it
(nudge(Ralf)). How do we state that a struct field is deprecated and
will be removed soon(tm)?
There is another, sk_user_data, that is used only by the rpc, pppol2tp,
iscsi, ncpfs, smbfs and dlm guys, see? We need a deprecate flag for
sk_protinfo, if not people will use it! :-)
- Arnaldo
^ permalink raw reply
* Re: [patch 0/1][RFC] add a private field to the sock structure
From: David Miller @ 2007-08-29 18:23 UTC (permalink / raw)
To: dlezcano; +Cc: netdev
In-Reply-To: <20070829164114.868188182@f002726.toulouse-stg.fr.ibm.com>
From: dlezcano@fr.ibm.com
Date: Wed, 29 Aug 2007 18:41:14 +0200
> When a socket is created it is sometime useful to store a specific information
> for this socket.
>
> This information can be for examples:
> * a creation time
> * a pid
> * a uid/gid
> * a container identifier
> * a pointer to a more specific structure
> * ...
>
> The following patch is a proposition to add a private anonymous pointer
> field to the common part of the sock structure.
We got rid of the private field a long time ago because not only
is it not needed, it tends to get abused.
Find another way to implement your feature.
^ 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