* [PATCH 6/6]: [CASSINI]: Bump driver version and release date.
From: David Miller @ 2008-01-04 8:35 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
[CASSINI]: Bump driver version and release date.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/cassini.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index c3220e4..3a9bb17 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -142,8 +142,8 @@
#define DRV_MODULE_NAME "cassini"
#define PFX DRV_MODULE_NAME ": "
-#define DRV_MODULE_VERSION "1.4"
-#define DRV_MODULE_RELDATE "1 July 2004"
+#define DRV_MODULE_VERSION "1.5"
+#define DRV_MODULE_RELDATE "4 Jan 2007"
#define CAS_DEF_MSG_ENABLE \
(NETIF_MSG_DRV | \
--
1.5.4.rc2.17.g257f
^ permalink raw reply related
* [PATCH 4/6]: [CASSINI]: Set skb->truesize properly on receive packets.
From: David Miller @ 2008-01-04 8:34 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
[CASSINI]: Set skb->truesize properly on receive packets.
skb->truesize was not being incremented at all to
reflect the page based data added to RX SKBs.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/cassini.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 2336223..92821ae 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2037,6 +2037,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
skb_shinfo(skb)->nr_frags++;
skb->data_len += hlen - swivel;
+ skb->truesize += hlen - swivel;
skb->len += hlen - swivel;
get_page(page->buffer);
--
1.5.4.rc2.17.g257f
^ permalink raw reply related
* [PATCH 5/6]: [CASSINI]: Fix two obvious NAPI bugs.
From: David Miller @ 2008-01-04 8:34 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
[CASSINI]: Fix two obvious NAPI bugs.
1) close should do napi_disable() not napi_enable
2) remove unused local var 'todo'
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/cassini.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 92821ae..c3220e4 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2586,7 +2586,7 @@ static int cas_poll(struct napi_struct *napi, int budget)
{
struct cas *cp = container_of(napi, struct cas, napi);
struct net_device *dev = cp->dev;
- int i, enable_intr, todo, credits;
+ int i, enable_intr, credits;
u32 status = readl(cp->regs + REG_INTR_STATUS);
unsigned long flags;
@@ -4350,7 +4350,7 @@ static int cas_close(struct net_device *dev)
struct cas *cp = netdev_priv(dev);
#ifdef USE_NAPI
- napi_enable(&cp->napi);
+ napi_disable(&cp->napi);
#endif
/* Make sure we don't get distracted by suspend/resume */
mutex_lock(&cp->pm_mutex);
--
1.5.4.rc2.17.g257f
^ permalink raw reply related
* [PATCH 0/0]: Cassini bug fixes.
From: David Miller @ 2008-01-04 8:32 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
Over the past day I've put together the following set of bug fixes for
the Cassini driver.
At least with my setup it appears to basically work fine, not leak
memory, and the SKB BUG messages go away too.
I'll be honest and say that I've devoted a couple days to this work,
and therefore I have to turn my attention back to other tasks. As a
result, it means it will be some time before I can look seriously into
any feedback folks provide. And for that I apologize, but this
already consumed too much of my time.
I'll be pushing these to Linus and -stable shortly.
Thanks.
^ permalink raw reply
* [PATCH 2/6]: [CASSINI]: Revert 'dont touch page_count'.
From: David Miller @ 2008-01-04 8:33 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
[CASSINI]: Revert 'dont touch page_count'.
This reverts changeset fa4f0774d7c6cccb4d1fda76b91dd8eddcb2dd6a
([CASSINI]: dont touch page_count) because it breaks the driver.
The local page counting added by this changeset did not account
for the asynchronous page count changes done by kfree_skb()
and friends.
The change adds extra atomics and on top of it all appears to be
totally unnecessary as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/cassini.c | 36 ++++--------------------------------
1 files changed, 4 insertions(+), 32 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 9030ca5..ff957f2 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -336,30 +336,6 @@ static inline void cas_mask_intr(struct cas *cp)
cas_disable_irq(cp, i);
}
-static inline void cas_buffer_init(cas_page_t *cp)
-{
- struct page *page = cp->buffer;
- atomic_set((atomic_t *)&page->lru.next, 1);
-}
-
-static inline int cas_buffer_count(cas_page_t *cp)
-{
- struct page *page = cp->buffer;
- return atomic_read((atomic_t *)&page->lru.next);
-}
-
-static inline void cas_buffer_inc(cas_page_t *cp)
-{
- struct page *page = cp->buffer;
- atomic_inc((atomic_t *)&page->lru.next);
-}
-
-static inline void cas_buffer_dec(cas_page_t *cp)
-{
- struct page *page = cp->buffer;
- atomic_dec((atomic_t *)&page->lru.next);
-}
-
static void cas_enable_irq(struct cas *cp, const int ring)
{
if (ring == 0) { /* all but TX_DONE */
@@ -497,7 +473,6 @@ static int cas_page_free(struct cas *cp, cas_page_t *page)
{
pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size,
PCI_DMA_FROMDEVICE);
- cas_buffer_dec(page);
__free_pages(page->buffer, cp->page_order);
kfree(page);
return 0;
@@ -527,7 +502,6 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags)
page->buffer = alloc_pages(flags, cp->page_order);
if (!page->buffer)
goto page_err;
- cas_buffer_init(page);
page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0,
cp->page_size, PCI_DMA_FROMDEVICE);
return page;
@@ -606,7 +580,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags)
list_for_each_safe(elem, tmp, &list) {
cas_page_t *page = list_entry(elem, cas_page_t, list);
- if (cas_buffer_count(page) > 1)
+ if (page_count(page->buffer) > 1)
continue;
list_del(elem);
@@ -1374,7 +1348,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index)
cas_page_t *page = cp->rx_pages[1][index];
cas_page_t *new;
- if (cas_buffer_count(page) == 1)
+ if (page_count(page->buffer) == 1)
return page;
new = cas_page_dequeue(cp);
@@ -1394,7 +1368,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring,
cas_page_t **page1 = cp->rx_pages[1];
/* swap if buffer is in use */
- if (cas_buffer_count(page0[index]) > 1) {
+ if (page_count(page0[index]->buffer) > 1) {
cas_page_t *new = cas_page_spare(cp, index);
if (new) {
page1[index] = page0[index];
@@ -2066,7 +2040,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
skb->len += hlen - swivel;
get_page(page->buffer);
- cas_buffer_inc(page);
frag->page = page->buffer;
frag->page_offset = off;
frag->size = hlen - swivel;
@@ -2091,7 +2064,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
frag++;
get_page(page->buffer);
- cas_buffer_inc(page);
frag->page = page->buffer;
frag->page_offset = 0;
frag->size = hlen;
@@ -2255,7 +2227,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num)
released = 0;
while (entry != last) {
/* make a new buffer if it's still in use */
- if (cas_buffer_count(page[entry]) > 1) {
+ if (page_count(page[entry]->buffer) > 1) {
cas_page_t *new = cas_page_dequeue(cp);
if (!new) {
/* let the timer know that we need to
--
1.5.4.rc2.17.g257f
^ permalink raw reply related
* [PATCH 1/6]: [CASSINI]: Fix endianness bug.
From: David Miller @ 2008-01-04 8:33 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
[CASSINI]: Fix endianness bug.
Here's proposed fix for RX checksum handling in cassini; it affects
little-endian working with half-duplex gigabit, but obviously needs
testing on big-endian too.
The problem is, we need to convert checksum to fixed-endian *before*
correcting for (unstripped) FCS. On big-endian it won't matter
(conversion is no-op), on little-endian it will, but only if FCS is
not stripped by hardware; i.e. in half-duplex gigabit mode when
->crc_size is set.
cassini.c part is that fix, cassini.h one consists of trivial
endianness annotations. With that applied the sucker is endian-clean,
according to sparse.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/cassini.c | 8 +++++---
drivers/net/cassini.h | 18 +++++++++---------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7df31b5..9030ca5 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -1979,6 +1979,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
struct cas_page *page;
struct sk_buff *skb;
void *addr, *crcaddr;
+ __sum16 csum;
char *p;
hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]);
@@ -2158,14 +2159,15 @@ end_copy_pkt:
skb_put(skb, alloclen);
}
- i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]);
+ csum = (__force __sum16)htons(CAS_VAL(RX_COMP4_TCP_CSUM, words[3]));
if (cp->crc_size) {
/* checksum includes FCS. strip it out. */
- i = csum_fold(csum_partial(crcaddr, cp->crc_size, i));
+ csum = csum_fold(csum_partial(crcaddr, cp->crc_size,
+ csum_unfold(csum)));
if (addr)
cas_page_unmap(addr);
}
- skb->csum = ntohs(i ^ 0xffff);
+ skb->csum = csum_unfold(~csum);
skb->ip_summed = CHECKSUM_COMPLETE;
skb->protocol = eth_type_trans(skb, cp->dev);
return len;
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h
index 2f93f83..552af89 100644
--- a/drivers/net/cassini.h
+++ b/drivers/net/cassini.h
@@ -4122,8 +4122,8 @@ cas_saturn_patch_t cas_saturn_patch[] = {
inserted into
outgoing frame. */
struct cas_tx_desc {
- u64 control;
- u64 buffer;
+ __le64 control;
+ __le64 buffer;
};
/* descriptor ring for free buffers contains page-sized buffers. the index
@@ -4131,8 +4131,8 @@ struct cas_tx_desc {
* the completion ring.
*/
struct cas_rx_desc {
- u64 index;
- u64 buffer;
+ __le64 index;
+ __le64 buffer;
};
/* received packets are put on the completion ring. */
@@ -4210,10 +4210,10 @@ struct cas_rx_desc {
#define RX_INDEX_RELEASE 0x0000000000002000ULL
struct cas_rx_comp {
- u64 word1;
- u64 word2;
- u64 word3;
- u64 word4;
+ __le64 word1;
+ __le64 word2;
+ __le64 word3;
+ __le64 word4;
};
enum link_state {
@@ -4252,7 +4252,7 @@ struct cas_init_block {
struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP];
struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC];
struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX];
- u64 tx_compwb;
+ __le64 tx_compwb;
};
/* tiny buffers to deal with target abort issue. we allocate a bit
--
1.5.4.rc2.17.g257f
^ permalink raw reply related
* [PATCH 3/6]: [CASSINI]: Program parent Intel31154 bridge when necessary.
From: David Miller @ 2008-01-04 8:33 UTC (permalink / raw)
To: netdev; +Cc: panther, bazsi, hidden
[CASSINI]: Program parent Intel31154 bridge when necessary.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/cassini.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 86 insertions(+), 0 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index ff957f2..2336223 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4846,6 +4846,90 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return rc;
}
+/* When this chip sits underneath an Intel 31154 bridge, it is the
+ * only subordinate device and we can tweak the bridge settings to
+ * reflect that fact.
+ */
+static void __devinit cas_program_bridge(struct pci_dev *cas_pdev)
+{
+ struct pci_dev *pdev = cas_pdev->bus->self;
+ u32 val;
+
+ if (!pdev)
+ return;
+
+ if (pdev->vendor != 0x8086 || pdev->device != 0x537c)
+ return;
+
+ /* Clear bit 10 (Bus Parking Control) in the Secondary
+ * Arbiter Control/Status Register which lives at offset
+ * 0x41. Using a 32-bit word read/modify/write at 0x40
+ * is much simpler so that's how we do this.
+ */
+ pci_read_config_dword(pdev, 0x40, &val);
+ val &= ~0x00040000;
+ pci_write_config_dword(pdev, 0x40, val);
+
+ /* Max out the Multi-Transaction Timer settings since
+ * Cassini is the only device present.
+ *
+ * The register is 16-bit and lives at 0x50. When the
+ * settings are enabled, it extends the GRANT# signal
+ * for a requestor after a transaction is complete. This
+ * allows the next request to run without first needing
+ * to negotiate the GRANT# signal back.
+ *
+ * Bits 12:10 define the grant duration:
+ *
+ * 1 -- 16 clocks
+ * 2 -- 32 clocks
+ * 3 -- 64 clocks
+ * 4 -- 128 clocks
+ * 5 -- 256 clocks
+ *
+ * All other values are illegal.
+ *
+ * Bits 09:00 define which REQ/GNT signal pairs get the
+ * GRANT# signal treatment. We set them all.
+ */
+ pci_write_config_word(pdev, 0x50, (5 << 10) | 0x3ff);
+
+ /* The Read Prefecth Policy register is 16-bit and sits at
+ * offset 0x52. It enables a "smart" pre-fetch policy. We
+ * enable it and max out all of the settings since only one
+ * device is sitting underneath and thus bandwidth sharing is
+ * not an issue.
+ *
+ * The register has several 3 bit fields, which indicates a
+ * multiplier applied to the base amount of prefetching the
+ * chip would do. These fields are at:
+ *
+ * 15:13 --- ReRead Primary Bus
+ * 12:10 --- FirstRead Primary Bus
+ * 09:07 --- ReRead Secondary Bus
+ * 06:04 --- FirstRead Secondary Bus
+ *
+ * Bits 03:00 control which REQ/GNT pairs the prefetch settings
+ * get enabled on. Bit 3 is a grouped enabler which controls
+ * all of the REQ/GNT pairs from [8:3]. Bits 2 to 0 control
+ * the individual REQ/GNT pairs [2:0].
+ */
+ pci_write_config_word(pdev, 0x52,
+ (0x7 << 13) |
+ (0x7 << 10) |
+ (0x7 << 7) |
+ (0x7 << 4) |
+ (0xf << 0));
+
+ /* Force cacheline size to 0x8 */
+ pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08);
+
+ /* Force latency timer to maximum setting so Cassini can
+ * sit on the bus as long as it likes.
+ */
+ pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff);
+}
+
static int __devinit cas_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -4901,6 +4985,8 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
printk(KERN_WARNING PFX "Could not enable MWI for %s\n",
pci_name(pdev));
+ cas_program_bridge(pdev);
+
/*
* On some architectures, the default cache line size set
* by pci_try_set_mwi reduces perforamnce. We have to increase
--
1.5.4.rc2.17.g257f
^ permalink raw reply related
* Re: [ICMP]: Avoid sparse warnings in net/ipv4/icmp.c
From: David Miller @ 2008-01-04 8:51 UTC (permalink / raw)
To: dada1; +Cc: netdev
In-Reply-To: <477DC564.4050008@cosmosbay.com>
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Fri, 04 Jan 2008 06:34:28 +0100
> David Miller a écrit :
> > Please use "inline" instead of "__inline__". If other stuff
> > uses __inline__ in that file, feel free to fix it up too.
>
> You are right, here is the updated version
Applied, thanks Eric.
^ permalink raw reply
* Re: [PATCH] [INET] Fix netdev renaming and inet address labels
From: David Miller @ 2008-01-04 8:57 UTC (permalink / raw)
To: markmc; +Cc: netdev
In-Reply-To: <1199375823-28729-1-git-send-email-markmc@redhat.com>
From: Mark McLoughlin <markmc@redhat.com>
Date: Thu, 3 Jan 2008 15:57:03 +0000
> When re-naming an interface, the previous secondary address
> labels get lost e.g.
>
> $> brctl addbr foo
> $> ip addr add 192.168.0.1 dev foo
> $> ip addr add 192.168.0.2 dev foo label foo:00
> $> ip addr show dev foo | grep inet
> inet 192.168.0.1/32 scope global foo
> inet 192.168.0.2/32 scope global foo:00
> $> ip link set foo name bar
> $> ip addr show dev bar | grep inet
> inet 192.168.0.1/32 scope global bar
> inet 192.168.0.2/32 scope global bar:2
>
> Turns out to be a simple thinko in inetdev_changename() - clearly we
> want to look at the address label, rather than the device name, for
> a suffix to retain.
>
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This bug has been there since the function in question was
written :-)
Patch applied, thanks Mark.
^ permalink raw reply
* Re: [PATCH 0/0]: Cassini bug fixes.
From: Balazs Scheidler @ 2008-01-04 9:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev, panther, hidden
In-Reply-To: <20080104.003231.127196736.davem@davemloft.net>
On Fri, 2008-01-04 at 00:32 -0800, David Miller wrote:
> Over the past day I've put together the following set of bug fixes for
> the Cassini driver.
>
> At least with my setup it appears to basically work fine, not leak
> memory, and the SKB BUG messages go away too.
>
> I'll be honest and say that I've devoted a couple days to this work,
> and therefore I have to turn my attention back to other tasks. As a
> result, it means it will be some time before I can look seriously into
> any feedback folks provide. And for that I apologize, but this
> already consumed too much of my time.
>
> I'll be pushing these to Linus and -stable shortly.
Thank you very much. I'll see to test these patches on real hardware, a
minor problem is that we already returned the cards. I'm trying to get
them back.
--
Bazsi
^ permalink raw reply
* driver for et131x?
From: Manfred Schwarb @ 2008-01-04 10:02 UTC (permalink / raw)
To: netdev; +Cc: Dean Adams
[ next try, first attempt was blocked because of an '@' in 'X-Sender:' line? ]
Hi,
meanwhile the Agere et1310 chip has grown to a quite popular network
chip, in laptops as well as for PCI-E cards. The release date of this chip was
already in June 2004, and still no support in mainline linux.
There is apparently an opensource driver from Agere which is maintained by
volunteers at http://sourceforge.net/projects/et131x/
It seems some distros (e.g. Ubuntu) even patch their kernels with this driver.
Please consider adding support for this chip in mainline linux.
Thanks a lot!
Manfred
see also:
http://lkml.org/lkml/2006/7/3/123
http://dadams1969.googlepages.com/et131xkernelmodule
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
^ permalink raw reply
* Re: forcedeth: MAC-address reversed on resume from suspend
From: Björn Steinbrink @ 2008-01-04 10:17 UTC (permalink / raw)
To: Andreas Mohr
Cc: Adrian Bunk, Richard Jonsson, linux-kernel, Ayaz Abdulla, jgarzik,
netdev
In-Reply-To: <20080104084517.GA21628@rhlx01.hs-esslingen.de>
On 2008.01.04 09:45:17 +0100, Andreas Mohr wrote:
> Hi,
>
> On Fri, Jan 04, 2008 at 04:43:57AM +0100, Björn Steinbrink wrote:
> > On 2008.01.03 01:42:09 +0200, Adrian Bunk wrote:
> > > [ original bug report: http://lkml.org/lkml/2008/1/2/253 ]
> > >
> > > On Wed, Jan 02, 2008 at 10:48:43PM +0100, Andreas Mohr wrote:
> > > > The nv_probe() function then nicely obeys this flag by reversing the
> > > > address if needed, _however_ there's another function,
> > > > nv_copy_mac_to_hw(), which does _NOT_ obey it and simply copies the
> > > > _raw_ netdev dev_addr to the card register (NvRegMacAddrA etc.).
> >
> > nv_copy_mac_to_hw() is called from nv_probe() _after_ the MAC address
> > has been fixed, and from nv_set_mac_address() which is supposed to get a
> > correct MAC address anyway. So I don't see any problem there.
>
> /* set permanent address to be correct aswell */
> ... orig_mac fumbling ...
>
> Why, then, does this driver do such a nice hack as:
>
> /* special op: write back the misordered MAC address - otherwise
> * the next nv_probe would see a wrong address.
> */
> writel(np->orig_mac[0], base + NvRegMacAddrA);
> writel(np->orig_mac[1], base + NvRegMacAddrB);
>
> I really don't see why this driver needs to do these things in such a
> messy way.
Sure you can add some layers of wrappers and then have
"nv_store_mac(np->orig_mac)" instead. Congratulations, you saved 2 lines
and added 6 new ones (assuming that you don't go universally u8, that
adds even more). This is the only place that writes the MAC address
besides the existing nv_copy_mac_to_hw wrapper which deals with
net_devices and thus is perfectly usable, internally and externally.
> One thing is for certain: netdev->dev_addr is always in operating system
> order, and order should always be handled properly when copying to/from
> hardware.
>
> Such a driver needs exactly *one* central helper method
> to reverse an input MAC address in 6 bytes u8 format
> (which could arguably be added to include/linux/etherdevice.h even,
> since a wee bit too many devices seem to be having trouble
> with wrongly ordered MAC addresses).
> Then it needs exactly *one* function for I/O register access
> to read a MAC address from a device and exactly *one* function
> to write it back (both doing raw, unsorted format transfers only,
> and possibly as inline function).
A function to read the MAC address from the hardware? There's only a
single place (nv_probe()) that ever reads it, why bother?
> And then it needs these card I/O functions wrapped into two functions which
> interface with driver- and OS-related MAC variables
> (struct variables ALWAYS stored in usual system order, NOT H/W order!!!!!!)
> which optionally reverse the address (if needed for a particular card).
Hu? The MAC address is only ever reversed when the card is not in use,
why the hell would you want to reverse anything when the rest of the OS
is involved? This whole reversing stuff is purely before and after the
card is actually used. It's not that you need to reverse the address to
communicate with the card, it's just initially wrong on the card.
> And then there will never be any confusion about any MAC address format
> anywhere any more, right?
At probing time, you'll have to know whether the address you read from
the hardware is reversed or not. Unless you write it back in reversed
order when you release the card, you need a flag that at least survives
until nv_probe is called the next time. kexec does not write it back, so
you do need such a flag. But the flag apparently doesn't survive a
suspend/resume cycle, so you need to write back the reversed address
then. But the flag will survive a rmmod + modprobe cycle, so you need to
reset it when writing back the reversed address.
> I really don't mean to sound cranky, but this driver did ask for trouble,
> and lots of it ;)
>
> Thank you for your reply, and especially thank you for this very fast
> patch!
Well, let's see if my analysis was correct and the patch works, first. I
saw the forcedeth code before, but kexec and suspend is totally new to
me and I just made some assumptions based on the reported behaviour and
the commit messages... ;-)
Björn
^ permalink raw reply
* Re: 2.6.24-rc6-mm1
From: Torsten Kaiser @ 2008-01-04 10:23 UTC (permalink / raw)
To: Herbert Xu
Cc: Andrew Morton, linux-kernel, Neil Brown, J. Bruce Fields, netdev,
Tom Tucker
In-Reply-To: <20080102215154.GA13911@gondor.apana.org.au>
On Jan 2, 2008 10:51 PM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Wed, Jan 02, 2008 at 07:29:59PM +0100, Torsten Kaiser wrote:
> >
> > Vanilla 2.6.24-rc6 seems stable. I did not see any crash or warnings.
>
> OK that's great. The next step would be to try excluding specific git
> trees from mm to see if they make a difference.
>
> The two specific trees of interest would be git-nfsd and git-net.
git-nfsd from git://git.linux-nfs.org/projects/bfields/linux.git#for-mm
-> compiling and installing 54 packages worked without crashes.
git-net from git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25.git
-> compiling and installing 95 packages worked without crashes.
The only thing in the announces of 2.6.24-rc3-mm1/2 that stands out for me is:
+iommu-sg-merging-add-device_dma_parameters-structure.patch
+iommu-sg-merging-pci-add-device_dma_parameters-support.patch
+iommu-sg-merging-x86-make-pci-gart-iommu-respect-the-segment-size-limits.patch
+iommu-sg-merging-ppc-make-iommu-respect-the-segment-size-limits.patch
+iommu-sg-merging-ia64-make-sba_iommu-respect-the-segment-size-limits.patch
+iommu-sg-merging-alpha-make-pci_iommu-respect-the-segment-size-limits.patch
+iommu-sg-merging-sparc64-make-iommu-respect-the-segment-size-limits.patch
+iommu-sg-merging-parisc-make-iommu-respect-the-segment-size-limits.patch
+iommu-sg-merging-call-blk_queue_segment_boundary-in-__scsi_alloc_queue.patch
+iommu-sg-merging-sata_inic162x-use-pci_set_dma_max_seg_size.patch
+iommu-sg-merging-aacraid-use-pci_set_dma_max_seg_size.patch
iommu work
I will enable CONFIG_IOMMU_DEBUG in -rc6-mm1 and see, as otherwise I
have no clue where to look...
Torsten
^ permalink raw reply
* Re: [PATCH 6/6]: [CASSINI]: Bump driver version and release date.
From: KOVACS Krisztian @ 2008-01-04 10:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, panther, bazsi, hidden
In-Reply-To: <20080104.003512.18469292.davem@davemloft.net>
Hi,
On p, jan 04, 2008 at 12:35:12 -0800, David Miller wrote:
> [CASSINI]: Bump driver version and release date.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> drivers/net/cassini.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
> index c3220e4..3a9bb17 100644
> --- a/drivers/net/cassini.c
> +++ b/drivers/net/cassini.c
> @@ -142,8 +142,8 @@
>
> #define DRV_MODULE_NAME "cassini"
> #define PFX DRV_MODULE_NAME ": "
> -#define DRV_MODULE_VERSION "1.4"
> -#define DRV_MODULE_RELDATE "1 July 2004"
> +#define DRV_MODULE_VERSION "1.5"
> +#define DRV_MODULE_RELDATE "4 Jan 2007"
Erm, 2008?
> #define CAS_DEF_MSG_ENABLE \
> (NETIF_MSG_DRV | \
> --
> 1.5.4.rc2.17.g257f
>
--
KOVACS Krisztian
^ permalink raw reply
* Re: [PATCH 6/6]: [CASSINI]: Bump driver version and release date.
From: David Miller @ 2008-01-04 10:26 UTC (permalink / raw)
To: hidden; +Cc: netdev, panther, bazsi
In-Reply-To: <20080104102507.GA31476@sch.bme.hu>
From: KOVACS Krisztian <hidden@sch.bme.hu>
Date: Fri, 4 Jan 2008 11:25:08 +0100
> Hi,
>
> On p, jan 04, 2008 at 12:35:12 -0800, David Miller wrote:
> > #define DRV_MODULE_NAME "cassini"
> > #define PFX DRV_MODULE_NAME ": "
> > -#define DRV_MODULE_VERSION "1.4"
> > -#define DRV_MODULE_RELDATE "1 July 2004"
> > +#define DRV_MODULE_VERSION "1.5"
> > +#define DRV_MODULE_RELDATE "4 Jan 2007"
>
> Erm, 2008?
Thanks :-) I'll fix that.
^ permalink raw reply
* [PATCH] (Revised) USB VID/PID clash between pegasus and hci_usb drivers
From: Chris Rankin @ 2008-01-04 11:07 UTC (permalink / raw)
To: netdev; +Cc: marcel, greg
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Hi,
I have surprisingly managed to track down the USB device descriptor for the wired Belkin network
adapter, and it looks as if the device class is actually 0x00 instead of 0xFF. I originally used
0xFF because that is what my 3com device used (for some reason) and so I was hoping that Belkin
would also use 0xFF for the same reason.
But anyway, here is the new patch.
Cheers,
Chris
__________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 984420339-PEGASUS.diff --]
[-- Type: text/x-patch; name="PEGASUS.diff", Size: 2220 bytes --]
--- linux-2.6.23/drivers/net/usb/pegasus.h.orig 2007-12-31 12:54:44.000000000 +0000
+++ linux-2.6.23/drivers/net/usb/pegasus.h 2007-12-31 13:06:18.000000000 +0000
@@ -202,8 +202,12 @@
DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
DEFAULT_GPIO_RESET | PEGASUS_II )
-PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121,
- DEFAULT_GPIO_RESET | PEGASUS_II )
+/*
+ * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors
+ * with the same product IDs by checking the device class too.
+ */
+PEGASUS_DEV_CLASS( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
+ DEFAULT_GPIO_RESET | PEGASUS_II )
PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
DEFAULT_GPIO_RESET )
PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
--- linux-2.6.23/drivers/net/usb/pegasus.c.orig 2007-12-31 12:54:44.000000000 +0000
+++ linux-2.6.23/drivers/net/usb/pegasus.c 2007-12-31 13:04:35.000000000 +0000
@@ -62,8 +62,11 @@
static struct usb_eth_dev usb_dev_id[] = {
#define PEGASUS_DEV(pn, vid, pid, flags) \
{.name = pn, .vendor = vid, .device = pid, .private = flags},
+#define PEGASUS_DEV_CLASS(pn, vid, pid, dclass, flags) \
+ PEGASUS_DEV(pn, vid, pid, flags)
#include "pegasus.h"
#undef PEGASUS_DEV
+#undef PEGASUS_DEV_CLASS
{NULL, 0, 0, 0},
{NULL, 0, 0, 0}
};
@@ -71,8 +74,18 @@
static struct usb_device_id pegasus_ids[] = {
#define PEGASUS_DEV(pn, vid, pid, flags) \
{.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid},
+/*
+ * The Belkin F8T012xx1 bluetooth adaptor has the same vendor and product
+ * IDs as the Belkin F5D5050, so we need to teach the pegasus driver to
+ * ignore adaptors belonging to the "Wireless" class 0xE0. For this one
+ * case anyway, seeing as the pegasus is for "Wired" adaptors.
+ */
+#define PEGASUS_DEV_CLASS(pn, vid, pid, dclass, flags) \
+ {.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_CLASS), \
+ .idVendor = vid, .idProduct = pid, .bDeviceClass = dclass},
#include "pegasus.h"
#undef PEGASUS_DEV
+#undef PEGASUS_DEV_CLASS
{},
{}
};
Signed-off-by: Chris Rankin <rankincj@yahoo.com>
^ permalink raw reply
* [patch 0/9][NETNS][IPV6] make sysctl per namespace
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
The following patchset makes the ipv6 sysctl to handle multiple
network namespaces. Each instance of a network namespace as its own
set of sysctl values, that means the behavior of the ipv6 stack can be
different depending on the sysctl values setup in the different
network namespaces.
Changelog:
V2 : make the mld_max_msf variable readonly when we are
not in the initial network namespace
V1 : initial post
--
^ permalink raw reply
* [patch 4/9][NETNS][IPV6] make multiple instance of sysctl tables
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/make-ipv6-sysctl-per-namespace.patch --]
[-- Type: text/plain, Size: 5934 bytes --]
Each network namespace wants its own set of sysctl value, eg. we should
not be able from a namespace to set a sysctl value for another namespace
, especially for the initial network namespace.
This patch duplicates the sysctl table when we register a new network
namespace for ipv6. The duplicated table are postfixed with the "template"
word to notify the developper the table is cloned.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/ipv6.h | 4 +-
include/net/netns/ipv6.h | 9 ++++++
net/ipv6/icmp.c | 12 +++++++-
net/ipv6/route.c | 11 ++++++-
net/ipv6/sysctl_net_ipv6.c | 67 +++++++++++++++++++++++++++++++++++++--------
5 files changed, 88 insertions(+), 15 deletions(-)
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -14,20 +14,23 @@
#include <net/addrconf.h>
#include <net/inet_frag.h>
-static ctl_table ipv6_table[] = {
+extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
+extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
+
+static ctl_table ipv6_table_template[] = {
{
.ctl_name = NET_IPV6_ROUTE,
.procname = "route",
.maxlen = 0,
.mode = 0555,
- .child = ipv6_route_table
+ .child = ipv6_route_table_template
},
{
.ctl_name = NET_IPV6_ICMP,
.procname = "icmp",
.maxlen = 0,
.mode = 0555,
- .child = ipv6_icmp_table
+ .child = ipv6_icmp_table_template
},
{
.ctl_name = NET_IPV6_BINDV6ONLY,
@@ -88,20 +91,62 @@ static struct ctl_path ipv6_ctl_path[] =
{ },
};
-static struct ctl_table_header *ipv6_sysctl_header;
-
static int ipv6_sysctl_net_init(struct net *net)
{
- ipv6_sysctl_header = register_net_sysctl_table(net, ipv6_ctl_path, ipv6_table);
- if (!ipv6_sysctl_header)
- return -ENOMEM;
-
- return 0;
+ struct ctl_table *ipv6_table;
+ struct ctl_table *ipv6_route_table;
+ struct ctl_table *ipv6_icmp_table;
+ int err;
+
+ err = -ENOMEM;
+ ipv6_table = kmemdup(ipv6_table_template, sizeof(ipv6_table_template),
+ GFP_KERNEL);
+ if (!ipv6_table)
+ goto out;
+
+ ipv6_route_table = ipv6_route_sysctl_init(net);
+ if (!ipv6_route_table)
+ goto out_ipv6_table;
+
+ ipv6_icmp_table = ipv6_icmp_sysctl_init(net);
+ if (!ipv6_icmp_table)
+ goto out_ipv6_route_table;
+
+ ipv6_table[0].child = ipv6_route_table;
+ ipv6_table[1].child = ipv6_icmp_table;
+
+ net->ipv6.sysctl.table = register_net_sysctl_table(net, ipv6_ctl_path, ipv6_table);
+ if (!net->ipv6.sysctl.table)
+ goto out_ipv6_icmp_table;
+
+ err = 0;
+out:
+ return err;
+
+out_ipv6_icmp_table:
+ kfree(ipv6_icmp_table);
+out_ipv6_route_table:
+ kfree(ipv6_route_table);
+out_ipv6_table:
+ kfree(ipv6_table);
+ goto out;
}
static void ipv6_sysctl_net_exit(struct net *net)
{
- unregister_net_sysctl_table(ipv6_sysctl_header);
+ struct ctl_table *ipv6_table;
+ struct ctl_table *ipv6_route_table;
+ struct ctl_table *ipv6_icmp_table;
+
+ ipv6_table = net->ipv6.sysctl.table->ctl_table_arg;
+ ipv6_route_table = ipv6_table[0].child;
+ ipv6_icmp_table = ipv6_table[1].child;
+
+ unregister_net_sysctl_table(net->ipv6.sysctl.table);
+
+ kfree(ipv6_table);
+ kfree(ipv6_route_table);
+ kfree(ipv6_icmp_table);
}
static struct pernet_operations ipv6_sysctl_net_ops = {
Index: net-2.6.25/include/net/netns/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/netns/ipv6.h
+++ net-2.6.25/include/net/netns/ipv6.h
@@ -5,6 +5,15 @@
#ifndef __NETNS_IPV6_H__
#define __NETNS_IPV6_H__
+struct ctl_table_header;
+
+struct netns_sysctl_ipv6 {
+ struct ctl_table_header *table;
+};
+
struct netns_ipv6 {
+#ifdef CONFIG_SYSCTL
+ struct netns_sysctl_ipv6 sysctl;
+#endif
};
#endif
Index: net-2.6.25/include/net/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/ipv6.h
+++ net-2.6.25/include/net/ipv6.h
@@ -617,8 +617,8 @@ static inline int snmp6_unregister_dev(s
#endif
#ifdef CONFIG_SYSCTL
-extern ctl_table ipv6_route_table[];
-extern ctl_table ipv6_icmp_table[];
+extern ctl_table ipv6_route_table_template[];
+extern ctl_table ipv6_icmp_table_template[];
extern int ipv6_sysctl_register(void);
extern void ipv6_sysctl_unregister(void);
Index: net-2.6.25/net/ipv6/icmp.c
===================================================================
--- net-2.6.25.orig/net/ipv6/icmp.c
+++ net-2.6.25/net/ipv6/icmp.c
@@ -909,7 +909,7 @@ int icmpv6_err_convert(int type, int cod
EXPORT_SYMBOL(icmpv6_err_convert);
#ifdef CONFIG_SYSCTL
-ctl_table ipv6_icmp_table[] = {
+ctl_table ipv6_icmp_table_template[] = {
{
.ctl_name = NET_IPV6_ICMP_RATELIMIT,
.procname = "ratelimit",
@@ -920,5 +920,15 @@ ctl_table ipv6_icmp_table[] = {
},
{ .ctl_name = 0 },
};
+
+struct ctl_table *ipv6_icmp_sysctl_init(struct net *net)
+{
+ struct ctl_table *table;
+
+ table = kmemdup(ipv6_icmp_table_template,
+ sizeof(ipv6_icmp_table_template),
+ GFP_KERNEL);
+ return table;
+}
#endif
Index: net-2.6.25/net/ipv6/route.c
===================================================================
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -2404,7 +2404,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table
return -EINVAL;
}
-ctl_table ipv6_route_table[] = {
+ctl_table ipv6_route_table_template[] = {
{
.procname = "flush",
.data = &flush_delay,
@@ -2494,6 +2494,15 @@ ctl_table ipv6_route_table[] = {
{ .ctl_name = 0 }
};
+struct ctl_table *ipv6_route_sysctl_init(struct net *net)
+{
+ struct ctl_table *table;
+
+ table = kmemdup(ipv6_route_table_template,
+ sizeof(ipv6_route_table_template),
+ GFP_KERNEL);
+ return table;
+}
#endif
int __init ip6_route_init(void)
--
^ permalink raw reply
* [patch 5/9][NETNS][IPV6] make bindv6only sysctl per namespace
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/move-bindv6only-to-netns.patch --]
[-- Type: text/plain, Size: 2833 bytes --]
This patch moves the bindv6only sysctl to the network namespace
structure. Until the ipv6 protocol is not per namespace, the sysctl
variable is always from the initial network namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/ipv6.h | 1 -
include/net/netns/ipv6.h | 1 +
net/ipv6/af_inet6.c | 4 +---
net/ipv6/sysctl_net_ipv6.c | 6 +++++-
4 files changed, 7 insertions(+), 5 deletions(-)
Index: net-2.6.25/include/net/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/ipv6.h
+++ net-2.6.25/include/net/ipv6.h
@@ -109,7 +109,6 @@ struct frag_hdr {
#include <net/sock.h>
/* sysctls */
-extern int sysctl_ipv6_bindv6only;
extern int sysctl_mld_max_msf;
#define _DEVINC(statname, modifier, idev, field) \
Index: net-2.6.25/include/net/netns/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/netns/ipv6.h
+++ net-2.6.25/include/net/netns/ipv6.h
@@ -9,6 +9,7 @@ struct ctl_table_header;
struct netns_sysctl_ipv6 {
struct ctl_table_header *table;
+ int bindv6only;
};
struct netns_ipv6 {
Index: net-2.6.25/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/af_inet6.c
+++ net-2.6.25/net/ipv6/af_inet6.c
@@ -66,8 +66,6 @@ MODULE_AUTHOR("Cast of dozens");
MODULE_DESCRIPTION("IPv6 protocol stack for Linux");
MODULE_LICENSE("GPL");
-int sysctl_ipv6_bindv6only __read_mostly;
-
/* The inetsw6 table contains everything that inet6_create needs to
* build a new socket.
*/
@@ -193,7 +191,7 @@ lookup_protocol:
np->mcast_hops = -1;
np->mc_loop = 1;
np->pmtudisc = IPV6_PMTUDISC_WANT;
- np->ipv6only = sysctl_ipv6_bindv6only;
+ np->ipv6only = init_net.ipv6.sysctl.bindv6only;
/* Init the ipv4 part of the socket since we can have sockets
* using v6 API for ipv4.
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -35,7 +35,7 @@ static ctl_table ipv6_table_template[] =
{
.ctl_name = NET_IPV6_BINDV6ONLY,
.procname = "bindv6only",
- .data = &sysctl_ipv6_bindv6only,
+ .data = &init_net.ipv6.sysctl.bindv6only,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
@@ -115,6 +115,10 @@ static int ipv6_sysctl_net_init(struct n
ipv6_table[0].child = ipv6_route_table;
ipv6_table[1].child = ipv6_icmp_table;
+ ipv6_table[2].data = &net->ipv6.sysctl.bindv6only;
+
+ net->ipv6.sysctl.bindv6only = 0;
+
net->ipv6.sysctl.table = register_net_sysctl_table(net, ipv6_ctl_path, ipv6_table);
if (!net->ipv6.sysctl.table)
goto out_ipv6_icmp_table;
--
^ permalink raw reply
* [patch 1/9][NETNS][IPV6] make ipv6_sysctl_register to return a value
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/ipv6-sysctl-register-return-value.patch --]
[-- Type: text/plain, Size: 2001 bytes --]
This patch makes the function ipv6_sysctl_register to return a
value. The af_inet6 init function is now able to handle an error
and catch it from the initialization of the sysctl.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/ipv6.h | 2 +-
net/ipv6/af_inet6.c | 5 ++++-
net/ipv6/sysctl_net_ipv6.c | 6 +++++-
3 files changed, 10 insertions(+), 3 deletions(-)
Index: net-2.6.25/include/net/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/ipv6.h
+++ net-2.6.25/include/net/ipv6.h
@@ -620,7 +620,7 @@ static inline int snmp6_unregister_dev(s
extern ctl_table ipv6_route_table[];
extern ctl_table ipv6_icmp_table[];
-extern void ipv6_sysctl_register(void);
+extern int ipv6_sysctl_register(void);
extern void ipv6_sysctl_unregister(void);
#endif
Index: net-2.6.25/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/af_inet6.c
+++ net-2.6.25/net/ipv6/af_inet6.c
@@ -783,7 +783,9 @@ static int __init inet6_init(void)
*/
#ifdef CONFIG_SYSCTL
- ipv6_sysctl_register();
+ err = ipv6_sysctl_register();
+ if (err)
+ goto sysctl_fail;
#endif
err = icmpv6_init(&inet6_family_ops);
if (err)
@@ -897,6 +899,7 @@ ndisc_fail:
icmp_fail:
#ifdef CONFIG_SYSCTL
ipv6_sysctl_unregister();
+sysctl_fail:
#endif
cleanup_ipv6_mibs();
out_unregister_sock:
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -90,9 +90,13 @@ static struct ctl_path ipv6_ctl_path[] =
static struct ctl_table_header *ipv6_sysctl_header;
-void ipv6_sysctl_register(void)
+int ipv6_sysctl_register(void)
{
ipv6_sysctl_header = register_sysctl_paths(ipv6_ctl_path, ipv6_table);
+ if (!ipv6_sysctl_header)
+ return -ENOMEM;
+
+ return 0;
}
void ipv6_sysctl_unregister(void)
--
^ permalink raw reply
* [patch 2/9][NETNS][IPV6] make the ipv6 sysctl to be a netns subsystem
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/make-ipv6-sysctl-to-be-a-subsystem.patch --]
[-- Type: text/plain, Size: 1581 bytes --]
The initialization of the sysctl for the ipv6 protocol is changed to
a network namespace subsystem. That means when a new network namespace
is created the initialization function for the sysctl will be called.
That do not change the behavior of the sysctl in case of the kernel
with the network namespace disabled.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
net/ipv6/sysctl_net_ipv6.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -90,16 +90,31 @@ static struct ctl_path ipv6_ctl_path[] =
static struct ctl_table_header *ipv6_sysctl_header;
-int ipv6_sysctl_register(void)
+static int ipv6_sysctl_net_init(struct net *net)
{
- ipv6_sysctl_header = register_sysctl_paths(ipv6_ctl_path, ipv6_table);
+ ipv6_sysctl_header = register_net_sysctl_table(net, ipv6_ctl_path, ipv6_table);
if (!ipv6_sysctl_header)
return -ENOMEM;
return 0;
}
+static void ipv6_sysctl_net_exit(struct net *net)
+{
+ unregister_net_sysctl_table(ipv6_sysctl_header);
+}
+
+static struct pernet_operations ipv6_sysctl_net_ops = {
+ .init = ipv6_sysctl_net_init,
+ .exit = ipv6_sysctl_net_exit,
+};
+
+int ipv6_sysctl_register(void)
+{
+ return register_pernet_subsys(&ipv6_sysctl_net_ops);
+}
+
void ipv6_sysctl_unregister(void)
{
- unregister_sysctl_table(ipv6_sysctl_header);
+ unregister_pernet_subsys(&ipv6_sysctl_net_ops);
}
--
^ permalink raw reply
* [patch 6/9][NETNS][IPV6] make ip6_frags per namespace
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/move-ip6-frags-to-netns.patch --]
[-- Type: text/plain, Size: 5417 bytes --]
The ip6_frags is moved to the network namespace structure.
Because there can be multiple instances of the network namespaces,
and the ip6_frags is no longer a global static variable, a helper
function has been added to facilitate the initialization of the
variables.
Until the ipv6 protocol is not per namespace, the variables are
accessed relatively from the initial network namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/ipv6.h | 3 ---
include/net/netns/ipv6.h | 3 +++
net/ipv6/reassembly.c | 21 ++++++++++++---------
net/ipv6/sysctl_net_ipv6.c | 15 +++++++++++----
4 files changed, 26 insertions(+), 16 deletions(-)
Index: net-2.6.25/include/net/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/ipv6.h
+++ net-2.6.25/include/net/ipv6.h
@@ -570,9 +570,6 @@ extern int inet6_hash_connect(struct ine
/*
* reassembly.c
*/
-struct inet_frags_ctl;
-extern struct inet_frags_ctl ip6_frags_ctl;
-
extern const struct proto_ops inet6_stream_ops;
extern const struct proto_ops inet6_dgram_ops;
Index: net-2.6.25/include/net/netns/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/netns/ipv6.h
+++ net-2.6.25/include/net/netns/ipv6.h
@@ -2,6 +2,8 @@
* ipv6 in net namespaces
*/
+#include <net/inet_frag.h>
+
#ifndef __NETNS_IPV6_H__
#define __NETNS_IPV6_H__
@@ -9,6 +11,7 @@ struct ctl_table_header;
struct netns_sysctl_ipv6 {
struct ctl_table_header *table;
+ struct inet_frags_ctl frags;
int bindv6only;
};
Index: net-2.6.25/net/ipv6/reassembly.c
===================================================================
--- net-2.6.25.orig/net/ipv6/reassembly.c
+++ net-2.6.25/net/ipv6/reassembly.c
@@ -82,13 +82,6 @@ struct frag_queue
__u16 nhoffset;
};
-struct inet_frags_ctl ip6_frags_ctl __read_mostly = {
- .high_thresh = 256 * 1024,
- .low_thresh = 192 * 1024,
- .timeout = IPV6_FRAG_TIMEOUT,
- .secret_interval = 10 * 60 * HZ,
-};
-
static struct inet_frags ip6_frags;
int ip6_frag_nqueues(void)
@@ -605,7 +598,7 @@ static int ipv6_frag_rcv(struct sk_buff
return 1;
}
- if (atomic_read(&ip6_frags.mem) > ip6_frags_ctl.high_thresh)
+ if (atomic_read(&ip6_frags.mem) > init_net.ipv6.sysctl.frags.high_thresh)
ip6_evictor(ip6_dst_idev(skb->dst));
if ((fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr,
@@ -632,6 +625,16 @@ static struct inet6_protocol frag_protoc
.flags = INET6_PROTO_NOPOLICY,
};
+void ipv6_frag_sysctl_init(struct net *net)
+{
+ net->ipv6.sysctl.frags.high_thresh = 256 * 1024,
+ net->ipv6.sysctl.frags.low_thresh = 192 * 1024,
+ net->ipv6.sysctl.frags.timeout = IPV6_FRAG_TIMEOUT,
+ net->ipv6.sysctl.frags.secret_interval = 10 * 60 * HZ,
+
+ ip6_frags.ctl = &net->ipv6.sysctl.frags;
+}
+
int __init ipv6_frag_init(void)
{
int ret;
@@ -639,7 +642,7 @@ int __init ipv6_frag_init(void)
ret = inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT);
if (ret)
goto out;
- ip6_frags.ctl = &ip6_frags_ctl;
+
ip6_frags.hashfn = ip6_hashfn;
ip6_frags.constructor = ip6_frag_init;
ip6_frags.destructor = NULL;
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -16,6 +16,7 @@
extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
+extern void ipv6_frag_sysctl_init(struct net *net);
static ctl_table ipv6_table_template[] = {
{
@@ -43,7 +44,7 @@ static ctl_table ipv6_table_template[] =
{
.ctl_name = NET_IPV6_IP6FRAG_HIGH_THRESH,
.procname = "ip6frag_high_thresh",
- .data = &ip6_frags_ctl.high_thresh,
+ .data = &init_net.ipv6.sysctl.frags.high_thresh,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
@@ -51,7 +52,7 @@ static ctl_table ipv6_table_template[] =
{
.ctl_name = NET_IPV6_IP6FRAG_LOW_THRESH,
.procname = "ip6frag_low_thresh",
- .data = &ip6_frags_ctl.low_thresh,
+ .data = &init_net.ipv6.sysctl.frags.low_thresh,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
@@ -59,7 +60,7 @@ static ctl_table ipv6_table_template[] =
{
.ctl_name = NET_IPV6_IP6FRAG_TIME,
.procname = "ip6frag_time",
- .data = &ip6_frags_ctl.timeout,
+ .data = &init_net.ipv6.sysctl.frags.timeout,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
@@ -68,7 +69,7 @@ static ctl_table ipv6_table_template[] =
{
.ctl_name = NET_IPV6_IP6FRAG_SECRET_INTERVAL,
.procname = "ip6frag_secret_interval",
- .data = &ip6_frags_ctl.secret_interval,
+ .data = &init_net.ipv6.sysctl.frags.secret_interval,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_jiffies,
@@ -116,6 +117,12 @@ static int ipv6_sysctl_net_init(struct n
ipv6_table[1].child = ipv6_icmp_table;
ipv6_table[2].data = &net->ipv6.sysctl.bindv6only;
+ ipv6_table[3].data = &net->ipv6.sysctl.frags.high_thresh;
+ ipv6_table[4].data = &net->ipv6.sysctl.frags.low_thresh;
+ ipv6_table[5].data = &net->ipv6.sysctl.frags.timeout;
+ ipv6_table[6].data = &net->ipv6.sysctl.frags.secret_interval;
+
+ ipv6_frag_sysctl_init(net);
net->ipv6.sysctl.bindv6only = 0;
--
^ permalink raw reply
* [patch 9/9][NETNS][IPV6] make icmpv6_time sysctl per namespace
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/move-sysctl-icmp-to-netns.patch --]
[-- Type: text/plain, Size: 2569 bytes --]
This patch moves the icmpv6_time sysctl to the network namespace
structure. A small initialization helper function has been added.
Because the ipv6 protocol is not yet per namespace, the variable is
accessed relatively to the initial network namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/netns/ipv6.h | 1 +
net/ipv6/icmp.c | 8 ++++----
net/ipv6/sysctl_net_ipv6.c | 1 +
3 files changed, 6 insertions(+), 4 deletions(-)
Index: net-2.6.25/include/net/netns/ipv6.h
===================================================================
--- net-2.6.25.orig/include/net/netns/ipv6.h
+++ net-2.6.25/include/net/netns/ipv6.h
@@ -21,6 +21,7 @@ struct netns_sysctl_ipv6 {
int ip6_rt_gc_elasticity;
int ip6_rt_mtu_expires;
int ip6_rt_min_advmss;
+ int icmpv6_time;
};
struct netns_ipv6 {
Index: net-2.6.25/net/ipv6/icmp.c
===================================================================
--- net-2.6.25.orig/net/ipv6/icmp.c
+++ net-2.6.25/net/ipv6/icmp.c
@@ -154,8 +154,6 @@ static int is_ineligible(struct sk_buff
return 0;
}
-static int sysctl_icmpv6_time __read_mostly = 1*HZ;
-
/*
* Check the ICMP output rate limit
*/
@@ -186,7 +184,7 @@ static inline int icmpv6_xrlim_allow(str
res = 1;
} else {
struct rt6_info *rt = (struct rt6_info *)dst;
- int tmo = sysctl_icmpv6_time;
+ int tmo = init_net.ipv6.sysctl.icmpv6_time;
/* Give more bandwidth to wider prefixes. */
if (rt->rt6i_dst.plen < 128)
@@ -913,7 +911,7 @@ ctl_table ipv6_icmp_table_template[] = {
{
.ctl_name = NET_IPV6_ICMP_RATELIMIT,
.procname = "ratelimit",
- .data = &sysctl_icmpv6_time,
+ .data = &init_net.ipv6.sysctl.icmpv6_time,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
@@ -925,6 +923,8 @@ struct ctl_table *ipv6_icmp_sysctl_init(
{
struct ctl_table *table;
+ net->ipv6.sysctl.icmpv6_time = 1*HZ;
+
table = kmemdup(ipv6_icmp_table_template,
sizeof(ipv6_icmp_table_template),
GFP_KERNEL);
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -123,6 +123,7 @@ static int ipv6_sysctl_net_init(struct n
ipv6_route_table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss;
ipv6_table[0].child = ipv6_route_table;
+ ipv6_icmp_table[0].data = &net->ipv6.sysctl.icmpv6_time;
ipv6_table[1].child = ipv6_icmp_table;
ipv6_table[2].data = &net->ipv6.sysctl.bindv6only;
--
^ permalink raw reply
* [patch 3/9][NETNS][IPV6] make ipv6 structure for netns
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: sysctl/make-ipv6-for-netns.patch --]
[-- Type: text/plain, Size: 1181 bytes --]
Like the ipv4 part, this patch adds an ipv6 structure in the net structure
to aggregate the different resources to make ipv6 per namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/net_namespace.h | 2 ++
include/net/netns/ipv6.h | 10 ++++++++++
2 files changed, 12 insertions(+)
Index: net-2.6.25/include/net/net_namespace.h
===================================================================
--- net-2.6.25.orig/include/net/net_namespace.h
+++ net-2.6.25/include/net/net_namespace.h
@@ -11,6 +11,7 @@
#include <net/netns/unix.h>
#include <net/netns/packet.h>
#include <net/netns/ipv4.h>
+#include <net/netns/ipv6.h>
struct proc_dir_entry;
struct net_device;
@@ -48,6 +49,7 @@ struct net {
struct netns_packet packet;
struct netns_unix unx;
struct netns_ipv4 ipv4;
+ struct netns_ipv6 ipv6;
};
#ifdef CONFIG_NET
Index: net-2.6.25/include/net/netns/ipv6.h
===================================================================
--- /dev/null
+++ net-2.6.25/include/net/netns/ipv6.h
@@ -0,0 +1,10 @@
+/*
+ * ipv6 in net namespaces
+ */
+
+#ifndef __NETNS_IPV6_H__
+#define __NETNS_IPV6_H__
+
+struct netns_ipv6 {
+};
+#endif
--
^ permalink raw reply
* [patch 7/9][NETNS][IPV6] make mld_max_msf readonly in other namespaces
From: Daniel Lezcano @ 2008-01-04 11:12 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20080104111226.776105484@localhost.localdomain>
[-- Attachment #1: make-mld_max_msf-readonly.patch --]
[-- Type: text/plain, Size: 1114 bytes --]
The mld_max_msf protects the system with a maximum allowed multicast
source filters. Making this variable per namespace can be potentially
an problem if someone inside a namespace set it to a big value, that
will impact the whole system including other namespaces.
I don't see any benefits to have it per namespace for now, so in order
to keep a directory entry in a newly created namespace, I make it
read-only when we are not in the initial network namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
net/ipv6/sysctl_net_ipv6.c | 3 +++
1 file changed, 3 insertions(+)
Index: net-2.6.25/net/ipv6/sysctl_net_ipv6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/sysctl_net_ipv6.c
+++ net-2.6.25/net/ipv6/sysctl_net_ipv6.c
@@ -122,6 +122,9 @@ static int ipv6_sysctl_net_init(struct n
ipv6_table[5].data = &net->ipv6.sysctl.frags.timeout;
ipv6_table[6].data = &net->ipv6.sysctl.frags.secret_interval;
+ if (net != &init_net)
+ ipv6_table[7].mode = 0444;
+
ipv6_frag_sysctl_init(net);
net->ipv6.sysctl.bindv6only = 0;
--
^ 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