* [PATCH] Reg Review of changes flush all routing table entries in side kernel
From: durgam@it.iitb.ac.in phani @ 2008-02-08 14:33 UTC (permalink / raw)
To: netdev; +Cc: durgam.iit
Problem : Need to clean up routing table entries in side the Linux
kernel. But kernel is not providing single command to clear all
routing table entries at once.
Modified the kernel to take of the changes Defined new net link
message under NETLINK_ROUTE family RTM_FLUSHROUTE. At the
receiving end in side kernel, removed all routing table entries
related with each device.
Changed the code so that only the corresponding device reference
will be incremented and perform the flush of entries related to that
device and reduce the reference count. In side fib_sync_flush(This
function is same as fib_sync_down, except that checking for protocol)
, checking whether the route entry is installed by protocol, and
marking them only as dead.
These are the changes . (2.6-18 linux kernel)
--- linux26/include/net/ip_fib.h 2008-01-04 04:41:45.326857000 -0800
+++ linux26/include/net/modified_ip_fib.h 2008-01-21 04:46:55.000000000 -0800
@@ -233,6 +233,9 @@ extern void ip_fib_init(void);
+extern int inet_rtm_flushroute(struct sk_buff *skb, struct nlmsghdr*
nlh, void *arg);
+extern int fib_sync_flush(u32 local, struct net_device *dev, int
force, int protocol);
--- linux26/include/linux/rtnetlink.h 2008-01-04 02:57:57.487754000 -0800
+++ linux26/include/linux/modified_rtnetlink.h 2008-01-21
04:46:56.000000000 -0800
@@ -35,7 +35,11 @@ enum {
#define RTM_DELROUTE RTM_DELROUTE
RTM_GETROUTE,
#define RTM_GETROUTE RTM_GETROUTE
-
+ RTM_FLUSHROUTE,
+#define RTM_FLUSHROUTE RTM_FLUSHROUTE
+
RTM_NEWNEIGH = 28,
#define RTM_NEWNEIGH RTM_NEWNEIGH
RTM_DELNEIGH,
@@ -199,7 +203,9 @@ enum
~
--- linux26/net/ipv4/fib_frontend.c 2008-01-04 03:07:17.964607000 -0800
+++ linux26/net/ipv4/modified_fib_frontend.c 2008-01-21
04:46:53.000000000 -0800
+/*
+ * Added For flushing all the routes when clear ip route is issued
from user space
+ */
+int inet_rtm_flushroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
+{
+ struct net_device *dev;
+ struct in_device *in_dev;
+ struct rtattr **rta = arg;
+ struct rtmsg *r = NLMSG_DATA(nlh);
+
+ if (inet_check_attr(r, rta))
+ return -EINVAL;
+
+ for (dev = dev_base; dev; dev = dev->next) {
+ in_dev = in_dev_get(dev);
+ if (!in_dev)
+ continue;
+ if(fib_sync_flush(0, dev, 0, r->rtm_protocol)) {
+ fib_flush();
+ rt_cache_flush(0);
+ }
+ in_dev_put(in_dev);
+ }
+
+ return 0;
+}
This fib_sync_flush is same as fib_sync_down, except for each entry
it compares the protocol type of the routing entry to be removed.
--- linux26/net/ipv4/fib_semantics.c 2008-01-09 02:22:49.819492000 -0800
+++ linux26/net/ipv4/modified_fib_semantics.c1 2008-01-21
04:46:52.000000000 -0800
+/*
+ * FLUSH all the routing table entries related to a
+ * device
+ */
+
+int fib_sync_flush(u32 local, struct net_device *dev, int force, int protocol)
+{
+ int ret = 0;
+ int scope = RT_SCOPE_NOWHERE;
+
+ if (force)
+ scope = -1;
+
+ if (local && fib_info_laddrhash) {
+ unsigned int hash = fib_laddr_hashfn(local);
+ struct hlist_head *head = &fib_info_laddrhash[hash];
+ struct hlist_node *node;
+ struct fib_info *fi;
+ hlist_for_each_entry(fi, node, head, fib_lhash) {
+ if (fi->fib_prefsrc == local) {
+ fi->fib_flags |= RTNH_F_DEAD;
+ ret++;
+ }
+ }
+ }
+
+ if (dev) {
+ struct fib_info *prev_fi = NULL;
+ unsigned int hash = fib_devindex_hashfn(dev->ifindex);
+ struct hlist_head *head = &fib_info_devhash[hash];
+ struct hlist_node *node;
+ struct fib_nh *nh;
+ hlist_for_each_entry(nh, node, head, nh_hash) {
+ struct fib_info *fi = nh->nh_parent;
+ if(fi->fib_protocol == protocol) {
+ int dead;
+ BUG_ON(!fi->fib_nhs);
+ if (nh->nh_dev != dev || fi == prev_fi)
+ continue;
+ prev_fi = fi;
+ dead = 0;
+ change_nexthops(fi) {
+ if (nh->nh_flags&RTNH_F_DEAD)
+ dead++;
+ else if (nh->nh_dev == dev &&
+ nh->nh_scope != scope) {
+ nh->nh_flags |= RTNH_F_DEAD;
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+ spin_lock_bh(&fib_multipath_lock);
+ fi->fib_power -= nh->nh_power;
+ nh->nh_power = 0;
+ spin_unlock_bh(&fib_multipath_lock);
+#endif
+ dead++;
+ }
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+ if (force > 1 && nh->nh_dev == dev) {
+ dead = fi->fib_nhs;
+ break;
+ }
+#endif
+ } endfor_nexthops(fi)
+ if (dead == fi->fib_nhs) {
+ fi->fib_flags |= RTNH_F_DEAD;
+ ret++;
+ }
+ }
+ }
+ }
+ return ret;
+}
Please give your comments on this solution.
Thanks
Phani.
^ permalink raw reply
* Re: [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue.
From: Vlad Yasevich @ 2008-02-08 14:59 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, lksctp-developers, Linux Netdev List
In-Reply-To: <47AC3757.6020405@openvz.org>
Pavel Emelyanov wrote:
> SCPT already depends in INET, so this doesn't create additional
> dependencies.
>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>
> ---
> net/sctp/proc.c | 23 ++---------------------
> 1 files changed, 2 insertions(+), 21 deletions(-)
>
> diff --git a/net/sctp/proc.c b/net/sctp/proc.c
> index 2499732..974350b 100644
> --- a/net/sctp/proc.c
> +++ b/net/sctp/proc.c
> @@ -38,6 +38,7 @@
> #include <linux/seq_file.h>
> #include <linux/init.h>
> #include <net/sctp/sctp.h>
> +#include <net/ip.h> /* for snmp_fold_field */
>
> static struct snmp_mib sctp_snmp_list[] = {
> SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB),
> @@ -75,26 +76,6 @@ static struct snmp_mib sctp_snmp_list[] = {
> SNMP_MIB_SENTINEL
> };
>
> -/* Return the current value of a particular entry in the mib by adding its
> - * per cpu counters.
> - */
> -static unsigned long
> -fold_field(void *mib[], int nr)
> -{
> - unsigned long res = 0;
> - int i;
> -
> - for_each_possible_cpu(i) {
> - res +=
> - *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
> - sizeof (unsigned long) * nr));
> - res +=
> - *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
> - sizeof (unsigned long) * nr));
> - }
> - return res;
> -}
> -
> /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
> static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
> {
> @@ -102,7 +83,7 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
>
> for (i = 0; sctp_snmp_list[i].name != NULL; i++)
> seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
> - fold_field((void **)sctp_statistics,
> + snmp_fold_field((void **)sctp_statistics,
> sctp_snmp_list[i].entry));
>
> return 0;
^ permalink raw reply
* Re: [PATCH 2/2][SCTP]: Convert sctp_dbg_objcnt to seq files.
From: Vlad Yasevich @ 2008-02-08 15:00 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, lksctp-developers, Linux Netdev List
In-Reply-To: <47AC3819.3060507@openvz.org>
Pavel Emelyanov wrote:
> This makes the code use a good proc API and the text ~50 bytes shorter.
>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>
> ---
> net/sctp/objcnt.c | 85 +++++++++++++++++++++++++++-------------------------
> 1 files changed, 44 insertions(+), 41 deletions(-)
>
> diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
> index 2cf6ad6..2b9ac00 100644
> --- a/net/sctp/objcnt.c
> +++ b/net/sctp/objcnt.c
> @@ -80,61 +80,64 @@ static sctp_dbg_objcnt_entry_t sctp_dbg_objcnt[] = {
> /* Callback from procfs to read out objcount information.
> * Walk through the entries in the sctp_dbg_objcnt array, dumping
> * the raw object counts for each monitored type.
> - *
> - * This code was modified from similar code in route.c
> */
> -static int sctp_dbg_objcnt_read(char *buffer, char **start, off_t offset,
> - int length, int *eof, void *data)
> +static int sctp_objcnt_seq_show(struct seq_file *seq, void *v)
> {
> - int len = 0;
> - off_t pos = 0;
> - int entries;
> int i;
> char temp[128];
>
> - /* How many entries? */
> - entries = ARRAY_SIZE(sctp_dbg_objcnt);
> -
> - /* Walk the entries and print out the debug information
> - * for proc fs.
> - */
> - for (i = 0; i < entries; i++) {
> - pos += 128;
> -
> - /* Skip ahead. */
> - if (pos <= offset) {
> - len = 0;
> - continue;
> - }
> - /* Print out each entry. */
> - sprintf(temp, "%s: %d",
> - sctp_dbg_objcnt[i].label,
> - atomic_read(sctp_dbg_objcnt[i].counter));
> -
> - sprintf(buffer + len, "%-127s\n", temp);
> - len += 128;
> - if (pos >= offset+length)
> - goto done;
> - }
> -
> -done:
> - *start = buffer + len - (pos - offset);
> - len = pos - offset;
> - if (len > length)
> - len = length;
> -
> - return len;
> + i = (int)*(loff_t *)v;
> + sprintf(temp, "%s: %d", sctp_dbg_objcnt[i].label,
> + atomic_read(sctp_dbg_objcnt[i].counter));
> + seq_printf(seq, "%-127s\n", temp);
> + return 0;
> +}
> +
> +static void *sctp_objcnt_seq_start(struct seq_file *seq, loff_t *pos)
> +{
> + return (*pos >= ARRAY_SIZE(sctp_dbg_objcnt)) ? NULL : (void *)pos;
> +}
> +
> +static void sctp_objcnt_seq_stop(struct seq_file *seq, void *v)
> +{
> +}
> +
> +static void * sctp_objcnt_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> +{
> + ++*pos;
> + return (*pos >= ARRAY_SIZE(sctp_dbg_objcnt)) ? NULL : (void *)pos;
> }
>
> +static const struct seq_operations sctp_objcnt_seq_ops = {
> + .start = sctp_objcnt_seq_start,
> + .next = sctp_objcnt_seq_next,
> + .stop = sctp_objcnt_seq_stop,
> + .show = sctp_objcnt_seq_show,
> +};
> +
> +static int sctp_objcnt_seq_open(struct inode *inode, struct file *file)
> +{
> + return seq_open(file, &sctp_objcnt_seq_ops);
> +}
> +
> +static const struct file_operations sctp_objcnt_ops = {
> + .open = sctp_objcnt_seq_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = seq_release,
> +};
> +
> /* Initialize the objcount in the proc filesystem. */
> void sctp_dbg_objcnt_init(void)
> {
> struct proc_dir_entry *ent;
> - ent = create_proc_read_entry("sctp_dbg_objcnt", 0, proc_net_sctp,
> - sctp_dbg_objcnt_read, NULL);
> +
> + ent = create_proc_entry("sctp_dbg_objcnt", 0, proc_net_sctp);
> if (!ent)
> printk(KERN_WARNING
> "sctp_dbg_objcnt: Unable to create /proc entry.\n");
> + else
> + ent->proc_fops = &sctp_objcnt_ops;
> }
>
> /* Cleanup the objcount entry in the proc filesystem. */
^ permalink raw reply
* [PATCH 2.6.24] pcnet32: use NET_IP_ALIGN instead of 2
From: Don Fry @ 2008-02-08 15:32 UTC (permalink / raw)
To: jgarzik; +Cc: netdev
Change hard coded 2 to NET_IP_ALIGN. Added new #define with comments.
Tested amd_64
Signed-off-by: Don Fry <pcnet32@verizon.net>
---
--- linux-2.6.24-git13/drivers/net/joe.pcnet32.c 2008-02-04 10:59:08.000000000 -0800
+++ linux-2.6.24-git18/drivers/net/pcnet32.c 2008-02-08 07:20:44.000000000 -0800
@@ -174,7 +174,11 @@ static int homepna[MAX_UNITS];
#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS))
#define RX_MAX_RING_SIZE (1 << (PCNET32_LOG_MAX_RX_BUFFERS))
-#define PKT_BUF_SZ 1544
+#define PKT_BUF_SKB 1544
+/* actual buffer length after being aligned */
+#define PKT_BUF_SIZE (PKT_BUF_SKB - NET_IP_ALIGN)
+/* chip wants twos complement of the (aligned) buffer length */
+#define NEG_BUF_SIZE (NET_IP_ALIGN - PKT_BUF_SKB)
/* Offsets from base I/O address. */
#define PCNET32_WIO_RDP 0x10
@@ -604,7 +608,7 @@ static void pcnet32_realloc_rx_ring(stru
/* now allocate any new buffers needed */
for (; new < size; new++ ) {
struct sk_buff *rx_skbuff;
- new_skb_list[new] = dev_alloc_skb(PKT_BUF_SZ);
+ new_skb_list[new] = dev_alloc_skb(PKT_BUF_SKB);
if (!(rx_skbuff = new_skb_list[new])) {
/* keep the original lists and buffers */
if (netif_msg_drv(lp))
@@ -613,20 +617,20 @@ static void pcnet32_realloc_rx_ring(stru
dev->name);
goto free_all_new;
}
- skb_reserve(rx_skbuff, 2);
+ skb_reserve(rx_skbuff, NET_IP_ALIGN);
new_dma_addr_list[new] =
pci_map_single(lp->pci_dev, rx_skbuff->data,
- PKT_BUF_SZ - 2, PCI_DMA_FROMDEVICE);
+ PKT_BUF_SIZE, PCI_DMA_FROMDEVICE);
new_rx_ring[new].base = cpu_to_le32(new_dma_addr_list[new]);
- new_rx_ring[new].buf_length = cpu_to_le16(2 - PKT_BUF_SZ);
+ new_rx_ring[new].buf_length = cpu_to_le16(NEG_BUF_SIZE);
new_rx_ring[new].status = cpu_to_le16(0x8000);
}
/* and free any unneeded buffers */
for (; new < lp->rx_ring_size; new++) {
if (lp->rx_skbuff[new]) {
pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[new],
- PKT_BUF_SZ - 2, PCI_DMA_FROMDEVICE);
+ PKT_BUF_SIZE, PCI_DMA_FROMDEVICE);
dev_kfree_skb(lp->rx_skbuff[new]);
}
}
@@ -651,7 +655,7 @@ static void pcnet32_realloc_rx_ring(stru
for (; --new >= lp->rx_ring_size; ) {
if (new_skb_list[new]) {
pci_unmap_single(lp->pci_dev, new_dma_addr_list[new],
- PKT_BUF_SZ - 2, PCI_DMA_FROMDEVICE);
+ PKT_BUF_SIZE, PCI_DMA_FROMDEVICE);
dev_kfree_skb(new_skb_list[new]);
}
}
@@ -678,7 +682,7 @@ static void pcnet32_purge_rx_ring(struct
wmb(); /* Make sure adapter sees owner change */
if (lp->rx_skbuff[i]) {
pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[i],
- PKT_BUF_SZ - 2, PCI_DMA_FROMDEVICE);
+ PKT_BUF_SIZE, PCI_DMA_FROMDEVICE);
dev_kfree_skb_any(lp->rx_skbuff[i]);
}
lp->rx_skbuff[i] = NULL;
@@ -1201,7 +1205,7 @@ static void pcnet32_rx_entry(struct net_
pkt_len = (le32_to_cpu(rxp->msg_length) & 0xfff) - 4;
/* Discard oversize frames. */
- if (unlikely(pkt_len > PKT_BUF_SZ - 2)) {
+ if (unlikely(pkt_len > PKT_BUF_SIZE)) {
if (netif_msg_drv(lp))
printk(KERN_ERR "%s: Impossible packet size %d!\n",
dev->name, pkt_len);
@@ -1218,26 +1222,26 @@ static void pcnet32_rx_entry(struct net_
if (pkt_len > rx_copybreak) {
struct sk_buff *newskb;
- if ((newskb = dev_alloc_skb(PKT_BUF_SZ))) {
- skb_reserve(newskb, 2);
+ if ((newskb = dev_alloc_skb(PKT_BUF_SKB))) {
+ skb_reserve(newskb, NET_IP_ALIGN);
skb = lp->rx_skbuff[entry];
pci_unmap_single(lp->pci_dev,
lp->rx_dma_addr[entry],
- PKT_BUF_SZ - 2,
+ PKT_BUF_SIZE,
PCI_DMA_FROMDEVICE);
skb_put(skb, pkt_len);
lp->rx_skbuff[entry] = newskb;
lp->rx_dma_addr[entry] =
pci_map_single(lp->pci_dev,
newskb->data,
- PKT_BUF_SZ - 2,
+ PKT_BUF_SIZE,
PCI_DMA_FROMDEVICE);
rxp->base = cpu_to_le32(lp->rx_dma_addr[entry]);
rx_in_place = 1;
} else
skb = NULL;
} else {
- skb = dev_alloc_skb(pkt_len + 2);
+ skb = dev_alloc_skb(pkt_len + NET_IP_ALIGN);
}
if (skb == NULL) {
@@ -1250,7 +1254,7 @@ static void pcnet32_rx_entry(struct net_
}
skb->dev = dev;
if (!rx_in_place) {
- skb_reserve(skb, 2); /* 16 byte align */
+ skb_reserve(skb, NET_IP_ALIGN);
skb_put(skb, pkt_len); /* Make room */
pci_dma_sync_single_for_cpu(lp->pci_dev,
lp->rx_dma_addr[entry],
@@ -1291,7 +1295,7 @@ static int pcnet32_rx(struct net_device
* The docs say that the buffer length isn't touched, but Andrew
* Boyd of QNX reports that some revs of the 79C965 clear it.
*/
- rxp->buf_length = cpu_to_le16(2 - PKT_BUF_SZ);
+ rxp->buf_length = cpu_to_le16(NEG_BUF_SIZE);
wmb(); /* Make sure owner changes after others are visible */
rxp->status = cpu_to_le16(0x8000);
entry = (++lp->cur_rx) & lp->rx_mod_mask;
@@ -2396,7 +2400,7 @@ static int pcnet32_init_ring(struct net_
if (rx_skbuff == NULL) {
if (!
(rx_skbuff = lp->rx_skbuff[i] =
- dev_alloc_skb(PKT_BUF_SZ))) {
+ dev_alloc_skb(PKT_BUF_SKB))) {
/* there is not much, we can do at this point */
if (netif_msg_drv(lp))
printk(KERN_ERR
@@ -2404,16 +2408,16 @@ static int pcnet32_init_ring(struct net_
dev->name);
return -1;
}
- skb_reserve(rx_skbuff, 2);
+ skb_reserve(rx_skbuff, NET_IP_ALIGN);
}
rmb();
if (lp->rx_dma_addr[i] == 0)
lp->rx_dma_addr[i] =
pci_map_single(lp->pci_dev, rx_skbuff->data,
- PKT_BUF_SZ - 2, PCI_DMA_FROMDEVICE);
+ PKT_BUF_SIZE, PCI_DMA_FROMDEVICE);
lp->rx_ring[i].base = cpu_to_le32(lp->rx_dma_addr[i]);
- lp->rx_ring[i].buf_length = cpu_to_le16(2 - PKT_BUF_SZ);
+ lp->rx_ring[i].buf_length = cpu_to_le16(NEG_BUF_SIZE);
wmb(); /* Make sure owner changes after all others are visible */
lp->rx_ring[i].status = cpu_to_le16(0x8000);
}
^ permalink raw reply
* Re: [patch 7/7] pppol2tp: fix printk warnings
From: James Chapman @ 2008-02-08 15:40 UTC (permalink / raw)
To: akpm; +Cc: davem, jeff, netdev
In-Reply-To: <200802081120.m18BK9QQ021642@imap1.linux-foundation.org>
akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
>
> drivers/net/pppol2tp.c: In function `pppol2tp_seq_tunnel_show':
> drivers/net/pppol2tp.c:2295: warning: long long unsigned int format, __u64 arg (arg 4)
> drivers/net/pppol2tp.c:2295: warning: long long unsigned int format, __u64 arg (arg 5)
> drivers/net/pppol2tp.c:2295: warning: long long unsigned int format, __u64 arg (arg 6)
> drivers/net/pppol2tp.c:2295: warning: long long unsigned int format, __u64 arg (arg 7)
> drivers/net/pppol2tp.c:2295: warning: long long unsigned int format, __u64 arg (arg 8)
> drivers/net/pppol2tp.c:2295: warning: long long unsigned int format, __u64 arg (arg 9)
> drivers/net/pppol2tp.c: In function `pppol2tp_seq_session_show':
> drivers/net/pppol2tp.c:2328: warning: long long unsigned int format, __u64 arg (arg 5)
> drivers/net/pppol2tp.c:2328: warning: long long unsigned int format, __u64 arg (arg 6)
> drivers/net/pppol2tp.c:2328: warning: long long unsigned int format, __u64 arg (arg 7)
> drivers/net/pppol2tp.c:2328: warning: long long unsigned int format, __u64 arg (arg 8)
> drivers/net/pppol2tp.c:2328: warning: long long unsigned int format, __u64 arg (arg 9)
> drivers/net/pppol2tp.c:2328: warning: long long unsigned int format, __u64 arg (arg 10)
>
> Not all platforms implement u64 with unsigned long long. eg: powerpc.
>
> Cc: Jeff Garzik <jeff@garzik.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: James Chapman <jchapman@katalix.com>
--
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
^ permalink raw reply
* Re: [patch 1/2] qeth: new qeth device driver
From: Paul E. McKenney @ 2008-02-08 15:54 UTC (permalink / raw)
To: Frank.Blaschka; +Cc: jgarzik, netdev
In-Reply-To: <20080208141535.271607000@de.ibm.com>
On Fri, Feb 08, 2008 at 03:10:00PM +0100, Frank.Blaschka@de.ibm.com wrote:
> From: Frank Blaschka <frank.blaschka@de.ibm.com>
>
> List of major changes and improvements:
> no manipulation of the global ARP constructor
> clean code split into core, layer 2 and layer 3 functionality
> better exploitation of the ethtool interface
> better representation of the various hardware capabilities
> fix packet socket support (tcpdump), no fake_ll required
> osasnmpd notification via udev events
> coding style and beautification
One question below...
> Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
> ---
[ . . . ]
> +static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
> +{
> + struct net_device *vlandev;
> + struct qeth_card *card = (struct qeth_card *) dev->priv;
> + struct in_device *in_dev;
> +
> + if (card->info.type == QETH_CARD_TYPE_IQD)
> + return;
> +
> + vlandev = vlan_group_get_device(card->vlangrp, vid);
> + vlandev->neigh_setup = qeth_l3_neigh_setup;
> +
> + in_dev = __in_dev_get_rcu(vlandev);
Is this really in an RCU read-side critical section? Or is this just
using common code?
Thanx, Paul
^ permalink raw reply
* Re: [PATCH] ipvs: Make the synchronization interval controllable
From: Krzysztof Oledzki @ 2008-02-08 15:57 UTC (permalink / raw)
To: Andi Kleen; +Cc: Sven Wegener, netdev, linux-kernel
In-Reply-To: <871w7n34ss.fsf@basil.nowhere.org>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 798 bytes --]
On Fri, 8 Feb 2008, Andi Kleen wrote:
> Sven Wegener <sven.wegener@stealer.net> writes:
>
>> The default synchronization interval of 1000 milliseconds is too high for a
>> heavily loaded director. Collecting the connection information from one second
>> and then sending it out in a burst will overflow the socket buffer and lead to
>> synchronization information being dropped. Make the interval controllable by a
>> sysctl variable so that users can tune it.
>
> It would be better if the defaults just worked under all circumstances.
> So why not just lower the default?
>
> Or the code could detect overflowing socket buffers and lower the
> value dynamically.
We can also start sending when amount of data reaches defined level.
Best regards,
Krzysztof Olędzki
^ permalink raw reply
* 2.6.24?: WARNING: at net/core/dev.c: skb_gso_segment()
From: Alexey Dobriyan @ 2008-02-08 16:00 UTC (permalink / raw)
To: linux-kernel, netdev
FYI, this happened several times with OpenVZ kernel here, though one user
reported against v2.6.24 but without calltrace:
http://marc.info/?l=linux-kernel&m=120155594432027&w=2
Anyway...
Driver is tg3.
[ 403.240511] WARNING: at net/core/dev.c:1407 skb_gso_segment()
if (WARN_ON(skb->ip_summed != CHECKSUM_PARTIAL)) {
[ 403.240653] Pid: 6114, comm: bash Tainted: G M 2.6.24-openvz #30
[ 403.240779]
[ 403.240781] Call Trace:
[ 403.240987] <IRQ> [<ffffffff8041a81b>] skb_gso_segment+0x19b/0x250
[ 403.241194] [<ffffffff8041aae9>] dev_hard_start_xmit+0x219/0x2d0
[ 403.241318] [<ffffffff8041d6c5>] dev_queue_xmit+0x2b5/0x370
[ 403.241440] [<ffffffff804404a3>] ip_queue_xmit+0x323/0x4c0
[ 403.241565] [<ffffffff802a72d9>] init_object+0x89/0xa0
[ 403.241684] [<ffffffff802aa814>] __slab_alloc+0x394/0x3f0
[ 403.241805] [<ffffffff80454ddd>] tso_fragment+0x7d/0x260
[ 403.241927] [<ffffffff80454ddd>] tso_fragment+0x7d/0x260
[ 403.242048] [<ffffffff80453226>] tcp_transmit_skb+0x526/0x950
[ 403.242170] [<ffffffff80454ec8>] tso_fragment+0x168/0x260
[ 403.242290] [<ffffffff80455105>] __tcp_push_pending_frames+0x145/0x9a0
[ 403.242415] [<ffffffff802a8b2c>] __slab_free+0x9c/0x2d0
[ 403.242533] [<ffffffff80451fd1>] tcp_rcv_established+0x481/0x880
[ 403.242657] [<ffffffff80451ff1>] tcp_rcv_established+0x4a1/0x880
[ 403.242783] [<ffffffff80459c4b>] tcp_v4_do_rcv+0x3ab/0x790
[ 403.242904] [<ffffffff80437123>] ip_route_input+0x153/0x1200
[ 403.243044] [<ffffffff8045cecd>] tcp_v4_rcv+0xa0d/0xb60
[ 403.243165] [<ffffffff8043a8cd>] ip_local_deliver_finish+0xfd/0x2c0
[ 403.243288] [<ffffffff8043a458>] ip_rcv_finish+0x128/0x4a0
[ 403.243409] [<ffffffff8041a266>] netif_receive_skb+0x2e6/0x390
[ 403.243531] [<ffffffff8041d005>] process_backlog+0x85/0xf0
[ 403.243654] [<ffffffff8041cd40>] net_rx_action+0x170/0x200
[ 403.243777] [<ffffffff802422d9>] __do_softirq+0xb9/0x160
[ 403.243898] [<ffffffff8020d17c>] call_softirq+0x1c/0x30
[ 403.244017] [<ffffffff8020f645>] do_softirq+0x55/0xb0
[ 403.244134] [<ffffffff80242215>] irq_exit+0xe5/0xf0
[ 403.244252] [<ffffffff8020f720>] do_IRQ+0x80/0x100
[ 403.244368] [<ffffffff8020c476>] ret_from_intr+0x0/0xf
[ 403.244489] <EOI>
^ permalink raw reply
* [PATCH 2.6.24] pcnet32: Use print_mac
From: Don Fry @ 2008-02-08 15:29 UTC (permalink / raw)
To: jgarzik; +Cc: netdev
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Don Fry <pcnet32@verizon.net>
---
Originally sent by Joe Dec 14, 2007
Tested by Don on amd_64
--- linux-2.6.24-git13/drivers/net/orig.pcnet32.c 2008-02-04 10:05:48.000000000 -0800
+++ linux-2.6.24-git18/drivers/net/pcnet32.c 2008-02-04 10:59:08.000000000 -0800
@@ -1774,8 +1774,8 @@ pcnet32_probe1(unsigned long ioaddr, int
memset(dev->dev_addr, 0, sizeof(dev->dev_addr));
if (pcnet32_debug & NETIF_MSG_PROBE) {
- for (i = 0; i < 6; i++)
- printk(" %2.2x", dev->dev_addr[i]);
+ DECLARE_MAC_BUF(mac);
+ printk(" %s", print_mac(mac, dev->dev_addr));
/* Version 0x2623 and 0x2624 */
if (((chip_version + 1) & 0xfffe) == 0x2624) {
^ permalink raw reply
* [PATCH] [XFRM] Beet: Fix output for ipv6
From: Joakim Koskela @ 2008-02-08 16:12 UTC (permalink / raw)
To: netdev
Hi,
This patch fixes the ipv6 mode of ipsec beet. It has been using logic
similar to tunnel mode, making it crash during esp packaging.
Signed-off-by: Joakim Koskela <jookos@gmail.com>
---
net/ipv6/xfrm6_mode_beet.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 0527d11..0395800 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -40,11 +40,14 @@ static void xfrm6_beet_make_header(struct sk_buff *skb)
static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
{
struct ipv6hdr *top_iph;
+ u8 *prevhdr;
+ int hdr_len;
+ hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
+ skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
skb_set_network_header(skb, -x->props.header_len);
- skb->mac_header = skb->network_header +
- offsetof(struct ipv6hdr, nexthdr);
- skb->transport_header = skb->network_header + sizeof(*top_iph);
+ skb->transport_header = skb->network_header + hdr_len;
+ __skb_pull(skb, hdr_len);
xfrm6_beet_make_header(skb);
^ permalink raw reply related
* [PATCH] [IPV6]: dst_entry leak in ip4ip6_err.
From: Denis V. Lunev @ 2008-02-08 17:01 UTC (permalink / raw)
To: davem; +Cc: netdev, devel, yoshfuji, kaber, Denis V. Lunev
The result of the ip_route_output is not assigned to skb. This means that
- it is leaked
- possible OOPS below dereferrencing skb->dst
- no ICMP message for this case
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv6/ip6_tunnel.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9031e52..cd94064 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -550,6 +550,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
ip_rt_put(rt);
goto out;
}
+ skb2->dst = (struct dst_entry *)rt;
} else {
ip_rt_put(rt);
if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos,
--
1.5.3.rc5
^ permalink raw reply related
* ipv6_chk_acast_addr remove unused loop
From: Daniel Lezcano @ 2008-02-08 17:23 UTC (permalink / raw)
To: David Miller
Cc: Linux Netdev List,
YOSHIFUJI Hideaki / 吉藤英明
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: ipv6_chk_acast_addr-remove-loop.patch --]
[-- Type: text/x-patch, Size: 1757 bytes --]
Subject: ipv6_chk_acast_addr remove unused loop
From: Daniel Lezcano <dlezcano@fr.ibm.com>
The ipv6_chk_acast_addr is called with a netdev pointer parameter which
can be NULL. This value is used as a wildcard to browse the netdev list
and search if a device is owning the address. But when looking closely
to the code, this function is only called one time in ndisc.c and the
netdev parameter is never NULL. The code browsing the netdev list is
pointless in this case.
This patch removes netdev list browsing code.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
net/ipv6/anycast.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
Index: net-2.6-fixes/net/ipv6/anycast.c
===================================================================
--- net-2.6-fixes.orig/net/ipv6/anycast.c
+++ net-2.6-fixes/net/ipv6/anycast.c
@@ -401,7 +401,7 @@ static int ipv6_dev_ac_dec(struct net_de
/*
* check if the interface has this anycast address
*/
-static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr)
+int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr)
{
struct inet6_dev *idev;
struct ifacaddr6 *aca;
@@ -419,26 +419,6 @@ static int ipv6_chk_acast_dev(struct net
return 0;
}
-/*
- * check if given interface (or any, if dev==0) has this anycast address
- */
-int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr)
-{
- int found = 0;
-
- if (dev)
- return ipv6_chk_acast_dev(dev, addr);
- read_lock(&dev_base_lock);
- for_each_netdev(&init_net, dev)
- if (ipv6_chk_acast_dev(dev, addr)) {
- found = 1;
- break;
- }
- read_unlock(&dev_base_lock);
- return found;
-}
-
-
#ifdef CONFIG_PROC_FS
struct ac6_iter_state {
struct net_device *dev;
^ permalink raw reply
* Re: ipv6_chk_acast_addr remove unused loop
From: David Stevens @ 2008-02-08 17:42 UTC (permalink / raw)
To: Daniel Lezcano
Cc: David Miller, Linux Netdev List, netdev-owner,
YOSHIFUJI Hideaki / 吉藤英明
In-Reply-To: <47AC8FFD.3090401@fr.ibm.com>
NACK.
Daniel,
This code is part of the in-kernel API for anycast, which is
intended
to be the same as for multicast. By removing support for NULL there,
you're
making a special case for the anycast code that isn't there in the
multicast
code (can't support a NULL dev), and you really aren't buying all that
much for it.
+-DLS
^ permalink raw reply
* Re: + smack-unlabeled-outgoing-ambient-packets.patch added to -mm tree
From: Paul Moore @ 2008-02-08 17:43 UTC (permalink / raw)
To: casey; +Cc: Andrew Morton, davem, jmorris, mingo, sds, linux-kernel, netdev
In-Reply-To: <20080207120459.d4994f44.akpm@linux-foundation.org>
> > > ------------------------------------------------------
> > > Subject: Smack: unlabeled outgoing ambient packets
> > > From: Casey Schaufler <casey@schaufler-ca.com>
> > >
> > > Smack uses CIPSO labeling, but allows for unlabeled packets by
> > > specifying an "ambient" label that is applied to incoming
> > > unlabeled packets. Because the other end of the connection may
> > > dislike IP options, and ssh is one know application that behaves
> > > thus ...
I forgot to mention this earlier, but RHEL/Fedora/Rawhide has a patched
version of SSH (see RH bugzilla #202856 for the discussion/patch) that
fixes the problem of IPv4 options causing SSH to reject the connection.
It turns out that SSH is being a bit overzealous (rejecting all IPv4
options) in trying to reject source-routed packets.
--
paul moore
linux security @ hp
^ permalink raw reply
* Re: [patch 1/7] typhoon section fix
From: Andrew Morton @ 2008-02-08 17:52 UTC (permalink / raw)
To: David Dillow; +Cc: davem, jeff, netdev, sam
In-Reply-To: <1202479150.4349.0.camel@obelisk.thedillows.org>
On Fri, 08 Feb 2008 08:59:10 -0500 David Dillow <dave@thedillows.org> wrote:
>
> On Fri, 2008-02-08 at 03:11 -0800, akpm@linux-foundation.org wrote:
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> > gcc-3.4.4 on powerpc:
> >
> > drivers/net/typhoon.c:137: error: version causes a section type conflict
> >
> > Cc: Jeff Garzik <jeff@garzik.org>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>
> > -static const char version[] __devinitdata =
> > +static char version[] __devinitdata =
> > "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
>
> Wouldn't going to __devinitconst be better? I'll try to whip up a patch
> and test-compile it.
Sam told me that doesn't work right, that this approach is the one to use
and, iirc, that __devinitcont and friends will be removed.
I'm not sure why, actually. I think I missed that dicussion.
^ permalink raw reply
* Re: ipv6_chk_acast_addr remove unused loop
From: Daniel Lezcano @ 2008-02-08 17:48 UTC (permalink / raw)
To: David Stevens
Cc: David Miller, Linux Netdev List, netdev-owner,
YOSHIFUJI Hideaki / 吉藤英明
In-Reply-To: <OF1B77A186.F07F897A-ON882573E9.0060B0C5-882573E9.00614E3C@us.ibm.com>
David Stevens wrote:
> NACK.
>
> Daniel,
> This code is part of the in-kernel API for anycast, which is
> intended
> to be the same as for multicast. By removing support for NULL there,
> you're
> making a special case for the anycast code that isn't there in the
> multicast
> code (can't support a NULL dev), and you really aren't buying all that
> much for it.
I was hesitating to send this patch exactly for the reason you are
explaining. Apparently I did the bad choice :)
Thanks.
-- Daniel
^ permalink raw reply
* Re: [NET/IPv6] Race condition with flow_cache_genid?
From: Herbert Xu @ 2008-02-08 18:16 UTC (permalink / raw)
To: Kyle Moffett; +Cc: netdev, linux-kernel, davem
In-Reply-To: <f73f7ab80802061036u64a56abnccafacf68f2ed717@mail.gmail.com>
Kyle Moffett <kyle@moffetthome.net> wrote:
>
> Basically either there is some missing locking here or it does not
> need to be "atomic_t". Judging from the way it *appears* to be used
> to check if cache entries are up-to-date with the latest changes in
> policy, I would guess the former.
You're right that it doesn't really have to be an atomic since
all the writers are from xfrm currently. However, the fact that
it is atomic is used by the current code since sometimes they
increment the value without holding the xfrm policy lock.
Yes it is racy but that is fine for the purpose that this variable
serves. All it does is to make sure that extant flow objects get
killed at some point after the increment. There is absolutely no
requirement that the killing be immediate or synchronised.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: oops with ipcomp
From: Herbert Xu @ 2008-02-08 18:31 UTC (permalink / raw)
To: Beschorner Daniel; +Cc: netdev
In-Reply-To: <3C59DB883F7B0B4D8096010D45ACCD134F20D4@exch.facton.local>
On Fri, Feb 08, 2008 at 11:45:33AM +0100, Beschorner Daniel wrote:
> > No I meant the exact output of ip x p and ip x s.
>
> I know, but as I end up every time with a tainted kernel on our
> production server I didn't turn ipcomp on, but now I got it.
Hmm, that's pretty much what I've got (but I'm on 32-bit still).
Does every packet from A trigger the crash?
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [patch 1/7] typhoon section fix
From: David Dillow @ 2008-02-08 18:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: davem, jeff, netdev, sam
In-Reply-To: <20080208095233.722d7c47.akpm@linux-foundation.org>
On Fri, 2008-02-08 at 09:52 -0800, Andrew Morton wrote:
> On Fri, 08 Feb 2008 08:59:10 -0500 David Dillow <dave@thedillows.org> wrote:
> > On Fri, 2008-02-08 at 03:11 -0800, akpm@linux-foundation.org wrote:
> > > From: Andrew Morton <akpm@linux-foundation.org>
> > >
> > > gcc-3.4.4 on powerpc:
> > >
> > > drivers/net/typhoon.c:137: error: version causes a section type conflict
> > >
> > > Cc: Jeff Garzik <jeff@garzik.org>
> > > Cc: Sam Ravnborg <sam@ravnborg.org>
> > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> >
> > > -static const char version[] __devinitdata =
> > > +static char version[] __devinitdata =
> > > "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
> >
> > Wouldn't going to __devinitconst be better? I'll try to whip up a patch
> > and test-compile it.
>
> Sam told me that doesn't work right, that this approach is the one to use
> and, iirc, that __devinitcont and friends will be removed.
>
> I'm not sure why, actually. I think I missed that dicussion.
Thanks for the searchable terms -- this is the thread, I think:
http://lkml.org/lkml/2008/2/3/99
It looks like Jan had an idea to fold the const into the __devinitconst
marker, and if that seems to be viable, then I'd prefer that route to
keep the const'ness where it is possible.
Otherwise, your patch is fine as-is.
Acked-by: David Dillow <dave@thedillows.org>
^ permalink raw reply
* Re: [patch 1/7] typhoon section fix
From: Sam Ravnborg @ 2008-02-08 19:03 UTC (permalink / raw)
To: David Dillow, Jan Beulich; +Cc: Andrew Morton, davem, jeff, netdev
In-Reply-To: <1202494917.5298.3.camel@lap75545.ornl.gov>
On Fri, Feb 08, 2008 at 01:21:57PM -0500, David Dillow wrote:
>
> On Fri, 2008-02-08 at 09:52 -0800, Andrew Morton wrote:
> > On Fri, 08 Feb 2008 08:59:10 -0500 David Dillow <dave@thedillows.org> wrote:
> > > On Fri, 2008-02-08 at 03:11 -0800, akpm@linux-foundation.org wrote:
> > > > From: Andrew Morton <akpm@linux-foundation.org>
> > > >
> > > > gcc-3.4.4 on powerpc:
> > > >
> > > > drivers/net/typhoon.c:137: error: version causes a section type conflict
> > > >
> > > > Cc: Jeff Garzik <jeff@garzik.org>
> > > > Cc: Sam Ravnborg <sam@ravnborg.org>
> > > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > >
> > > > -static const char version[] __devinitdata =
> > > > +static char version[] __devinitdata =
> > > > "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
> > >
> > > Wouldn't going to __devinitconst be better? I'll try to whip up a patch
> > > and test-compile it.
> >
> > Sam told me that doesn't work right, that this approach is the one to use
> > and, iirc, that __devinitcont and friends will be removed.
> >
> > I'm not sure why, actually. I think I missed that dicussion.
After introducing dedicated sections for __devinit, __devinitdata & friends
and introducing __devinitconst for const data we started to see
section type conflict _errors_ emitted from gcc for certain architectures.
64bit powerpc and ia64 being two of them.
That was rooted down by Al to the following:
===================================================================
; cat >a.c <<'EOF'
const char foo[] __attribute__ ((__section__(".blah"))) = "";
const char * const bar __attribute__((__section__(".blah"))) = "";
EOF
; gcc -m32 -S a.c
; gcc -m64 -S a.c
a.c:2: error: bar causes a section type conflict
;
===================================================================
Which tells us that the same data in some cases are put in a readonly
section and in other cases not.
And when we force data for tow different variables where gcc thinks one is
const and the other is not const to the same section gcc errros
out with the "section type conflict" error.
And this is becoming increasingly visible when people start to constify
the data all around and do test build on x86 64bit that does not exhibit
this behaviour.
The rationale behind the increased constification of data is to get
improved use of the DEBUG_RODATA thing.
Another good reason s that this is a good way to let gcc catch accidental
writes to data that otherwise should have been read-only.
But if we advocate for constification of data than we should have
a reliable way to detect the section type conflict errors on x86
(at least 64 bit) which we do not have. Missing that will casue us to see
an increasing flood of error reports from our power pc and ia64 builders.
The rationale behind __devinitconst was to create a dedicated section
for data marked read-only by gcc and thus avoiding the
section type conflict.
But as shown by the above code snippet this is not easy.
For x86 (32 + 64bit) both variables end up in READ-ONLY section.
For Powerpc 64 bit the variable bar end up in a read-write section.
And I see no way to check this for a x86 build so we warn early and
with the most widely used tool-chain.
So do we have other options that to drop the constification and thus
dropping the __devinitconst and the other __*const annotations - I think not :-(
Sam
^ permalink raw reply
* Broadcom 5708 taking a few seconds to get link-up
From: Brian Haley @ 2008-02-08 19:29 UTC (permalink / raw)
To: mchan; +Cc: netdev@vger.kernel.org
Hi Michael,
I'm working on a system that has two on-board 5708's. We've noticed
that it takes about 3 seconds for the link to come up - is this
considered normal? I've tried this with the latest davem tree with
similar results to older kernels/drivers.
# uname -r
2.6.24
# ethtool -i eth3
driver: bnx2
version: 1.7.3
firmware-version: 1.9.3
bus-info: 0000:42:00.0
# lspci -v
42:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708
Gigabit Ethernet (rev 11)
Subsystem: Hewlett-Packard Company Unknown device 7038
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 34
Memory at fa000000 (64-bit, non-prefetchable) [size=32M]
Capabilities: [40] PCI-X non-bridge device
Capabilities: [48] Power Management version 2
Capabilities: [50] Vital Product Data
Capabilities: [58] Message Signalled Interrupts: Mask- 64bit+
Queue=0/0 Enable-
# ip link set eth3 up; mii-tool eth3; sleep 1; mii-tool eth3; sleep 1;
mii-tool eth3; sleep 1; mii-tool eth3
eth3: no link
eth3: no link
eth3: no link
eth3: negotiated 100baseTx-FD, link ok
Other drivers I've tried - e1000 and tg3, get up in < 1 second. I'm
asking becuase any packet I try to transmit out this interface before
link-up never gets out.
Thanks for any info,
-Brian
^ permalink raw reply
* [PATCH 4/5] Tsi108_eth: fix link recovery after disconnect
From: Alexandre Bounine @ 2008-02-08 19:17 UTC (permalink / raw)
To: jgarzik, netdev; +Cc: linuxppc-dev, Josh Boyer, Zang Roy-r61911
Bug fix for tsi108_eth network driver.
This patch fixes a problem with link recovery after connection was lost.
Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
---
diff -pNur linux-2.6.24/drivers/net/tsi108_eth.c
linux-2.6.24-fix/drivers/net/tsi108_eth.c
--- linux-2.6.24/drivers/net/tsi108_eth.c 2008-02-06
16:16:00.000000000 -0500
+++ linux-2.6.24-fix/drivers/net/tsi108_eth.c 2008-02-06
16:57:41.000000000 -0500
@@ -338,22 +338,21 @@ static void tsi108_check_phy(struct net_
TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg);
TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg);
+ }
- if (data->link_up == 0) {
- /* The manual says it can take 3-4 usecs
for the speed change
- * to take effect.
- */
- udelay(5);
-
- spin_lock(&data->txlock);
- if (is_valid_ether_addr(dev->dev_addr)
&& data->txfree)
- netif_wake_queue(dev);
+ if (data->link_up == 0) {
+ /* The manual says it can take 3-4 usecs for the
speed change
+ * to take effect.
+ */
+ udelay(5);
- data->link_up = 1;
- spin_unlock(&data->txlock);
- }
- }
+ spin_lock(&data->txlock);
+ if (is_valid_ether_addr(dev->dev_addr) &&
data->txfree)
+ netif_wake_queue(dev);
+ data->link_up = 1;
+ spin_unlock(&data->txlock);
+ }
} else {
if (data->link_up == 1) {
netif_stop_queue(dev);
@@ -1267,12 +1266,11 @@ static void tsi108_init_phy(struct net_d
* PHY_STAT register before the link up status bit is set.
*/
- data->link_up = 1;
+ data->link_up = 0;
while (!((phyval = tsi108_read_mii(data, MII_BMSR)) &
BMSR_LSTATUS)) {
if (i++ > (MII_READ_DELAY / 10)) {
- data->link_up = 0;
break;
}
spin_unlock_irqrestore(&phy_lock, flags);
---
Important Notice: This message is intended for the use of the individual to whom it is addressed and may contain information which is privileged, confidential and/or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or is not the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone or return e-mail and delete the original message from your systems. Thank you.
^ permalink raw reply
* [PATCH 0/5] Tsi108_eth: set of driver fix-ups
From: Alexandre Bounine @ 2008-02-08 19:16 UTC (permalink / raw)
To: jgarzik, netdev; +Cc: linuxppc-dev, Josh Boyer, Zang Roy-r61911
This is set of small fixes for Tsi108 Ethernet driver.
Based on kernel version 2.6.24
---
Important Notice: This message is intended for the use of the individual to whom it is addressed and may contain information which is privileged, confidential and/or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or is not the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone or return e-mail and delete the original message from your systems. Thank you.
^ permalink raw reply
* [PATCH 3/5] Tsi108_eth: remove not needed code
From: Alexandre Bounine @ 2008-02-08 19:17 UTC (permalink / raw)
To: jgarzik, netdev; +Cc: linuxppc-dev, Josh Boyer, Zang Roy-r61911
Code clean-up for tsi108_eth network driver.
This patch removes not needed dummy read and the corresponding comment.
The PHY logic requires two reads from the status register to get
current link status. This is done correctly inside mii_check_media().
Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
---
diff -pNur linux-2.6.24/drivers/net/tsi108_eth.c
linux-2.6.24-fix/drivers/net/tsi108_eth.c
--- linux-2.6.24/drivers/net/tsi108_eth.c 2008-02-06
15:47:35.000000000 -0500
+++ linux-2.6.24-fix/drivers/net/tsi108_eth.c 2008-02-06
15:54:14.000000000 -0500
@@ -297,18 +297,11 @@ static void tsi108_check_phy(struct net_
u32 speed;
unsigned long flags;
- /* Do a dummy read, as for some reason the first read
- * after a link becomes up returns link down, even if
- * it's been a while since the link came up.
- */
-
spin_lock_irqsave(&phy_lock, flags);
if (!data->phy_ok)
goto out;
- tsi108_read_mii(data, MII_BMSR);
-
duplex = mii_check_media(&data->mii_if, netif_msg_link(data),
data->init_media);
data->init_media = 0;
---
Important Notice: This message is intended for the use of the individual to whom it is addressed and may contain information which is privileged, confidential and/or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or is not the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone or return e-mail and delete the original message from your systems. Thank you.
^ permalink raw reply
* [PATCH 5/5] Tsi108_eth: Add ethtool support
From: Alexandre Bounine @ 2008-02-08 19:17 UTC (permalink / raw)
To: jgarzik, netdev; +Cc: linuxppc-dev, Josh Boyer, Zang Roy-r61911
Add ethtool support to tsi108_eth network driver.
Signed-off-by: Alexandre Bounine <alexandreb@tundra.com>
---
diff -pNur linux-2.6.24/drivers/net/tsi108_eth.c
linux-2.6.24-fix/drivers/net/tsi108_eth.c
--- linux-2.6.24/drivers/net/tsi108_eth.c 2008-02-06
17:10:53.000000000 -0500
+++ linux-2.6.24-fix/drivers/net/tsi108_eth.c 2008-02-06
18:09:43.000000000 -0500
@@ -36,6 +36,7 @@
#include <linux/net.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/ethtool.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -1519,12 +1520,46 @@ static void tsi108_init_mac(struct net_d
TSI_WRITE(TSI108_EC_INTMASK, ~0);
}
+static int tsi108_get_settings(struct net_device *dev, struct
ethtool_cmd *cmd)
+{
+ struct tsi108_prv_data *data = netdev_priv(dev);
+ unsigned long flags;
+ int rc;
+
+ spin_lock_irqsave(&data->txlock, flags);
+ rc = mii_ethtool_gset(&data->mii_if, cmd);
+ spin_unlock_irqrestore(&data->txlock, flags);
+
+ return rc;
+}
+
+static int tsi108_set_settings(struct net_device *dev, struct
ethtool_cmd *cmd)
+{
+ struct tsi108_prv_data *data = netdev_priv(dev);
+ unsigned long flags;
+ int rc;
+
+ spin_lock_irqsave(&data->txlock, flags);
+ rc = mii_ethtool_sset(&data->mii_if, cmd);
+ spin_unlock_irqrestore(&data->txlock, flags);
+
+ return rc;
+}
+
static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq,
int cmd)
{
struct tsi108_prv_data *data = netdev_priv(dev);
+ if (!netif_running(dev))
+ return -EINVAL;
return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL);
}
+static const struct ethtool_ops tsi108_ethtool_ops = {
+ .get_link = ethtool_op_get_link,
+ .get_settings = tsi108_get_settings,
+ .set_settings = tsi108_set_settings,
+};
+
static int
tsi108_init_one(struct platform_device *pdev)
{
@@ -1589,6 +1624,7 @@ tsi108_init_one(struct platform_device *
dev->get_stats = tsi108_get_stats;
netif_napi_add(dev, &data->napi, tsi108_poll, 64);
dev->do_ioctl = tsi108_do_ioctl;
+ dev->ethtool_ops = &tsi108_ethtool_ops;
/* Apparently, the Linux networking code won't use
scatter-gather
* if the hardware doesn't do checksums. However, it's faster
---
Important Notice: This message is intended for the use of the individual to whom it is addressed and may contain information which is privileged, confidential and/or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or is not the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone or return e-mail and delete the original message from your systems. Thank you.
^ 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