* Re: [PATCH 4/9] cxgb4vf: Add code to provision T4 PCI-E SR-IOV Virtual Functions with hardware resources
From: Simon Horman @ 2010-06-29 0:51 UTC (permalink / raw)
To: Casey Leedom; +Cc: netdev
In-Reply-To: <201006280955.07352.leedom@chelsio.com>
On Mon, Jun 28, 2010 at 09:55:07AM -0700, Casey Leedom wrote:
> | From: Simon Horman <horms@verge.net.au>
> | Date: Saturday, June 26, 2010 06:37 am
> |
> | I wonder if it would be cleaner to move the guts of the last hunk
> | into a function (e.g. adap_init_sriov()) and have that be a dummy
> | function in the case that CONFIG_PCI_IOV in the first hunk is not set.
>
> I have no objection to this. I'd like to do minor tuning work like
> that as a follow on rather than respin the patch. But, as I said in my
> submission, I'm not familiar with this process so if making changes like
> the above is required I'll definitely jump on it. I don't know what
> issues are "critical show stoppers" and which ones are "nice to have"
> once things are in place.
I don't regard my suggestion as merge-critical.
^ permalink raw reply
* Re: IGB driver upgrade
From: Alexander Duyck @ 2010-06-29 0:00 UTC (permalink / raw)
To: sbs; +Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net
In-Reply-To: <AANLkTinUoQG4BWC4Q2UFDwGvAwYujlUXz6P-ZLkZozaQ@mail.gmail.com>
sbs wrote:
> Hello guys.
>
> Is it possible to upgrade intel gigabit adapter's e1000 driver to
> 2.2.9? This is the latest version according to Intel website.
>
I assume you are referring to the igb driver since that is what is in
the subject and not the e1000 driver correct?
> I've got a problem with 2.1.0-k2 drivers statically compiled into kernel.
>
> Surely I can download drivers from intel and compile it as module, but
> I need to compile it statically
> Intel drivers do not provide sources for static compilation :(
>
> Is it possible to upgrade drivers to igb-2.2.9 in the source tree and
> allow the static compilation of them?
>
Normally the upstream driver should be up to date with any fixes that
are in the standalone module. What version of the kernel are you
currently running? Also have your tried testing the older standalone
igb modules to see if the same issues exist there in either igb 2.1.9 or
igb 2.0.6? This would help us to determine what changes in the
standalone module might be missing from the in-kernel version of the driver.
> Because having 2.1.0-k2 we experience some strange random freezes with
> network interface which can be fixed only by restarting network.
>
> 2.2.9 module has no such problems but we need to use static kernels
> according to our policy.
I have CCed our e1000-devel list. In the future you may want to CC this
list as it will provide better visibility to the Intel wired networking
maintainers.
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Joakim Tjernlund @ 2010-06-28 23:30 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, shemminger
In-Reply-To: <20100628.145744.39186500.davem@davemloft.net>
David Miller <davem@davemloft.net> wrote on 2010/06/28 23:57:44:
>
> From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> Date: Mon, 28 Jun 2010 23:09:02 +0200
>
> > To me it "ifconfig eth0 down" means not only to stop using the I/F
> > but also any IP address associated with the I/F.
>
> IP addresses are associated with the host, not a particular interface.
>
> Therefore the state of the interface should not influence the behavior
> of the IP address.
>
> If you want the IP address to stop being responded to, delete the IP
> address.
This is an strict interpretation of the weak host model and does not
answer my questions. Mind to elaborate why such a strict view and
what is gained by answering on an IP address which has been "downed"?
What types of apps use this property?
Jocke
^ permalink raw reply
* Re: ss -p is much too slow
From: David Miller @ 2010-06-28 23:21 UTC (permalink / raw)
To: sphink; +Cc: netdev, stephen.hemminger
In-Reply-To: <AANLkTikd3VaSUa-pxzyi7_fND40vQ-L79X7yv19jj3y0@mail.gmail.com>
From: Steve Fink <sphink@gmail.com>
Date: Wed, 9 Jun 2010 11:42:38 -0700
> On closer inspection, it appears that ss -p does a quadratic scan. It
> rescans every entry in /proc/*/fd/* repeatedly (once per listening
> port? per process? I don't remember what I figured out.)
>
> I humbly suggest that this is not a good idea.
Yep, this is junk. Please give this patch a try:
ss: Avoid quadradic complexity with '-p'
Scan the process list of open sockets once, and store in a hash
table to be used by subsequent find_user() calls.
Reported-by: Steve Fink <sphink@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/misc/ss.c b/misc/ss.c
index 8a9663c..482b6bb 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -195,90 +195,147 @@ static FILE *ephemeral_ports_open(void)
return generic_proc_open("PROC_IP_LOCAL_PORT_RANGE", "sys/net/ipv4/ip_local_port_range");
}
-int find_users(unsigned ino, char *buf, int buflen)
+struct user_ent {
+ struct user_ent *next;
+ unsigned int ino;
+ int pid;
+ int fd;
+ char process[0];
+};
+
+#define USER_ENT_HASH_SIZE 256
+struct user_ent *user_ent_hash[USER_ENT_HASH_SIZE];
+
+static int user_ent_hashfn(unsigned int ino)
{
- char pattern[64];
- int pattern_len;
- char *ptr = buf;
- char name[1024];
- DIR *dir;
- struct dirent *d;
- int cnt = 0;
- int nameoff;
+ int val = (ino >> 24) ^ (ino >> 16) ^ (ino >> 8) ^ ino;
- if (!ino)
- return 0;
+ return val & (USER_ENT_HASH_SIZE - 1);
+}
+
+static void user_ent_add(unsigned int ino, const char *process, int pid, int fd)
+{
+ struct user_ent *p, **pp;
+ int str_len;
- sprintf(pattern, "socket:[%u]", ino);
- pattern_len = strlen(pattern);
+ str_len = strlen(process) + 1;
+ p = malloc(sizeof(struct user_ent) + str_len);
+ if (!p)
+ abort();
+ p->next = NULL;
+ p->ino = ino;
+ p->pid = pid;
+ p->fd = fd;
+ strcpy(p->process, process);
+
+ pp = &user_ent_hash[user_ent_hashfn(ino)];
+ p->next = *pp;
+ *pp = p;
+}
- strncpy(name, getenv("PROC_ROOT") ? : "/proc/", sizeof(name)/2);
- name[sizeof(name)/2] = 0;
- if (strlen(name) == 0 ||
- name[strlen(name)-1] != '/')
+static void user_ent_hash_build(void)
+{
+ const char *root = getenv("PROC_ROOT") ? : "/proc/";
+ struct dirent *d;
+ char name[1024];
+ int nameoff;
+ DIR *dir;
+
+ strcpy(name, root);
+ if (strlen(name) == 0 || name[strlen(name)-1] != '/')
strcat(name, "/");
+
nameoff = strlen(name);
- if ((dir = opendir(name)) == NULL)
- return 0;
+
+ dir = opendir(name);
+ if (!dir)
+ return;
while ((d = readdir(dir)) != NULL) {
- DIR *dir1;
struct dirent *d1;
- int pid;
- int pos;
- char crap;
char process[16];
+ int pid, pos;
+ DIR *dir1;
+ char crap;
if (sscanf(d->d_name, "%d%c", &pid, &crap) != 1)
continue;
- sprintf(name+nameoff, "%d/fd/", pid);
+ sprintf(name + nameoff, "%d/fd/", pid);
pos = strlen(name);
if ((dir1 = opendir(name)) == NULL)
continue;
- process[0] = 0;
+ process[0] = '\0';
while ((d1 = readdir(dir1)) != NULL) {
- int fd, n;
+ const char *pattern = "socket:[";
+ unsigned int ino;
char lnk[64];
+ int fd, n;
if (sscanf(d1->d_name, "%d%c", &fd, &crap) != 1)
continue;
sprintf(name+pos, "%d", fd);
n = readlink(name, lnk, sizeof(lnk)-1);
- if (n != pattern_len ||
- memcmp(lnk, pattern, n))
+ if (strncmp(lnk, pattern, strlen(pattern)))
continue;
- if (ptr-buf >= buflen-1)
- break;
+ sscanf(lnk, "socket:[%u]", &ino);
- if (process[0] == 0) {
+ if (process[0] == '\0') {
char tmp[1024];
FILE *fp;
- snprintf(tmp, sizeof(tmp), "%s/%d/stat",
- getenv("PROC_ROOT") ? : "/proc", pid);
+
+ snprintf(tmp, sizeof(tmp), "%s/%d/stat", root, pid);
if ((fp = fopen(tmp, "r")) != NULL) {
fscanf(fp, "%*d (%[^)])", process);
fclose(fp);
}
}
- snprintf(ptr, buflen-(ptr-buf), "(\"%s\",%d,%d),", process, pid, fd);
- ptr += strlen(ptr);
- cnt++;
+ user_ent_add(ino, process, pid, fd);
}
closedir(dir1);
}
closedir(dir);
+}
+
+int find_users(unsigned ino, char *buf, int buflen)
+{
+ struct user_ent *p;
+ int cnt = 0;
+ char *ptr;
+
+ if (!ino)
+ return 0;
+
+ p = user_ent_hash[user_ent_hashfn(ino)];
+ ptr = buf;
+ while (p) {
+ if (p->ino != ino)
+ goto next;
+
+ if (ptr - buf >= buflen - 1)
+ break;
+
+ snprintf(ptr, buflen - (ptr - buf),
+ "(\"%s\",%d,%d),",
+ p->process, p->pid, p->fd);
+ ptr += strlen(ptr);
+ cnt++;
+
+ next:
+ p = p->next;
+ }
+
if (ptr != buf)
- ptr[-1] = 0;
+ ptr[-1] = '\0';
+
return cnt;
}
-
/* Get stats from slab */
struct slabstat
@@ -2476,6 +2533,7 @@ int main(int argc, char *argv[])
break;
case 'p':
show_users++;
+ user_ent_hash_build();
break;
case 'd':
current_filter.dbs |= (1<<DCCP_DB);
^ permalink raw reply related
* Re: [PATCHv2] vhost-net: add dhclient work-around from userspace
From: Sridhar Samudrala @ 2010-06-28 22:19 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Aristeu Rozanski, Herbert Xu, Juan Quintela, David S. Miller, kvm,
virtualization, netdev, linux-kernel, ykaul, markmc
In-Reply-To: <20100628100807.GA30685@redhat.com>
On Mon, 2010-06-28 at 13:08 +0300, Michael S. Tsirkin wrote:
> Userspace virtio server has the following hack
> so guests rely on it, and we have to replicate it, too:
>
> Use port number to detect incoming IPv4 DHCP response packets,
> and fill in the checksum for these.
>
> The issue we are solving is that on linux guests, some apps
> that use recvmsg with AF_PACKET sockets, don't know how to
> handle CHECKSUM_PARTIAL;
> The interface to return the relevant information was added
> in 8dc4194474159660d7f37c495e3fc3f10d0db8cc,
> and older userspace does not use it.
> One important user of recvmsg with AF_PACKET is dhclient,
> so we add a work-around just for DHCP.
>
> Don't bother applying the hack to IPv6 as userspace virtio does not
> have a work-around for that - let's hope guests will do the right
> thing wrt IPv6.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Dave, I'm going to put this patch on the vhost tree,
> no need for you to bother merging it - you'll get
> it with a pull request.
>
>
> drivers/vhost/net.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 43 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index cc19595..03bba6a 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -24,6 +24,10 @@
> #include <linux/if_tun.h>
> #include <linux/if_macvlan.h>
>
> +#include <linux/ip.h>
> +#include <linux/udp.h>
> +#include <linux/netdevice.h>
> +
> #include <net/sock.h>
>
> #include "vhost.h"
> @@ -186,6 +190,44 @@ static void handle_tx(struct vhost_net *net)
> unuse_mm(net->dev.mm);
> }
>
> +static int peek_head(struct sock *sk)
This routine is doing more than just peeking the head of sk's receive
queue. May be this should be named similar to what qemu calls
'work_around_broken_dhclient()'
> +{
> + struct sk_buff *skb;
> +
> + lock_sock(sk);
> + skb = skb_peek(&sk->sk_receive_queue);
> + if (unlikely(!skb)) {
> + release_sock(sk);
> + return 0;
> + }
> + /* Userspace virtio server has the following hack so
> + * guests rely on it, and we have to replicate it, too: */
> + /* Use port number to detect incoming IPv4 DHCP response packets,
> + * and fill in the checksum. */
> +
> + /* The issue we are solving is that on linux guests, some apps
> + * that use recvmsg with AF_PACKET sockets, don't know how to
> + * handle CHECKSUM_PARTIAL;
> + * The interface to return the relevant information was added in
> + * 8dc4194474159660d7f37c495e3fc3f10d0db8cc,
> + * and older userspace does not use it.
> + * One important user of recvmsg with AF_PACKET is dhclient,
> + * so we add a work-around just for DHCP. */
> + if (skb->ip_summed == CHECKSUM_PARTIAL &&
> + skb_headlen(skb) >= skb_transport_offset(skb) +
> + sizeof(struct udphdr) &&
> + udp_hdr(skb)->dest == htons(68) &&
> + skb_network_header_len(skb) >= sizeof(struct iphdr) &&
> + ip_hdr(skb)->protocol == IPPROTO_UDP &&
> + skb->protocol == htons(ETH_P_IP)) {
Isn't it more logical to check for skb->protocol, followed by ip_hdr and
then udp_hdr?
> + skb_checksum_help(skb);
> + /* Restore ip_summed value: tun passes it to user. */
> + skb->ip_summed = CHECKSUM_PARTIAL;
> + }
> + release_sock(sk);
> + return 1;
> +}
> +
> /* Expects to be always run from workqueue - which acts as
> * read-size critical section for our kind of RCU. */
> static void handle_rx(struct vhost_net *net)
> @@ -222,7 +264,7 @@ static void handle_rx(struct vhost_net *net)
> vq_log = unlikely(vhost_has_feature(&net->dev, VHOST_F_LOG_ALL)) ?
> vq->log : NULL;
>
> - for (;;) {
> + while (peek_head(sock->sk)) {
> head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
> ARRAY_SIZE(vq->iov),
> &out, &in,
^ permalink raw reply
* Re: [linux-pm] [PATCH 3/3] pm_qos: get rid of the allocation in pm_qos_add_request()
From: James Bottomley @ 2010-06-28 22:10 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Takashi Iwai, netdev, linux-pm, markgross
In-Reply-To: <201006282359.18045.rjw@sisk.pl>
On Mon, 2010-06-28 at 23:59 +0200, Rafael J. Wysocki wrote:
> On Monday, June 28, 2010, James Bottomley wrote:
> > Since every caller has to squirrel away the returned pointer anyway,
> > they might as well supply the memory area. This fixes a bug in a few of
> > the call sites where the returned pointer was dereferenced without
> > checking it for NULL (which gets returned if the kzalloc failed).
> >
> > I'd like to hear how sound and netdev feels about this: it will add
> > about two more pointers worth of data to struct netdev and struct
> > snd_pcm_substream .. but I think it's worth it. If you're OK, I'll add
> > your acks and send through the pm tree.
> >
> > This also looks to me like an android independent clean up (even though
> > it renders the request_add atomically callable). I also added include
> > guards to include/linux/pm_qos_params.h
> >
> > cc: netdev@vger.kernel.org
> > cc: Takashi Iwai <tiwai@suse.de>
> > Signed-off-by: James Bottomley <James.Bottomley@suse.de>
>
> I like all of the patches in this series, thanks a lot for doing this!
>
> I guess it might be worth sending a CC to the LKML next round so that people
> can see [1/3] (I don't expect any objections, but anyway it would be nice).
I cc'd the latest owners of plist.h ... although Daniel Walker has
apparently since left MontaVista, Thomas Gleixner is still current ...
and he can speak for the RT people, who are the primary plist users.
I can do another round and cc lkml, I was just hoping this would be the
last revision.
James
^ permalink raw reply
* Re: IGB driver upgrade
From: sbs @ 2010-06-28 22:02 UTC (permalink / raw)
To: netdev
In-Reply-To: <AANLkTim6kfnr6yNeUXlLHOztB-qjyvj50D4p7nebqj9r@mail.gmail.com>
Hello guys.
Is it possible to upgrade intel gigabit adapter's e1000 driver to
2.2.9? This is the latest version according to Intel website.
I've got a problem with 2.1.0-k2 drivers statically compiled into kernel.
Surely I can download drivers from intel and compile it as module, but
I need to compile it statically
Intel drivers do not provide sources for static compilation :(
Is it possible to upgrade drivers to igb-2.2.9 in the source tree and
allow the static compilation of them?
Because having 2.1.0-k2 we experience some strange random freezes with
network interface which can be fixed only by restarting network.
2.2.9 module has no such problems but we need to use static kernels
according to our policy.
^ permalink raw reply
* Re: [linux-pm] [PATCH 3/3] pm_qos: get rid of the allocation in pm_qos_add_request()
From: Rafael J. Wysocki @ 2010-06-28 21:59 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-pm, Takashi Iwai, netdev, markgross
In-Reply-To: <1277747088.10879.201.camel@mulgrave.site>
On Monday, June 28, 2010, James Bottomley wrote:
> Since every caller has to squirrel away the returned pointer anyway,
> they might as well supply the memory area. This fixes a bug in a few of
> the call sites where the returned pointer was dereferenced without
> checking it for NULL (which gets returned if the kzalloc failed).
>
> I'd like to hear how sound and netdev feels about this: it will add
> about two more pointers worth of data to struct netdev and struct
> snd_pcm_substream .. but I think it's worth it. If you're OK, I'll add
> your acks and send through the pm tree.
>
> This also looks to me like an android independent clean up (even though
> it renders the request_add atomically callable). I also added include
> guards to include/linux/pm_qos_params.h
>
> cc: netdev@vger.kernel.org
> cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
I like all of the patches in this series, thanks a lot for doing this!
I guess it might be worth sending a CC to the LKML next round so that people
can see [1/3] (I don't expect any objections, but anyway it would be nice).
Thanks,
Rafael
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Joakim Tjernlund @ 2010-06-28 21:58 UTC (permalink / raw)
To: Mitchell Erblich; +Cc: David Miller, Eric Dumazet, netdev, Stephen Hemminger
In-Reply-To: <D1C84781-4EC6-42D0-AE3E-258BE8BAA4BC@earthlink.net>
Mitchell Erblich <erblichs@earthlink.net> wrote on 2010/06/28 23:28:29:
>
>
> On Jun 28, 2010, at 2:09 PM, Joakim Tjernlund wrote:
>
> > Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/06/28 21:42:01:
> >>
> >> Le lundi 28 juin 2010 à 21:03 +0200, Joakim Tjernlund a écrit :
> >>> Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
> >>>>
> >>>> When Linux is used as a router, it is undesirable for the kernel to process
> >>>> incoming packets when the address assigned to the interface is down.
> >>>> The initial problem report was for a management application that used ICMP
> >>>> to check link availability.
> >>>>
> >>>> The default is disabled to maintain compatibility with previous behavior.
> >>>> This is not recommended for server systems because it makes fail over more
> >>>> difficult, and does not account for configurations where multiple interfaces
> >>>> have the same IP address.
> >>>>
> >>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >>>
> >>> Ping David et. all?
> >>> I too want this.
> >>
> >> You probably missed David reply
> >>
> >> http://permalink.gmane.org/gmane.linux.network/164494
> >
> > Sure did, don't know how that happened, sorry.
> >
> > Reading David's reply I do wonder about the current behaviour. Why
> > is it so important to keep responding to an IP address when the
> > admin has put the interface holding that IP address into administratively
> > down state? I don't think the weak host model stipulates that it must be so, does it?
> >
> > To me it "ifconfig eth0 down" means not only to stop using the I/F but
> > also any IP address associated with the I/F. I was rather surprised that
> > it didn't work that way. I don't see any way to make Linux stop responding to
> > that IP other that removing it completely from the system, which is rather
> > awkward.
> >
> > Note, I don't mean that the same should be applied for the No Carrier case, just
> > ifconfig down.
> >
> > Jocke
> >
> >
> > --
> > 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
>
> Hey guys, isn't the support of magic pkts/ Energy star require the receipt
> of pkts while the intf is down?
No idea, but if so, does it need to process IP pkgs destined for
the IP address in question and pass these up to user space?
Jocke
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: David Miller @ 2010-06-28 21:57 UTC (permalink / raw)
To: joakim.tjernlund; +Cc: eric.dumazet, netdev, shemminger
In-Reply-To: <OF0640B724.BFF8DEB7-ONC1257750.00728ECF-C1257750.00742EFA@transmode.se>
From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Date: Mon, 28 Jun 2010 23:09:02 +0200
> To me it "ifconfig eth0 down" means not only to stop using the I/F
> but also any IP address associated with the I/F.
IP addresses are associated with the host, not a particular interface.
Therefore the state of the interface should not influence the behavior
of the IP address.
If you want the IP address to stop being responded to, delete the IP
address.
^ permalink raw reply
* Re: b44: Reset due to FIFO overflow.
From: James Courtier-Dutton @ 2010-06-28 21:37 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1277723471.4235.393.camel@edumazet-laptop>
On 28 June 2010 12:11, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le lundi 28 juin 2010 à 11:24 +0100, James Courtier-Dutton a écrit :
>> On 28 June 2010 10:13, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> >
>> > Hi
>> >
>> > Problem is we dont know if a Receive Fifo overflow is a minor or major
>> > indication from b44 chip.
>> >
>> > A minor indication would be : Chip tells us one or more frame were lost.
>> > No special action needed from driver.
>> >
>> > A major indication (as of current implemented in b44 driver) is :
>> > I am completely out of order and need a reset. Please do it.
>> >
>> > Patch to switch from major to minor indication is easy, but we dont know
>> > if its valid or not.
>> >
>> > diff --git a/drivers/net/b44.h b/drivers/net/b44.h
>> > index e1905a4..514dc3a 100644
>> > --- a/drivers/net/b44.h
>> > +++ b/drivers/net/b44.h
>> > @@ -42,7 +42,7 @@
>> > #define ISTAT_EMAC 0x04000000 /* EMAC Interrupt */
>> > #define ISTAT_MII_WRITE 0x08000000 /* MII Write Interrupt */
>> > #define ISTAT_MII_READ 0x10000000 /* MII Read Interrupt */
>> > -#define ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_RFO|ISTAT_TFU)
>> > +#define ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_TFU)
>> > #define B44_IMASK 0x0024UL /* Interrupt Mask */
>> > #define IMASK_DEF (ISTAT_ERRORS | ISTAT_TO | ISTAT_RX | ISTAT_TX)
>> > #define B44_GPTIMER 0x0028UL /* General Purpose Timer */
>> >
>> >
>> >
>>
>> Ok, are you saying that all I have to do is apply this patch,
>> reproduce the problem condition, and if it recovers OK, then we can go
>> with this fix?
>> If so, I will try it out after work.
>>
>
> Yes, please try the patch and tell us what happens.
>
> Note : It can be better, it can be worse.
>
> It can work on your b44 chip, and freeze another computer with another
> b44 chip. Use at your own risk.
>
I tried the patch.
I also tried without the patch, but bypassed the hw reset in the RFO case.
In both cases, the hardware did not recover from the overflow.
An "ifconfig eth0 down" then "ifconfig eth0 up" was required to bring
it back to life, I.e. A manual hw reset.
What I did find is that once the RFO state is reached, it is not cleared.
I think we need to find a way to clear the RFO state.
The RFO state is cleared after a HW reset.
Kind Regards
James
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Mitchell Erblich @ 2010-06-28 21:28 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Eric Dumazet, David Miller, netdev, Stephen Hemminger
In-Reply-To: <OF0640B724.BFF8DEB7-ONC1257750.00728ECF-C1257750.00742EFA@transmode.se>
On Jun 28, 2010, at 2:09 PM, Joakim Tjernlund wrote:
> Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/06/28 21:42:01:
>>
>> Le lundi 28 juin 2010 à 21:03 +0200, Joakim Tjernlund a écrit :
>>> Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
>>>>
>>>> When Linux is used as a router, it is undesirable for the kernel to process
>>>> incoming packets when the address assigned to the interface is down.
>>>> The initial problem report was for a management application that used ICMP
>>>> to check link availability.
>>>>
>>>> The default is disabled to maintain compatibility with previous behavior.
>>>> This is not recommended for server systems because it makes fail over more
>>>> difficult, and does not account for configurations where multiple interfaces
>>>> have the same IP address.
>>>>
>>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>>>
>>> Ping David et. all?
>>> I too want this.
>>
>> You probably missed David reply
>>
>> http://permalink.gmane.org/gmane.linux.network/164494
>
> Sure did, don't know how that happened, sorry.
>
> Reading David's reply I do wonder about the current behaviour. Why
> is it so important to keep responding to an IP address when the
> admin has put the interface holding that IP address into administratively
> down state? I don't think the weak host model stipulates that it must be so, does it?
>
> To me it "ifconfig eth0 down" means not only to stop using the I/F but
> also any IP address associated with the I/F. I was rather surprised that
> it didn't work that way. I don't see any way to make Linux stop responding to
> that IP other that removing it completely from the system, which is rather
> awkward.
>
> Note, I don't mean that the same should be applied for the No Carrier case, just
> ifconfig down.
>
> Jocke
>
>
> --
> 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
Hey guys, isn't the support of magic pkts/ Energy star require the receipt
of pkts while the intf is down?
Mitchell Erblich
^ permalink raw reply
* [patch] isdn/gigaset: add a kfree() to error path
From: Dan Carpenter @ 2010-06-28 21:20 UTC (permalink / raw)
To: Hansjoerg Lipp
Cc: Tilman Schmidt, Karsten Keil, David S. Miller, gigaset307x-common,
netdev, kernel-janitors
We should free "commands" here. The main reason is to please the static
checkers.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index f01c3c2..f1abb8f 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -419,6 +419,7 @@ oom:
dev_err(bcs->cs->dev, "out of memory\n");
for (i = 0; i < AT_NUM; ++i)
kfree(commands[i]);
+ kfree(commands);
return -ENOMEM;
}
^ permalink raw reply related
* [patch] cpmac: use resource_size()
From: Dan Carpenter @ 2010-06-28 21:19 UTC (permalink / raw)
To: Florian Fainelli
Cc: David S. Miller, Jiri Pirko, Eric Dumazet, netdev,
kernel-janitors
The original code is off by one because we should start counting at
zero. So the size of the resource is end - start + 1. I switched it to
use resource_size() to do the calculation.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I don't have a cross compile environment, so I can't even compile test
this. Sorry.
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 23786ee..38de1a4 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -964,7 +964,7 @@ static int cpmac_open(struct net_device *dev)
struct sk_buff *skb;
mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
- if (!request_mem_region(mem->start, mem->end - mem->start, dev->name)) {
+ if (!request_mem_region(mem->start, resource_size(mem), dev->name)) {
if (netif_msg_drv(priv))
printk(KERN_ERR "%s: failed to request registers\n",
dev->name);
@@ -972,7 +972,7 @@ static int cpmac_open(struct net_device *dev)
goto fail_reserve;
}
- priv->regs = ioremap(mem->start, mem->end - mem->start);
+ priv->regs = ioremap(mem->start, resource_size(mem));
if (!priv->regs) {
if (netif_msg_drv(priv))
printk(KERN_ERR "%s: failed to remap registers\n",
@@ -1049,7 +1049,7 @@ fail_alloc:
iounmap(priv->regs);
fail_remap:
- release_mem_region(mem->start, mem->end - mem->start);
+ release_mem_region(mem->start, resource_size(mem));
fail_reserve:
return res;
@@ -1077,7 +1077,7 @@ static int cpmac_stop(struct net_device *dev)
free_irq(dev->irq, dev);
iounmap(priv->regs);
mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
- release_mem_region(mem->start, mem->end - mem->start);
+ release_mem_region(mem->start, resource_size(mem));
priv->rx_head = &priv->desc_ring[CPMAC_QUEUES];
for (i = 0; i < priv->ring_size; i++) {
if (priv->rx_head[i].skb) {
^ permalink raw reply related
* Re: b44: Reset due to FIFO overflow.
From: Mitchell Erblich @ 2010-06-28 21:21 UTC (permalink / raw)
To: Eric Dumazet; +Cc: James Courtier-Dutton, netdev
In-Reply-To: <1277723370.4235.388.camel@edumazet-laptop>
On Jun 28, 2010, at 4:09 AM, Eric Dumazet wrote:
> Le lundi 28 juin 2010 à 11:17 +0100, James Courtier-Dutton a écrit :
>> On 28 June 2010 11:00, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>>
>>> Problem is we receive a spike of RX network frames (possibly UDP or some
>>> other RX only trafic), and chip raises an RX fifo overflow _error_
>>> indication.
>>>
IMO, spikes are a normal behaviour.
>>
>> The cause of the RX overflow is in my case is TCP.
>> It is reproducible in mythtv.
>> While watching LiveTV, press "s" for the program guide.
>> The program guide is implemented into mythtv by a SQL query that
>> results in a large response.
>> The kernel is probably not servicing the RX FIFO quickly enough due to
>> it being busy doing something else. In this case, probably a video
>> mode switch.
>>
>
> Thats strange, b44 has a big RX ring... and tcp sender should wait for
> ACK...
>
Slow start, etc SHOULD/CAN double the number of in-flight segments in each
next round-trip, placing them back to back.
IMO, a stress test, would be a large number/wirespeed set of pings?
>>> Some hardware are buggy enough that such error indication is fatal and
>>> _require_ hardware reset. Thats life. I suspect b44 driver doing a full
>>> reset is not a random guess from driver author, but to avoid a complete
>>> NIC lockup.
>>>
>>
>> Interesting, which hardware, apart from the b44, is it that "requires"
>> a hardware reset after a RX FIFO overflow.
>
> Just take a look at some net drivers and you'll see some of them have
> this requirement.
>
> rtl8169_rx_interrupt()
> ...
> if (status & RxFOVF) {
> rtl8169_schedule_work(dev, rtl8169_reset_task);
> dev->stats.rx_fifo_errors++;
> }
>
>
>
>
If they can reset in say X frame loss units, then why not reset if
X is an acceptable number?
And a hammer may fix the dent, while I may be more
interested in preventing the dent in the first place.
Mitchell Erblich
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Joakim Tjernlund @ 2010-06-28 21:09 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Stephen Hemminger
In-Reply-To: <1277754121.4235.673.camel@edumazet-laptop>
Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/06/28 21:42:01:
>
> Le lundi 28 juin 2010 à 21:03 +0200, Joakim Tjernlund a écrit :
> > Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
> > >
> > > When Linux is used as a router, it is undesirable for the kernel to process
> > > incoming packets when the address assigned to the interface is down.
> > > The initial problem report was for a management application that used ICMP
> > > to check link availability.
> > >
> > > The default is disabled to maintain compatibility with previous behavior.
> > > This is not recommended for server systems because it makes fail over more
> > > difficult, and does not account for configurations where multiple interfaces
> > > have the same IP address.
> > >
> > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> > Ping David et. all?
> > I too want this.
>
> You probably missed David reply
>
> http://permalink.gmane.org/gmane.linux.network/164494
Sure did, don't know how that happened, sorry.
Reading David's reply I do wonder about the current behaviour. Why
is it so important to keep responding to an IP address when the
admin has put the interface holding that IP address into administratively
down state? I don't think the weak host model stipulates that it must be so, does it?
To me it "ifconfig eth0 down" means not only to stop using the I/F but
also any IP address associated with the I/F. I was rather surprised that
it didn't work that way. I don't see any way to make Linux stop responding to
that IP other that removing it completely from the system, which is rather
awkward.
Note, I don't mean that the same should be applied for the No Carrier case, just
ifconfig down.
Jocke
^ permalink raw reply
* Re: [RFC][BUG-FIX] the problem of checksum checking in UDP protocol
From: Eric Dumazet @ 2010-06-28 20:38 UTC (permalink / raw)
To: Shan Wei; +Cc: David Miller, Ronciak, John, netdev
In-Reply-To: <4C287E40.40906@cn.fujitsu.com>
Le lundi 28 juin 2010 à 18:49 +0800, Shan Wei a écrit :
> Eric Dumazet wrote, at 06/26/2010 01:28 PM:
> >> (This patch is not complete, it's just for my idea.)
> >> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> >> index 1dd1aff..47f7e86 100644
> >> --- a/net/ipv6/udp.c
> >> +++ b/net/ipv6/udp.c
> >> @@ -723,6 +723,10 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
> >> if (ulen < skb->len) {
> >> if (pskb_trim_rcsum(skb, ulen))
> >> goto short_packet;
> >> +
> >> + if (skb_csum_unnecessary(skb))
> >> + skb->ip_summed = CHECKSUM_NONE;
> >> +
> >> saddr = &ipv6_hdr(skb)->saddr;
> >> daddr = &ipv6_hdr(skb)->daddr;
> >> uh = udp_hdr(skb);
> >>
> >
> > I really dont know if this fix is the right one.
> >
> > pskb_trim_rcsum() already contains a check. Should this check be changed
> > to include yours ?
>
> Oh..... I don't think so.
> pskb_trim_rcsum() is also used when IPv4/IPv6 protocol receiving packets
> and reassembling fragments. IP protocol does the right check and should
> trust CHECKSUM_UNNECESSARY flag that drivers set, So we no need to
> change IP protocol.
> If we add the skb_csum_unnecessary(skb) check into pskb_trim_rcsum() and
> reset ip_summed with CHECKSUM_NONE, the checksum check that NIC hardward
> has done is wasted.
>
> Only for UDP protocol over IPv4/IPv6, and length parameter is lower than
> skb->len, We reset ip_summed with CHECKSUM_NONE.
>
>
I read RFC 768 again, and cannot tell if your patch is ever needed.
NIC validated the UDP checksum including the whole IP data length, not
the udp length.
Linux kernel computes checksum using udp.length, not ip.length, because
only udp.length is delivered to application anyway. Extra padding is
meaningless.
RFC 768 author didnt asserted ip.length = udp.length + 8
Both implementations are RFC compliant, but may have different results
with special hand crafted packets.
You add a test for a non issue, my analysis is we should not care at
all, unless you have another valid point (security ???)
If a change is needed, I would vote for a change in NIC firmware,
because RFC 768 gives following pseudo header :
0 7 8 15 16 23 24 31
+--------+--------+--------+--------+
| source address |
+--------+--------+--------+--------+
| destination address |
+--------+--------+--------+--------+
| zero |protocol| UDP length |
+--------+--------+--------+--------+
Note it mentions UDP length, not IP length.
If NIC reports UDP check sum was verified, it should have used UDP length as well.
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Eric Dumazet @ 2010-06-28 19:42 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Stephen Hemminger, David Miller, netdev
In-Reply-To: <OF62B30BCC.F8523B86-ONC1257750.00687496-C1257750.0068AA27@transmode.se>
Le lundi 28 juin 2010 à 21:03 +0200, Joakim Tjernlund a écrit :
> Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
> >
> > When Linux is used as a router, it is undesirable for the kernel to process
> > incoming packets when the address assigned to the interface is down.
> > The initial problem report was for a management application that used ICMP
> > to check link availability.
> >
> > The default is disabled to maintain compatibility with previous behavior.
> > This is not recommended for server systems because it makes fail over more
> > difficult, and does not account for configurations where multiple interfaces
> > have the same IP address.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Ping David et. all?
> I too want this.
You probably missed David reply
http://permalink.gmane.org/gmane.linux.network/164494
^ permalink raw reply
* Re: [PATCH linux-2.6.35-rc3] micrel phy driver
From: Ben Hutchings @ 2010-06-28 19:23 UTC (permalink / raw)
To: Choi, David; +Cc: netdev
In-Reply-To: <C43529A246480145B0A6D0234BDB0F0D0212A2@MELANITE.micrel.com>
On Mon, 2010-06-28 at 11:51 -0700, Choi, David wrote:
[...]
> @@ -106,8 +233,12 @@ MODULE_LICENSE("GPL");
>
> static struct mdio_device_id micrel_tbl[] = {
> { PHY_ID_KSZ9021, 0x000fff10 },
> - { PHY_ID_VSC8201, 0x00fffff0 },
> { PHY_ID_KS8001, 0x00fffff0 },
> + { PHY_ID_KSZ9021, 0x000fff10 },
> + { PHY_ID_KS8001, 0x00fffff0 },
> + { PHY_ID_KS8737, 0x00fffff0 },
> + { PHY_ID_KS8041, 0x00fffff0 },
> + { PHY_ID_KS8051, 0x00fffff0 },
> { }
> };
You're duplicating the device IDs for KSZ9021 and KS8001.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
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 net-next-2.6] ipv4: sysctl to block responding on down interface
From: Joakim Tjernlund @ 2010-06-28 19:03 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20100611084854.0680c014@nehalam>
Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
>
> When Linux is used as a router, it is undesirable for the kernel to process
> incoming packets when the address assigned to the interface is down.
> The initial problem report was for a management application that used ICMP
> to check link availability.
>
> The default is disabled to maintain compatibility with previous behavior.
> This is not recommended for server systems because it makes fail over more
> difficult, and does not account for configurations where multiple interfaces
> have the same IP address.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Ping David et. all?
I too want this.
Jocke
^ permalink raw reply
* [PATCH linux-2.6.35-rc3] micrel phy driver
From: Choi, David @ 2010-06-28 18:51 UTC (permalink / raw)
To: netdev
Hello David Miller
From: David J. Choi <david.choi@micrel.com>
Body of the explanation: This patch has changes as followings;
-support the interrupt from phy devices from Micrel Inc.
-support more phy devices, ks8737, ks8721, ks8041, ks8051 from Micrel.
-remove vsc8201 because this device was used only internal test at Micrel.
Signed-off-by: David J. Choi <david.choi@micrel.com>
---
--- linux-2.6.35-rc3/drivers/net/phy/micrel.c.orig 2010-06-11 19:14:04.000000000 -0700
+++ linux-2.6.35-rc3/drivers/net/phy/micrel.c 2010-06-28 09:53:37.000000000 -0700
@@ -12,7 +12,8 @@
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
- * Support : ksz9021 , vsc8201, ks8001
+ * Support : ksz9021 1000/100/10 phy from Micrel
+ * ks8001, ks8737, ks8721, ks8041, ks8051 100/10 phy
*/
#include <linux/kernel.h>
@@ -20,37 +21,146 @@
#include <linux/phy.h>
#define PHY_ID_KSZ9021 0x00221611
-#define PHY_ID_VSC8201 0x000FC413
+#define PHY_ID_KS8737 0x00221720
+#define PHY_ID_KS8041 0x00221510
+#define PHY_ID_KS8051 0x00221550
+/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
#define PHY_ID_KS8001 0x0022161A
+/* general Interrupt control/status reg in vendor specific block. */
+#define MII_KSZPHY_INTCS 0x1B
+#define KSZPHY_INTCS_JABBER (1 << 15)
+#define KSZPHY_INTCS_RECEIVE_ERR (1 << 14)
+#define KSZPHY_INTCS_PAGE_RECEIVE (1 << 13)
+#define KSZPHY_INTCS_PARELLEL (1 << 12)
+#define KSZPHY_INTCS_LINK_PARTNER_ACK (1 << 11)
+#define KSZPHY_INTCS_LINK_DOWN (1 << 10)
+#define KSZPHY_INTCS_REMOTE_FAULT (1 << 9)
+#define KSZPHY_INTCS_LINK_UP (1 << 8)
+#define KSZPHY_INTCS_ALL (KSZPHY_INTCS_LINK_UP |\
+ KSZPHY_INTCS_LINK_DOWN)
+
+/* general PHY control reg in vendor specific block. */
+#define MII_KSZPHY_CTRL 0x1F
+/* bitmap of PHY register to set interrupt mode */
+#define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9)
+#define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14)
+#define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14)
+
+static int kszphy_ack_interrupt(struct phy_device *phydev)
+{
+ /* bit[7..0] int status, which is a read and clear register. */
+ int rc;
+
+ rc = phy_read(phydev, MII_KSZPHY_INTCS);
+
+ return (rc < 0) ? rc : 0;
+}
+
+static int kszphy_set_interrupt(struct phy_device *phydev)
+{
+ int temp;
+ temp = (PHY_INTERRUPT_ENABLED == phydev->interrupts) ?
+ KSZPHY_INTCS_ALL : 0;
+ return phy_write(phydev, MII_KSZPHY_INTCS, temp);
+}
+
+static int kszphy_config_intr(struct phy_device *phydev)
+{
+ int temp, rc;
+
+ /* set the interrupt pin active low */
+ temp = phy_read(phydev, MII_KSZPHY_CTRL);
+ temp &= ~KSZPHY_CTRL_INT_ACTIVE_HIGH;
+ phy_write(phydev, MII_KSZPHY_CTRL, temp);
+ rc = kszphy_set_interrupt(phydev);
+ return rc < 0 ? rc : 0;
+}
+
+static int ksz9021_config_intr(struct phy_device *phydev)
+{
+ int temp, rc;
+
+ /* set the interrupt pin active low */
+ temp = phy_read(phydev, MII_KSZPHY_CTRL);
+ temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH;
+ phy_write(phydev, MII_KSZPHY_CTRL, temp);
+ rc = kszphy_set_interrupt(phydev);
+ return rc < 0 ? rc : 0;
+}
+
+static int ks8737_config_intr(struct phy_device *phydev)
+{
+ int temp, rc;
+
+ /* set the interrupt pin active low */
+ temp = phy_read(phydev, MII_KSZPHY_CTRL);
+ temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH;
+ phy_write(phydev, MII_KSZPHY_CTRL, temp);
+ rc = kszphy_set_interrupt(phydev);
+ return rc < 0 ? rc : 0;
+}
static int kszphy_config_init(struct phy_device *phydev)
{
return 0;
}
+static struct phy_driver ks8737_driver = {
+ .phy_id = PHY_ID_KS8737,
+ .phy_id_mask = 0x00fffff0,
+ .name = "Micrel KS8737",
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = ks8737_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+};
+
+static struct phy_driver ks8041_driver = {
+ .phy_id = PHY_ID_KS8041,
+ .phy_id_mask = 0x00fffff0,
+ .name = "Micrel KS8041",
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+};
-static struct phy_driver ks8001_driver = {
- .phy_id = PHY_ID_KS8001,
- .name = "Micrel KS8001",
+static struct phy_driver ks8051_driver = {
+ .phy_id = PHY_ID_KS8051,
.phy_id_mask = 0x00fffff0,
- .features = PHY_BASIC_FEATURES,
- .flags = PHY_POLL,
+ .name = "Micrel KS8051",
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
.driver = { .owner = THIS_MODULE,},
};
-static struct phy_driver vsc8201_driver = {
- .phy_id = PHY_ID_VSC8201,
- .name = "Micrel VSC8201",
+static struct phy_driver ks8001_driver = {
+ .phy_id = PHY_ID_KS8001,
+ .name = "Micrel KS8001 or KS8721",
.phy_id_mask = 0x00fffff0,
- .features = PHY_BASIC_FEATURES,
- .flags = PHY_POLL,
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
.driver = { .owner = THIS_MODULE,},
};
@@ -58,11 +168,14 @@ static struct phy_driver ksz9021_driver
.phy_id = PHY_ID_KSZ9021,
.phy_id_mask = 0x000fff10,
.name = "Micrel KSZ9021 Gigabit PHY",
- .features = PHY_GBIT_FEATURES | SUPPORTED_Pause,
- .flags = PHY_POLL,
+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = ksz9021_config_intr,
.driver = { .owner = THIS_MODULE, },
};
@@ -73,17 +186,29 @@ static int __init ksphy_init(void)
ret = phy_driver_register(&ks8001_driver);
if (ret)
goto err1;
- ret = phy_driver_register(&vsc8201_driver);
+
+ ret = phy_driver_register(&ksz9021_driver);
if (ret)
goto err2;
- ret = phy_driver_register(&ksz9021_driver);
+ ret = phy_driver_register(&ks8737_driver);
if (ret)
goto err3;
+ ret = phy_driver_register(&ks8041_driver);
+ if (ret)
+ goto err4;
+ ret = phy_driver_register(&ks8051_driver);
+ if (ret)
+ goto err5;
+
return 0;
+err5:
+ phy_driver_unregister(&ks8041_driver);
+err4:
+ phy_driver_unregister(&ks8737_driver);
err3:
- phy_driver_unregister(&vsc8201_driver);
+ phy_driver_unregister(&ksz9021_driver);
err2:
phy_driver_unregister(&ks8001_driver);
err1:
@@ -93,8 +218,10 @@ err1:
static void __exit ksphy_exit(void)
{
phy_driver_unregister(&ks8001_driver);
- phy_driver_unregister(&vsc8201_driver);
+ phy_driver_unregister(&ks8737_driver);
phy_driver_unregister(&ksz9021_driver);
+ phy_driver_unregister(&ks8041_driver);
+ phy_driver_unregister(&ks8051_driver);
}
module_init(ksphy_init);
@@ -106,8 +233,12 @@ MODULE_LICENSE("GPL");
static struct mdio_device_id micrel_tbl[] = {
{ PHY_ID_KSZ9021, 0x000fff10 },
- { PHY_ID_VSC8201, 0x00fffff0 },
{ PHY_ID_KS8001, 0x00fffff0 },
+ { PHY_ID_KSZ9021, 0x000fff10 },
+ { PHY_ID_KS8001, 0x00fffff0 },
+ { PHY_ID_KS8737, 0x00fffff0 },
+ { PHY_ID_KS8041, 0x00fffff0 },
+ { PHY_ID_KS8051, 0x00fffff0 },
{ }
};
---
^ permalink raw reply
* static inline int xfrm_mark_get() broken
From: Andreas Steffen @ 2010-06-28 18:46 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 761 bytes --]
Hi,
experimenting with the new XFRM_MARK feature of the 2.6.34 kernel
I found out that the extraction of the mark mask might accidentally
work on 64 bit platforms but on 32 bit platforms the function is
awfully broken. The rather trivial patch attached to this mail fixes
the problem. Otherwise the XFRM_MARK feature seems quite promising!
Best regards
Andreas
======================================================================
Andreas Steffen e-mail: andreas.steffen@hsr.ch
Institute for Internet Technologies and Applications
Hochschule fuer Technik Rapperswil phone: +41 55 222 42 68
CH-8640 Rapperswil (Switzerland) mobile: +41 76 340 25 56
===========================================================[ITA-HSR]==
[-- Attachment #2: xfrm.h.diff --]
[-- Type: text/x-patch, Size: 413 bytes --]
--- linux/include/net/xfrm.h.ori 2010-06-28 18:53:28.229489876 +0200
+++ linux/include/net/xfrm.h 2010-06-28 18:53:50.745487383 +0200
@@ -1587,7 +1587,7 @@
static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
{
if (attrs[XFRMA_MARK])
- memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m));
+ memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
else
m->v = m->m = 0;
^ permalink raw reply
* [PATCH net-2.6 2/2] ethtool: Fix potential user buffer overflow for ETHTOOL_{G,S}RXFH
From: Ben Hutchings @ 2010-06-28 18:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Santwona Behera
In-Reply-To: <1277750647.2089.19.camel@achroite.uk.solarflarecom.com>
struct ethtool_rxnfc was originally defined in 2.6.27 for the
ETHTOOL_{G,S}RXFH command with only the cmd, flow_type and data
fields. It was then extended in 2.6.30 to support various additional
commands. These commands should have been defined to use a new
structure, but it is too late to change that now.
Since user-space may still be using the old structure definition
for the ETHTOOL_{G,S}RXFH commands, and since they do not need the
additional fields, only copy the originally defined fields to and
from user-space.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
---
include/linux/ethtool.h | 2 ++
net/core/ethtool.c | 36 +++++++++++++++++++++++++++---------
2 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 2c8af09..07f9808 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -379,6 +379,8 @@ struct ethtool_rxnfc {
__u32 flow_type;
/* The rx flow hash value or the rule DB size */
__u64 data;
+ /* The following fields are not valid and must not be used for
+ * the ETHTOOL_{G,X}RXFH commands. */
struct ethtool_rx_flow_spec fs;
__u32 rule_cnt;
__u32 rule_locs[0];
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index a3a7e9a..75e4ffe 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -318,23 +318,33 @@ out:
}
static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
- void __user *useraddr)
+ u32 cmd, void __user *useraddr)
{
- struct ethtool_rxnfc cmd;
+ struct ethtool_rxnfc info;
+ size_t info_size = sizeof(info);
if (!dev->ethtool_ops->set_rxnfc)
return -EOPNOTSUPP;
- if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
+ /* struct ethtool_rxnfc was originally defined for
+ * ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
+ * members. User-space might still be using that
+ * definition. */
+ if (cmd == ETHTOOL_SRXFH)
+ info_size = (offsetof(struct ethtool_rxnfc, data) +
+ sizeof(info.data));
+
+ if (copy_from_user(&info, useraddr, info_size))
return -EFAULT;
- return dev->ethtool_ops->set_rxnfc(dev, &cmd);
+ return dev->ethtool_ops->set_rxnfc(dev, &info);
}
static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
- void __user *useraddr)
+ u32 cmd, void __user *useraddr)
{
struct ethtool_rxnfc info;
+ size_t info_size = sizeof(info);
const struct ethtool_ops *ops = dev->ethtool_ops;
int ret;
void *rule_buf = NULL;
@@ -342,7 +352,15 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
if (!ops->get_rxnfc)
return -EOPNOTSUPP;
- if (copy_from_user(&info, useraddr, sizeof(info)))
+ /* struct ethtool_rxnfc was originally defined for
+ * ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
+ * members. User-space might still be using that
+ * definition. */
+ if (cmd == ETHTOOL_GRXFH)
+ info_size = (offsetof(struct ethtool_rxnfc, data) +
+ sizeof(info.data));
+
+ if (copy_from_user(&info, useraddr, info_size))
return -EFAULT;
if (info.cmd == ETHTOOL_GRXCLSRLALL) {
@@ -360,7 +378,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
goto err_out;
ret = -EFAULT;
- if (copy_to_user(useraddr, &info, sizeof(info)))
+ if (copy_to_user(useraddr, &info, info_size))
goto err_out;
if (rule_buf) {
@@ -1517,12 +1535,12 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_GRXCLSRLCNT:
case ETHTOOL_GRXCLSRULE:
case ETHTOOL_GRXCLSRLALL:
- rc = ethtool_get_rxnfc(dev, useraddr);
+ rc = ethtool_get_rxnfc(dev, ethcmd, useraddr);
break;
case ETHTOOL_SRXFH:
case ETHTOOL_SRXCLSRLDEL:
case ETHTOOL_SRXCLSRLINS:
- rc = ethtool_set_rxnfc(dev, useraddr);
+ rc = ethtool_set_rxnfc(dev, ethcmd, useraddr);
break;
case ETHTOOL_GGRO:
rc = ethtool_get_gro(dev, useraddr);
--
1.6.2.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
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 related
* [PATCH net-2.6 1/2] ethtool: Fix potential kernel buffer overflow in ETHTOOL_GRXCLSRLALL
From: Ben Hutchings @ 2010-06-28 18:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Santwona Behera
On a 32-bit machine, info.rule_cnt >= 0x40000000 leads to integer
overflow and the buffer may be smaller than needed. Since
ETHTOOL_GRXCLSRLALL is unprivileged, this can presumably be used for at
least denial of service.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
---
net/core/ethtool.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index a0f4964..a3a7e9a 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -347,8 +347,9 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
if (info.cmd == ETHTOOL_GRXCLSRLALL) {
if (info.rule_cnt > 0) {
- rule_buf = kmalloc(info.rule_cnt * sizeof(u32),
- GFP_USER);
+ if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32))
+ rule_buf = kmalloc(info.rule_cnt * sizeof(u32),
+ GFP_USER);
if (!rule_buf)
return -ENOMEM;
}
--
1.6.2.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
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 related
* RE: [PATCH -next] vmxnet3: fail when try to setup unsupported features
From: Shreyas Bhatewara @ 2010-06-28 17:45 UTC (permalink / raw)
To: Stanislaw Gruszka, netdev@vger.kernel.org; +Cc: Amerigo Wang
In-Reply-To: <20100628112942.0c919746@dhcp-lab-109.englab.brq.redhat.com>
> -----Original Message-----
> From: Stanislaw Gruszka [mailto:sgruszka@redhat.com]
> Sent: Monday, June 28, 2010 2:30 AM
> To: netdev@vger.kernel.org
> Cc: Amerigo Wang; Shreyas Bhatewara
> Subject: [PATCH -next] vmxnet3: fail when try to setup unsupported
> features
>
> Return EOPNOTSUPP in ethtool_ops->set_flags.
>
> Fix coding style while at it.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/vmxnet3/vmxnet3_ethtool.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c
> b/drivers/net/vmxnet3/vmxnet3_ethtool.c
> index 3935c44..8a71a21 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
> @@ -276,16 +276,21 @@ vmxnet3_get_strings(struct net_device *netdev,
> u32 stringset, u8 *buf)
> }
>
> static u32
> -vmxnet3_get_flags(struct net_device *netdev) {
> +vmxnet3_get_flags(struct net_device *netdev)
> +{
> return netdev->features;
> }
>
> static int
> -vmxnet3_set_flags(struct net_device *netdev, u32 data) {
> +vmxnet3_set_flags(struct net_device *netdev, u32 data)
> +{
> struct vmxnet3_adapter *adapter = netdev_priv(netdev);
> u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
> u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
>
> + if (data & ~ETH_FLAG_LRO)
> + return -EOPNOTSUPP;
> +
> if (lro_requested ^ lro_present) {
> /* toggle the LRO feature*/
> netdev->features ^= NETIF_F_LRO;
> --
> 1.5.5.6
Does not make sense to me. Switching LRO on/off is supported from the driver, why should the function return -EOPNOTSUPP ?
->Shreyas
^ 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