* TSO, TCP Cong control etc
From: jamal @ 2007-09-14 13:44 UTC (permalink / raw)
To: Bill Fink
Cc: David Miller, jheffner, rick.jones2, krkumar2, gaagaan, general,
herbert, jagana, jeff, johnpol, kaber, mcarlson, mchan, netdev,
peter.p.waskiewicz.jr, rdreier, Robert.Olsson, shemminger, sri,
tgraf, xma
In-Reply-To: <20070914032055.8f96449b.billfink@mindspring.com>
Ive changed the subject to match content..
On Fri, 2007-14-09 at 03:20 -0400, Bill Fink wrote:
> On Mon, 27 Aug 2007, jamal wrote:
>
> > Bill:
> > who suggested (as per your email) the 75usec value and what was it based
> > on measurement-wise?
>
> Belatedly getting back to this thread. There was a recent myri10ge
> patch that changed the default value for tx/rx interrupt coalescing
> to 75 usec claiming it was an optimum value for maximum throughput
> (and is also mentioned in their external README documentation).
I would think such a value would be very specific to the ring size and
maybe even the machine in use.
> I also did some empirical testing to determine the effect of different
> values of TX/RX interrupt coalescing on 10-GigE network performance,
> both with TSO enabled and with TSO disabled. The actual test runs
> are attached at the end of this message, but the results are summarized
> in the following table (network performance in Mbps).
>
> TX/RX interrupt coalescing in usec (both sides)
> 0 15 30 45 60 75 90 105
>
> TSO enabled 8909 9682 9716 9725 9739 9745 9688 9648
> TSO disabled 9113 9910 9910 9910 9910 9910 9910 9910
>
> TSO disabled performance is always better than equivalent TSO enabled
> performance. With TSO enabled, the optimum performance is indeed at
> a TX/RX interrupt coalescing value of 75 usec. With TSO disabled,
> performance is the full 10-GigE line rate of 9910 Mbps for any value
> of TX/RX interrupt coalescing from 15 usec to 105 usec.
Interesting results. I think J Heffner made a very compelling
description the other day based on your netstat results at the receiver
as to what is going on (refer to the comments on stretch ACKs). If the
receiver is fixed, then youd see better numbers from TSO.
The 75 microsecs is very benchmarky in my opinion. If i was to pick a
different app or different NIC or run on many cpus with many apps doing
TSO, i highly doubt that will be the right number.
> Here's a retest (5 tests each):
>
> TSO enabled:
>
> TCP Cubic (initial_ssthresh set to 0):
[..]
> TCP Bic (initial_ssthresh set to 0):
[..]
>
> TCP Reno:
>
[..]
> TSO disabled:
>
> TCP Cubic (initial_ssthresh set to 0):
>
[..]
> TCP Bic (initial_ssthresh set to 0):
>
[..]
> TCP Reno:
>
[..]
> Not too much variation here, and not quite as high results
> as previously.
BIC seems to be on average better followed by CUBIC followed by Reno.
The difference this time maybe because you set the ssthresh to 0
(hopefully every run) and so Reno is definetely going to perform less
better since it is a lot less agressive in comparison to other two.
> Some further testing reveals that while this
> time I mainly get results like (here for TCP Bic with TSO
> disabled):
>
> [root@lang2 ~]# nuttcp -M1460 -w10m 192.168.88.16
> 4958.0625 MB / 10.02 sec = 4148.9361 Mbps 100 %TX 99 %RX
>
> I also sometimes get results like:
>
> [root@lang2 ~]# nuttcp -M1460 -w10m 192.168.88.16
> 5882.1875 MB / 10.00 sec = 4932.5549 Mbps 100 %TX 90 %RX
>
not good.
> The higher performing results seem to correspond to when there's a
> somewhat lower receiver CPU utilization. I'm not sure but there
> could also have been an effect from running the "-M1460" test after
> the 9000 byte jumbo frame test (no jumbo tests were done at all prior
> to running the above sets of 5 tests, although I did always discard
> an initial "warmup" test, and now that I think about it some of
> those initial discarded "warmup" tests did have somewhat anomalously
> high results).
If you didnt reset the ssthresh on every run, could it have been cached
and used on subsequent runs?
> > A side note: Although the experimentation reduces the variables (eg
> > tying all to CPU0), it would be more exciting to see multi-cpu and
> > multi-flow sender effect (which IMO is more real world).
>
> These systems are intended as test systems for 10-GigE networks,
> and as such it's important to get as consistently close to full
> 10-GigE line rate as possible, and that's why the interrupts and
> nuttcp application are tied to CPU0, with almost all other system
> applications tied to CPU1.
Sure, good benchmark. You get to know how well you can do.
> Now on another system that's intended as a 10-GigE firewall system,
> it has 2 Myricom 10-GigE NICs with the interrupts for eth2 tied to
> CPU0 and the interrupts for CPU1 tied to CPU1. In IP forwarding
> tests of this system, I have basically achieved full bidirectional
> 10-GigE line rate IP forwarding with 9000 byte jumbo frames.
In forwarding a more meaningful metric would be pps. The cost per packet
tends to dominate the results over the cost/byte.
9K jumbo frames at 10G is less than 500Kpps - so i dont see that machine
you are using sweating at all. To give you a comparison on a lower end
opteron a single CPU i can generate with batching pktgen 1Mpps; Robert
says he can do that even without batching on an opteron closer to what
you are using. So if you want to run that test, youd need to use
incrementally smaller packets.
> If there's some other specific test you'd like to see, and it's not
> too difficult to set up and I have some spare time, I'll see what I
> can do.
Well, the more interesting tests would be to go full throttle on all
CPUs you have and target one (or more) receivers. i.e you simulate a
real server. Can the utility you have be bound to a cpu? If yes, you
should be able to achieve this without much effort.
Thanks a lot Bill for the effort.
cheers,
jamal
^ permalink raw reply
* [PATCH] sky2: fix PHY setup on FE-P
From: Stephen Hemminger @ 2007-09-14 13:38 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, akpm
In-Reply-To: <46D81B1E.8020205@pobox.com>
Marvell reported the following fix is necessary to get fe-plus
chips to work.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/sky2.c 2007-09-14 14:40:35.000000000 +0200
+++ b/drivers/net/sky2.c 2007-09-14 14:41:00.000000000 +0200
@@ -488,11 +488,12 @@ static void sky2_phy_init(struct sky2_hw
case CHIP_ID_YUKON_FE_P:
/* Enable Link Partner Next Page */
+ ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
ctrl |= PHY_M_PC_ENA_LIP_NP;
/* disable Energy Detect and enable scrambler */
ctrl &= ~(PHY_M_PC_ENA_ENE_DT | PHY_M_PC_DIS_SCRAMB);
- gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
+ gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
/* set LED2 -> ACT, LED1 -> LINK, LED0 -> SPEED */
ctrl = PHY_M_FELP_LED2_CTRL(LED_PAR_CTRL_ACT_BL) |
^ permalink raw reply
* RE: [PATCH v3] Make the pr_*() family of macros in kernel.h complete
From: Medve Emilian-EMMEDVE1 @ 2007-09-14 13:27 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, netdev, i2c, linux-omap-open-source
In-Reply-To: <11896151802410-git-send-email-Emilian.Medve@Freescale.com>
Hello Andrew,
I realize this e-mail might be nuisance and time waster for you but I'm
in need of advice. I apologize in advance for any commonsense cultural
conventions I'm breaking.
I sent the below patch to four e-mail lists and it lead to orthogonal
conversations about how the entire kernel logging system/mechanisms need
to be re-written and thus such incremental improvements as these get out
of focus...
In this case I started needing pr_err() and discovered that is defined
already four times but not with global visibility as some other pr_*()
from kernel.h (a subset of the entire family). I chose not to define it
yet the fifth time but clean up the existing definitions and complete
the family. For some reason it didn't go through even though I had some
positive feedback. Now it seems I'm encouraged to really define the
pr_err() for the fifth time... Not quite sure what to do...
Cheers,
Emil.
> -----Original Message-----
> From: Medve Emilian-EMMEDVE1
> Sent: Wednesday, September 12, 2007 11:40 AM
> To: linux-kernel@vger.kernel.org; netdev@vger.kernel.org;
> i2c@lm-sensors.org; linux-omap-open-source@linux.omap.com
> Cc: Medve Emilian-EMMEDVE1
> Subject: [PATCH v3] Make the pr_*() family of macros in
> kernel.h complete
>
> Other/Some pr_*() macros are already defined in kernel.h, but
> pr_err() was defined
> multiple times in several other places
>
> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
> ---
>
> I'm writing a driver and I've been using the pr_*() macros
> from kernel.h and I
> was surprised not to find there pr_err() but defined multiple
> times (in four
> different files). I didn't want to define it yet one more
> time so I did this
> cleanup
>
> As per community request/suggestion, I added the rest of the
> missing pr_*()
> macros to complete the family. The names of the macros are
> based on the KERN_*
> loglevel names and are macthing the naming convention of the
> dev_*() print
> macros from device.h. The macros are defined in the ascending
> order of the
> loglevel
>
> This patch is against Linus' tree
> (577107e8e4cf9f6f4f5ef8350ac9a8faa6c3796d)
>
> linux-2.6> scripts/checkpatch.pl
> 0001-Make-the-pr_-family-of-macros-in-kernel.h-complet.patch
> Your patch has no obvious style problems and is ready for submission.
>
> drivers/i2c/chips/menelaus.c | 10 ++++------
> drivers/net/spider_net.h | 3 ---
> drivers/video/omap/lcd_h3.c | 6 ++----
> drivers/video/omap/lcd_inn1610.c | 6 ++----
> include/linux/kernel.h | 22 +++++++++++++++++-----
> 5 files changed, 25 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/i2c/chips/menelaus.c
> b/drivers/i2c/chips/menelaus.c
> index d9c92c5..66436ba 100644
> --- a/drivers/i2c/chips/menelaus.c
> +++ b/drivers/i2c/chips/menelaus.c
> @@ -49,8 +49,6 @@
>
> #define DRIVER_NAME "menelaus"
>
> -#define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ":
> ", ## arg);
> -
> #define MENELAUS_I2C_ADDRESS 0x72
>
> #define MENELAUS_REV 0x01
> @@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value)
> int val =
> i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
>
> if (val < 0) {
> - pr_err("write error");
> + pr_err(DRIVER_NAME ": write error");
> return val;
> }
>
> @@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg)
> int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
>
> if (val < 0)
> - pr_err("read error");
> + pr_err(DRIVER_NAME ": read error");
>
> return val;
> }
> @@ -1177,7 +1175,7 @@ static int menelaus_probe(struct
> i2c_client *client)
> /* If a true probe check the device */
> rev = menelaus_read_reg(MENELAUS_REV);
> if (rev < 0) {
> - pr_err("device not found");
> + pr_err(DRIVER_NAME ": device not found");
> err = -ENODEV;
> goto fail1;
> }
> @@ -1258,7 +1256,7 @@ static int __init menelaus_init(void)
>
> res = i2c_add_driver(&menelaus_i2c_driver);
> if (res < 0) {
> - pr_err("driver registration failed\n");
> + pr_err(DRIVER_NAME ": driver registration failed\n");
> return res;
> }
>
> diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h
> index dbbdb8c..c67b11d 100644
> --- a/drivers/net/spider_net.h
> +++ b/drivers/net/spider_net.h
> @@ -493,7 +493,4 @@ struct spider_net_card {
> struct spider_net_descr darray[0];
> };
>
> -#define pr_err(fmt,arg...) \
> - printk(KERN_ERR fmt ,##arg)
> -
> #endif
> diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
> index 51807b4..c604d93 100644
> --- a/drivers/video/omap/lcd_h3.c
> +++ b/drivers/video/omap/lcd_h3.c
> @@ -28,8 +28,6 @@
>
> #define MODULE_NAME "omapfb-lcd_h3"
>
> -#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ":
> " fmt, ## args)
> -
> static int h3_panel_init(struct lcd_panel *panel, struct
> omapfb_device *fbdev)
> {
> return 0;
> @@ -48,7 +46,7 @@ static int h3_panel_enable(struct lcd_panel *panel)
> if (!r)
> r = tps65010_set_gpio_out_value(GPIO2, HIGH);
> if (r)
> - pr_err("Unable to turn on LCD panel\n");
> + pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
>
> return r;
> }
> @@ -62,7 +60,7 @@ static void h3_panel_disable(struct
> lcd_panel *panel)
> if (!r)
> tps65010_set_gpio_out_value(GPIO2, LOW);
> if (r)
> - pr_err("Unable to turn off LCD panel\n");
> + pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
> }
>
> static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
> diff --git a/drivers/video/omap/lcd_inn1610.c
> b/drivers/video/omap/lcd_inn1610.c
> index 95604ca..5ef119c 100644
> --- a/drivers/video/omap/lcd_inn1610.c
> +++ b/drivers/video/omap/lcd_inn1610.c
> @@ -27,20 +27,18 @@
>
> #define MODULE_NAME "omapfb-lcd_h3"
>
> -#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ":
> " fmt, ## args)
> -
> static int innovator1610_panel_init(struct lcd_panel *panel,
> struct omapfb_device *fbdev)
> {
> int r = 0;
>
> if (omap_request_gpio(14)) {
> - pr_err("can't request GPIO 14\n");
> + pr_err(MODULE_NAME ": can't request GPIO 14\n");
> r = -1;
> goto exit;
> }
> if (omap_request_gpio(15)) {
> - pr_err("can't request GPIO 15\n");
> + pr_err(MODULE_NAME ": can't request GPIO 15\n");
> omap_free_gpio(14);
> r = -1;
> goto exit;
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 47160fe..166a822 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -230,10 +230,25 @@ extern void print_hex_dump_bytes(const
> char *prefix_str, int prefix_type,
> const void *buf, size_t len);
> #define hex_asc(x) "0123456789abcdef"[x]
>
> +#define pr_emerg(fmt, arg...) \
> + printk(KERN_EMERG fmt, ##arg)
> +#define pr_alert(fmt, arg...) \
> + printk(KERN_ALERT fmt, ##arg)
> +#define pr_crit(fmt, arg...) \
> + printk(KERN_CRIT fmt, ##arg)
> +#define pr_err(fmt, arg...) \
> + printk(KERN_ERR fmt, ##arg)
> +#define pr_warning(fmt, arg...) \
> + printk(KERN_WARNING fmt, ##arg)
> +#define pr_notice(fmt, arg...) \
> + printk(KERN_NOTICE fmt, ##arg)
> +#define pr_info(fmt, arg...) \
> + printk(KERN_INFO fmt, ##arg)
> +
> #ifdef DEBUG
> /* If you are writing a driver, please use dev_dbg instead */
> -#define pr_debug(fmt,arg...) \
> - printk(KERN_DEBUG fmt,##arg)
> +#define pr_debug(fmt, arg...) \
> + printk(KERN_DEBUG fmt, ##arg)
> #else
> static inline int __attribute__ ((format (printf, 1, 2)))
> pr_debug(const char * fmt, ...)
> {
> @@ -241,9 +256,6 @@ static inline int __attribute__ ((format
> (printf, 1, 2))) pr_debug(const char *
> }
> #endif
>
> -#define pr_info(fmt,arg...) \
> - printk(KERN_INFO fmt,##arg)
> -
> /*
> * Display an IP address in readable format.
> */
> --
> 1.5.3.GIT
^ permalink raw reply
* Re: RFC: possible NAPI improvements to reduce interrupt rates for low traffic rates
From: jamal @ 2007-09-14 13:14 UTC (permalink / raw)
To: James Chapman
Cc: Bill Fink, netdev, davem, jeff, mandeep.baines, ossthema,
Stephen Hemminger, Rick Jones
In-Reply-To: <46E7EE89.9060006@katalix.com>
On Wed, 2007-12-09 at 14:50 +0100, James Chapman wrote:
> By low traffic, I assume you mean a rate at which the NAPI driver
> doesn't stay in polled mode.
i.e:
"one interupt per packet per napi poll" which cause about 1-2 more IOs
in comparison to the case where you didnt do NAPI.
> The problem is that that rate is getting
> higher all the time, as interface and CPU speeds increase.
indeed;
While i dont want to throw more work at you, with some of the things
that improve the IO cost like PCI express, MSI, and some of the
intelligent things the tg3 does, is this problem still rampant etc? I
think if you can find (seems you have) one "modern" machine (with MSI
and a tg3 etc) that has this problem circa 2007 that will be a good
start.
> This results
> in too many interrupts and NAPI thrashing in/out of polled mode very
> quickly.
indeed.
> Yes please. We need an analysis of what happens to cpu usage, latency,
> pps etc when various factors are changed, e.g. input pps, NAPI busy-idle
> delay etc. The main purpose of my RFC wasn't to push a patch into the
> kernel right now, it was to highlight the issue and to find out if
> others were already working on it. The feedback has been good so far. I
> just need to find some time to do some testing. :)
I love your message. From a blackbox perspective, yes we have some
challenges for NAPI below certain thresholds of traffic.
My claim (in the paper) was the discrepancy between the cost of IO
access vs cost of RAM vs cost of caches vs CPU speeds has gotten too
high.
CPU Vendors have been paying close attention to most but IO. So avoiding
IO when you can is a good thing.
> Jamal, do you have more details? Are people saying NAPI gets too much of
> the CPU pie because they profiled it?
In the old days Manfred Spraul actually did profile.
Most of the other folks were running benchmarks which account for cpu
use in addition to resources like bandwidth and latency. And so while
bandwidth and latency didnt affect them that much, they observed their
benchmarks didnt look good at low rates (even when they looked excellent
at high rates) because of CPU.
> Are they complaining that system
> behavior degrades too much under certain network traffic conditions?
yes - Under low traffic, high speed cpu youd notice a slightly higher
cpu use.
>
> Mouse cursor movement jittery? Real-time apps such as music/video
> players starved of CPU? Is it possible they blame NAPI because they see
> tangible effects on their system, not because measured CPU usage is
> high?
If i recall correctly transactional type benchmarks is where this was
observed. Some IBM and Intel people bring it up every few months and
maybe Rick Jones once in a while.
Rick, care to comment on the benchmarks?
> I say this because my music/video player and mouse cursor behave
> _much_ better with my NAPI changes during general use, despite the
> increase in measured cpu load. Even ftp can make my system's mouse
> cursor jitter...
Like i told you in my other email - i did notice something similar, i
just couldnt put my finger to it and at some points thought i was
imagining it.
cheers,
jamal
^ permalink raw reply
* [ofa-general] Re: [PATCH v2] iw_cxgb3: Support "iwarp-only" interfaces to avoid 4-tuple conflicts.
From: Evgeniy Polyakov @ 2007-09-14 13:09 UTC (permalink / raw)
To: Steve Wise; +Cc: netdev, rdreier, general, linux-kernel
In-Reply-To: <20070913191617.30937.95960.stgit@dell3.ogc.int>
On Thu, Sep 13, 2007 at 02:16:17PM -0500, Steve Wise (swise@opengridcomputing.com) wrote:
>
> iw_cxgb3: Support "iwarp-only" interfaces to avoid 4-tuple conflicts.
>
> Version 2:
>
> - added a per-device mutex for the address and listening endpoints lists.
>
> - wait for all replies if sending multiple passive_open requests to rnic.
>
> - log warning if no addresses are available when a listen is issued.
>
> - tested
>
> ---
>
> Design:
>
> The sysadmin creates "for iwarp use only" alias interfaces of the form
> "devname:iw*" where devname is the native interface name (eg eth0) for the
> iwarp netdev device. The alias label can be anything starting with "iw".
> The "iw" immediately after the ':' is the key used by the iw_cxgb3 driver.
>
> EG:
> ifconfig eth0 192.168.70.123 up
> ifconfig eth0:iw1 192.168.71.123 up
> ifconfig eth0:iw2 192.168.72.123 up
>
> In the above example, 192.168.70/24 is for TCP traffic, while
> 192.168.71/24 and 192.168.72/24 are for iWARP/RDMA use.
>
> The rdma-only interface must be on its own IP subnet. This allows routing
> all rdma traffic onto this interface.
>
> The iWARP driver must translate all listens on address 0.0.0.0 to the
> set of rdma-only ip addresses for the device in question. This prevents
> incoming connect requests to the TCP ipaddresses from going up the
> rdma stack.
If the only solutions to solve a problem with hardware are to steal
packets or became a real device, then real device is much more
appropriate. Is that correct?
> +static void insert_ifa(struct iwch_dev *rnicp, struct in_ifaddr *ifa)
> +{
> + struct iwch_addrlist *addr;
> +
> + addr = kmalloc(sizeof *addr, GFP_KERNEL);
As a small nitpick: this wants to be sizeof(struct in_ifaddr)
> + if (!addr) {
> + printk(KERN_ERR MOD "%s - failed to alloc memory!\n",
> + __FUNCTION__);
> + return;
> + }
> + addr->ifa = ifa;
> + mutex_lock(&rnicp->mutex);
> + list_add_tail(&addr->entry, &rnicp->addrlist);
> + mutex_unlock(&rnicp->mutex);
> +}
What about providing error back to caller and fail to register?
> +static void remove_ifa(struct iwch_dev *rnicp, struct in_ifaddr *ifa)
> +{
> + struct iwch_addrlist *addr, *tmp;
> +
> + mutex_lock(&rnicp->mutex);
> + list_for_each_entry_safe(addr, tmp, &rnicp->addrlist, entry) {
> + if (addr->ifa == ifa) {
> + list_del_init(&addr->entry);
> + kfree(addr);
> + goto out;
> + }
> + }
> +out:
> + mutex_unlock(&rnicp->mutex);
> +}
> +
> +static int netdev_is_ours(struct iwch_dev *rnicp, struct net_device *netdev)
> +{
> + int i;
> +
> + for (i = 0; i < rnicp->rdev.port_info.nports; i++)
> + if (netdev == rnicp->rdev.port_info.lldevs[i])
> + return 1;
> + return 0;
> +}
> +
> +static inline int is_iwarp_label(char *label)
> +{
> + char *colon;
> +
> + colon = strchr(label, ':');
> + if (colon && !strncmp(colon+1, "iw", 2))
> + return 1;
> + return 0;
> +}
I.e. it is not allowed to create ':iw' alias for anyone else?
Well, looks crappy, but if it is the only solution...
> +static int nb_callback(struct notifier_block *self, unsigned long event,
> + void *ctx)
> +{
> + struct in_ifaddr *ifa = ctx;
> + struct iwch_dev *rnicp = container_of(self, struct iwch_dev, nb);
> +
> + PDBG("%s rnicp %p event %lx\n", __FUNCTION__, rnicp, event);
> +
> + switch (event) {
> + case NETDEV_UP:
> + if (netdev_is_ours(rnicp, ifa->ifa_dev->dev) &&
> + is_iwarp_label(ifa->ifa_label)) {
> + PDBG("%s label %s addr 0x%x added\n",
> + __FUNCTION__, ifa->ifa_label, ifa->ifa_address);
> + insert_ifa(rnicp, ifa);
> + iwch_listeners_add_addr(rnicp, ifa->ifa_address);
> + }
> + break;
> + case NETDEV_DOWN:
> + if (netdev_is_ours(rnicp, ifa->ifa_dev->dev) &&
> + is_iwarp_label(ifa->ifa_label)) {
> + PDBG("%s label %s addr 0x%x deleted\n",
> + __FUNCTION__, ifa->ifa_label, ifa->ifa_address);
> + iwch_listeners_del_addr(rnicp, ifa->ifa_address);
> + remove_ifa(rnicp, ifa);
> + }
> + break;
> + default:
> + break;
> + }
> + return 0;
> +}
> +
> +static void delete_addrlist(struct iwch_dev *rnicp)
> +{
> + struct iwch_addrlist *addr, *tmp;
> +
> + mutex_lock(&rnicp->mutex);
> + list_for_each_entry_safe(addr, tmp, &rnicp->addrlist, entry) {
> + list_del_init(&addr->entry);
> + kfree(addr);
> + }
> + mutex_unlock(&rnicp->mutex);
> +}
> +
> +static void populate_addrlist(struct iwch_dev *rnicp)
> +{
> + int i;
> + struct in_device *indev;
> +
> + for (i = 0; i < rnicp->rdev.port_info.nports; i++) {
> + indev = in_dev_get(rnicp->rdev.port_info.lldevs[i]);
> + if (!indev)
> + continue;
> + for_ifa(indev)
> + if (is_iwarp_label(ifa->ifa_label)) {
> + PDBG("%s label %s addr 0x%x added\n",
> + __FUNCTION__, ifa->ifa_label,
> + ifa->ifa_address);
> + insert_ifa(rnicp, ifa);
> + }
> + endfor_ifa(indev);
> + }
> +}
> +
> static void rnic_init(struct iwch_dev *rnicp)
> {
> PDBG("%s iwch_dev %p\n", __FUNCTION__, rnicp);
> @@ -70,6 +187,12 @@ static void rnic_init(struct iwch_dev *r
> idr_init(&rnicp->qpidr);
> idr_init(&rnicp->mmidr);
> spin_lock_init(&rnicp->lock);
> + INIT_LIST_HEAD(&rnicp->addrlist);
> + INIT_LIST_HEAD(&rnicp->listen_eps);
> + mutex_init(&rnicp->mutex);
> + rnicp->nb.notifier_call = nb_callback;
> + populate_addrlist(rnicp);
> + register_inetaddr_notifier(&rnicp->nb);
>
> rnicp->attr.vendor_id = 0x168;
> rnicp->attr.vendor_part_id = 7;
> @@ -148,6 +271,8 @@ static void close_rnic_dev(struct t3cdev
> mutex_lock(&dev_mutex);
> list_for_each_entry_safe(dev, tmp, &dev_list, entry) {
> if (dev->rdev.t3cdev_p == tdev) {
> + unregister_inetaddr_notifier(&dev->nb);
> + delete_addrlist(dev);
> list_del(&dev->entry);
> iwch_unregister_device(dev);
> cxio_rdev_close(&dev->rdev);
> diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h
> index caf4e60..7fa0a47 100644
> --- a/drivers/infiniband/hw/cxgb3/iwch.h
> +++ b/drivers/infiniband/hw/cxgb3/iwch.h
> @@ -36,6 +36,8 @@ #include <linux/mutex.h>
> #include <linux/list.h>
> #include <linux/spinlock.h>
> #include <linux/idr.h>
> +#include <linux/notifier.h>
> +#include <linux/inetdevice.h>
>
> #include <rdma/ib_verbs.h>
>
> @@ -101,6 +103,11 @@ struct iwch_rnic_attributes {
> u32 cq_overflow_detection;
> };
>
> +struct iwch_addrlist {
> + struct list_head entry;
> + struct in_ifaddr *ifa;
> +};
> +
> struct iwch_dev {
> struct ib_device ibdev;
> struct cxio_rdev rdev;
> @@ -111,6 +118,10 @@ struct iwch_dev {
> struct idr mmidr;
> spinlock_t lock;
> struct list_head entry;
> + struct notifier_block nb;
> + struct list_head addrlist;
> + struct list_head listen_eps;
> + struct mutex mutex;
> };
>
> static inline struct iwch_dev *to_iwch_dev(struct ib_device *ibdev)
> diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
> index 1cdfcd4..954069f 100644
> --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
> +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
> @@ -1127,23 +1127,149 @@ static int act_open_rpl(struct t3cdev *t
> return CPL_RET_BUF_DONE;
> }
>
> -static int listen_start(struct iwch_listen_ep *ep)
> +static int wait_for_reply(struct iwch_ep_common *epc)
> +{
> + PDBG("%s ep %p waiting\n", __FUNCTION__, epc);
> + wait_event(epc->waitq, epc->rpl_done);
> + PDBG("%s ep %p done waiting err %d\n", __FUNCTION__, epc, epc->rpl_err);
> + return epc->rpl_err;
> +}
> +
> +static struct iwch_listen_entry *alloc_listener(struct iwch_listen_ep *ep,
> + __be32 addr)
Do you know, that cxgb3 function names suck? :)
Especially get_skb().
> +{
> + struct iwch_dev *h = to_iwch_dev(ep->com.cm_id->device);
> + struct iwch_listen_entry *le;
> +
> + le = kmalloc(sizeof *le, GFP_KERNEL);
Wants to be sizeof(struct iwch_listen_entry) and in other places too.
I skipped rdma internals of the patch, since I do not know it enough
to judge, but your approach looks good from core network point of view.
Maybe you should automatically create an alias each time new interface
is added so that admin would not care about proper aliases?
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [ofa-general] InfiniBand/RDMA merge plans for 2.6.24
From: Evgeniy Polyakov @ 2007-09-14 12:55 UTC (permalink / raw)
To: Steve Wise; +Cc: netdev, Roland Dreier, general, Jeff Garzik, linux-kernel
In-Reply-To: <46E98889.1080706@opengridcomputing.com>
On Thu, Sep 13, 2007 at 01:59:21PM -0500, Steve Wise (swise@opengridcomputing.com) wrote:
> >Well, if it involves /sharing/ port space with the native stack, i.e.
> >where port 1234 is IB but 1235 is Linux, pretty much all the networking
> >devs have NAK'd that approach AFAICS.
>
> Jeff, I posted a fix that doesn't do this. No port sharing. The iwarp
> device will use its own ip address and subnet to avoid collisions. You
> should review the patch when I post v2.
Could you please resend it, since I missed it in netdev@.
--
Evgeniy Polyakov
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/10 REV5] Implement skb batching and support in IPoIB/E1000
From: Evgeniy Polyakov @ 2007-09-14 12:49 UTC (permalink / raw)
To: Krishna Kumar
Cc: jagana, Robert.Olsson, peter.p.waskiewicz.jr, kumarkr, herbert,
gaagaan, netdev, rdreier, hadi, kaber, randy.dunlap, jeff,
general, mchan, tgraf, mcarlson, sri, shemminger, davem
In-Reply-To: <20070914090058.17589.80352.sendpatchset@K50wks273871wss.in.ibm.com>
Hi Krishna.
On Fri, Sep 14, 2007 at 02:30:58PM +0530, Krishna Kumar (krkumar2@in.ibm.com) wrote:
> --------
> The retransmission problem reported earlier seems to happen when mthca is
> used as the underlying device, but when I tested ehca the retransmissions
> dropped to normal levels (around 2 times the regular code). The performance
> improvement is around 55% for TCP.
And what about latency for this patchset?
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [PATCH][NETNS] Use list_for_each_entry_continue_reverse in setup_net
From: Stephen Hemminger @ 2007-09-14 12:49 UTC (permalink / raw)
To: Pavel Emelyanov
Cc: Eric W. Biederman, Linux Netdev List, Linux Containers, devel,
Daniel Lezcano
In-Reply-To: <46EA3AB4.7060904@openvz.org>
On Fri, 14 Sep 2007 11:39:32 +0400
Pavel Emelyanov <xemul@openvz.org> wrote:
> I proposed introducing a list_for_each_entry_continue_reverse
> macro to be used in setup_net() when unrolling the failed
> ->init callback.
>
> Here is the macro and some more cleanup in the setup_net() itself
> to remove one variable from the stack :) Minor, but the code
> looks nicer.
>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Maybe it is time to just eliminate the init hook from the API.
It has very few users, and there is no reason the setup needed
could be done before or after registering in most cases.
^ permalink raw reply
* [ofa-general] Re: [PATCH 10/10 REV5] [E1000] Implement batching
From: Evgeniy Polyakov @ 2007-09-14 12:47 UTC (permalink / raw)
To: Krishna Kumar
Cc: jagana, Robert.Olsson, peter.p.waskiewicz.jr, herbert, gaagaan,
kumarkr, rdreier, hadi, netdev, kaber, randy.dunlap, jeff,
general, mchan, tgraf, mcarlson, sri, shemminger, davem
In-Reply-To: <20070914090442.17589.23005.sendpatchset@K50wks273871wss.in.ibm.com>
On Fri, Sep 14, 2007 at 02:34:42PM +0530, Krishna Kumar (krkumar2@in.ibm.com) wrote:
> @@ -3276,7 +3282,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
>
> if (unlikely(skb->len <= 0)) {
> dev_kfree_skb_any(skb);
> - return NETDEV_TX_OK;
> + return NETDEV_TX_DROPPED;
> }
This changes could actually go as own patch, although not sure it is
ever used. just a though, not a stopper.
> /* 82571 and newer doesn't need the workaround that limited descriptor
> @@ -3322,7 +3328,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
> DPRINTK(DRV, ERR,
> "__pskb_pull_tail failed.\n");
> dev_kfree_skb_any(skb);
> - return NETDEV_TX_OK;
> + return NETDEV_TX_DROPPED;
> }
> len = skb->len - skb->data_len;
> break;
> @@ -3366,22 +3372,15 @@ e1000_xmit_frame(struct sk_buff *skb, st
> (adapter->hw.mac_type == e1000_82573))
> e1000_transfer_dhcp_info(adapter, skb);
>
> - if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags))
> - /* Collision - tell upper layer to requeue */
> - return NETDEV_TX_LOCKED;
> -
> /* need: count + 2 desc gap to keep tail from touching
> * head, otherwise try next time */
> - if (unlikely(e1000_maybe_stop_tx(netdev, tx_ring, count + 2))) {
> - spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
> + if (unlikely(e1000_maybe_stop_tx(netdev, tx_ring, count + 2)))
> return NETDEV_TX_BUSY;
> - }
>
> if (unlikely(adapter->hw.mac_type == e1000_82547)) {
> if (unlikely(e1000_82547_fifo_workaround(adapter, skb))) {
> netif_stop_queue(netdev);
> mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1);
> - spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
> return NETDEV_TX_BUSY;
> }
> }
> @@ -3396,8 +3395,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
> tso = e1000_tso(adapter, tx_ring, skb);
> if (tso < 0) {
> dev_kfree_skb_any(skb);
> - spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
> - return NETDEV_TX_OK;
> + return NETDEV_TX_DROPPED;
> }
>
> if (likely(tso)) {
> @@ -3416,13 +3414,61 @@ e1000_xmit_frame(struct sk_buff *skb, st
> e1000_tx_map(adapter, tx_ring, skb, first,
> max_per_txd, nr_frags, mss));
>
> - netdev->trans_start = jiffies;
> + return NETDEV_TX_OK;
> +}
> +
> +static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
> +{
> + struct e1000_adapter *adapter = netdev_priv(netdev);
> + struct e1000_tx_ring *tx_ring = adapter->tx_ring;
> + struct sk_buff_head *blist;
> + int ret, skbs_done = 0;
> + unsigned long flags;
> +
> + if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags)) {
> + /* Collision - tell upper layer to requeue */
> + return NETDEV_TX_LOCKED;
> + }
>
> - /* Make sure there is space in the ring for the next send. */
> - e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2);
> + blist = netdev->skb_blist;
> +
> + if (!skb || (blist && skb_queue_len(blist))) {
> + /*
> + * Either batching xmit call, or single skb case but there are
> + * skbs already in the batch list from previous failure to
> + * xmit - send the earlier skbs first to avoid out of order.
> + */
> + if (skb)
> + __skb_queue_tail(blist, skb);
> + skb = __skb_dequeue(blist);
Why is it put at the end?
--
Evgeniy Polyakov
^ permalink raw reply
* [ofa-general] Re: [PATCH 2/10 REV5] [core] Add skb_blist & support for batching
From: Evgeniy Polyakov @ 2007-09-14 12:46 UTC (permalink / raw)
To: Krishna Kumar
Cc: jagana, Robert.Olsson, peter.p.waskiewicz.jr, herbert, gaagaan,
kumarkr, rdreier, hadi, kaber, randy.dunlap, jeff, general,
netdev, tgraf, mcarlson, sri, shemminger, davem, mchan
In-Reply-To: <20070914090137.17589.60322.sendpatchset@K50wks273871wss.in.ibm.com>
On Fri, Sep 14, 2007 at 02:31:37PM +0530, Krishna Kumar (krkumar2@in.ibm.com) wrote:
> @@ -3566,6 +3579,13 @@ int register_netdevice(struct net_device
> }
> }
>
> + if (dev->features & NETIF_F_BATCH_SKBS) {
> + /* Driver supports batching skb */
> + dev->skb_blist = kmalloc(sizeof *dev->skb_blist, GFP_KERNEL);
> + if (dev->skb_blist)
> + skb_queue_head_init(dev->skb_blist);
> + }
> +
A nitpick is that you should use sizeof(struct ...) and I think it
requires flag clearing in cae of failed initialization?
> /*
> * nil rebuild_header routine,
> * that should be never called and used as just bug trap.
--
Evgeniy Polyakov
^ permalink raw reply
* [PATCH] sb1250-mac.c: Fix "stats" references
From: Maciej W. Rozycki @ 2007-09-14 12:25 UTC (permalink / raw)
To: Andrew Morton, Jeff Garzik; +Cc: netdev, linux-mips, linux-kernel
Fix build errors resulting from a recent commit that added references to
"stats" through "dev" from sbdma_rx_process() and sbdma_tx_process(), but
no definitions of that variable.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
This is probably the simplest fix possible, though at this point it is of
question whether it is still "struct sbmac_softc *" that should be passed
to these functions. I'll leave it to another occasion though.
Applies under patch-netdev-2.6.23-rc6-20070913-sb1250-mac-typedef-8.
Please apply,
Maciej
patch-netdev-2.6.23-rc6-20070913-sb1250-mac-fix-1
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/sb1250-mac.c linux-netdev-2.6.23-rc6-20070913/drivers/net/sb1250-mac.c
--- linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/sb1250-mac.c 2007-09-13 17:27:52.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/drivers/net/sb1250-mac.c 2007-09-14 12:06:15.000000000 +0000
@@ -1187,6 +1187,7 @@ static void sbmac_netpoll(struct net_dev
static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d,
int work_to_do, int poll)
{
+ struct net_device *dev = sc->sbm_dev;
int curidx;
int hwidx;
sbdmadscr_t *dsc;
@@ -1348,6 +1349,7 @@ done:
static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
{
+ struct net_device *dev = sc->sbm_dev;
int curidx;
int hwidx;
sbdmadscr_t *dsc;
^ permalink raw reply
* [ofa-general] Re: [PATCH 3/10 REV5] [sched] Modify qdisc_run to support batching
From: Evgeniy Polyakov @ 2007-09-14 12:15 UTC (permalink / raw)
To: Krishna Kumar
Cc: jagana, Robert.Olsson, herbert, gaagaan, kumarkr, rdreier,
peter.p.waskiewicz.jr, hadi, netdev, kaber, randy.dunlap, jeff,
general, mchan, tgraf, mcarlson, sri, shemminger, davem
In-Reply-To: <20070914090156.17589.61701.sendpatchset@K50wks273871wss.in.ibm.com>
Hi Krishna.
On Fri, Sep 14, 2007 at 02:31:56PM +0530, Krishna Kumar (krkumar2@in.ibm.com) wrote:
> +int dev_add_skb_to_blist(struct sk_buff *skb, struct net_device *dev)
> +{
> + if (!list_empty(&ptype_all))
> + dev_queue_xmit_nit(skb, dev);
> +
> + if (netif_needs_gso(dev, skb)) {
> + if (unlikely(dev_gso_segment(skb))) {
> + kfree_skb(skb);
> + return 0;
> + }
> +
> + if (skb->next) {
> + int count = 0;
> +
> + do {
> + struct sk_buff *nskb = skb->next;
> +
> + skb->next = nskb->next;
> + __skb_queue_tail(dev->skb_blist, nskb);
> + count++;
> + } while (skb->next);
Could it be list_move()-like function for skb lists?
I'm pretty sure if you change first and the last skbs and ke of the
queue in one shot, result will be the same.
Actually how many skbs are usually batched in your load?
> + /* Reset destructor for kfree_skb to work */
> + skb->destructor = DEV_GSO_CB(skb)->destructor;
> + kfree_skb(skb);
Why do you free first skb in the chain?
> + return count;
> + }
> + }
> + __skb_queue_tail(dev->skb_blist, skb);
> + return 1;
> +}
--
Evgeniy Polyakov
^ permalink raw reply
* wireless vs. network namespaces
From: Johannes Berg @ 2007-09-14 9:51 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: netdev, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
Now that the network namespace work is in net-2.6.24, I'm wondering how
wireless will be handling this. Is there any benefit at all to a
wireless device supporting network namespaces?
Should we, for now, set the new NETIF_F_NETNS_LOCAL flag for all
mac80211 devices?
If we do want to support moving, then we'll have to make cfg80211
(preferably, though mac80211 might be easier at first) migrate *all*
virtual interfaces associated with the same wiphy because otherwise
we'll get into trouble when moving one virtual interface and then
somebody in the other namespace changes its operating channel.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply
* [PATCH 2.6.24 3/3]S2io: Updating transceiver information in ethtool function
From: Sivakumar Subramani @ 2007-09-14 11:43 UTC (permalink / raw)
To: jeff, netdev; +Cc: support
- Update transceiver information in ethtool function
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
---
diff -urpN patch2/drivers/net/s2io.c patch3/drivers/net/s2io.c
--- patch2/drivers/net/s2io.c 2007-09-06 18:31:27.000000000 +0530
+++ patch3/drivers/net/s2io.c 2007-09-06 18:36:05.000000000 +0530
@@ -84,7 +84,7 @@
#include "s2io.h"
#include "s2io-regs.h"
-#define DRV_VERSION "2.0.26.4"
+#define DRV_VERSION "2.0.26.5"
/* S2io Driver name & version. */
static char s2io_driver_name[] = "Neterion";
@@ -5124,7 +5124,9 @@ static int s2io_ethtool_gset(struct net_
info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
info->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
info->port = PORT_FIBRE;
- /* info->transceiver?? TODO */
+
+ /* info->transceiver */
+ info->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(sp->dev)) {
info->speed = 10000;
^ permalink raw reply
* [PATCH 2.6.24 2/3]S2io: Support for add/delete/store/restore ethernet addresses
From: Sivakumar Subramani @ 2007-09-14 11:41 UTC (permalink / raw)
To: jeff, netdev; +Cc: support
- Support to add/delete/store/restore 64 and 128 Ethernet addresses for Xframe I and Xframe II respectively.
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
---
diff -Nurp 2.0.26.5-1/drivers/net/s2io.c 2.0.26.5-2/drivers/net/s2io.c
--- 2.0.26.5-1/drivers/net/s2io.c 2007-09-06 14:42:24.000000000 -0700
+++ 2.0.26.5-2/drivers/net/s2io.c 2007-09-06 15:45:10.000000000 -0700
@@ -356,7 +356,7 @@ static char ethtool_driver_stats_keys[][
mod_timer(&timer, (jiffies + exp)) \
/* copy mac addr to def_mac_addr array */
-static void do_s2io_copy_mac_addr(struct s2io_nic* sp, int offset, u64 mac_addr)
+static void do_s2io_copy_mac_addr(struct s2io_nic *sp, int offset, u64 mac_addr)
{
sp->def_mac_addr[offset].mac_addr[5] = (u8) (mac_addr);
sp->def_mac_addr[offset].mac_addr[4] = (u8) (mac_addr >> 8);
@@ -3371,6 +3371,9 @@ static void s2io_reset(struct s2io_nic *
/* Set swapper to enable I/O register access */
s2io_set_swapper(sp);
+ /* restore mac address entries */
+ do_s2io_restore_unicast_mc(sp);
+
/* Restore the MSIX table entries from local variables */
restore_xmsi_data(sp);
@@ -3429,9 +3432,6 @@ static void s2io_reset(struct s2io_nic *
writeq(val64, &bar0->pcc_err_reg);
}
- /* restore the previously assigned mac address */
- do_s2io_prog_unicast(sp->dev, (u8 *)&sp->def_mac_addr[0].mac_addr);
-
sp->device_enabled_once = FALSE;
}
@@ -3901,8 +3901,17 @@ hw_init_failed:
static int s2io_close(struct net_device *dev)
{
struct s2io_nic *sp = dev->priv;
+ struct config_param *config = &sp->config;
+ u64 tmp64;
+ int off;
netif_stop_queue(dev);
+ /* delete all populated mac entries */
+ for(off =1; off < config->max_mc_addr; off++) {
+ tmp64 = do_s2io_read_unicast_mc(sp,off);
+ if(tmp64 != S2IO_DISABLE_MAC_ENTRY)
+ do_s2io_delete_unicast_mc(sp, tmp64);
+ }
/* Reset card, kill tasklet and free Tx and Rx buffers. */
s2io_card_down(sp);
@@ -4701,8 +4710,9 @@ static void s2io_set_multicast(struct ne
struct XENA_dev_config __iomem *bar0 = sp->bar0;
u64 val64 = 0, multi_mac = 0x010203040506ULL, mask =
0xfeffffffffffULL;
- u64 dis_addr = 0xffffffffffffULL, mac_addr = 0;
+ u64 dis_addr = S2IO_DISABLE_MAC_ENTRY, mac_addr = 0;
void __iomem *add;
+ struct config_param *config = &sp->config;
if ((dev->flags & IFF_ALLMULTI) && (!sp->m_cast_flg)) {
/* Enable all Multicast addresses */
@@ -4712,7 +4722,7 @@ static void s2io_set_multicast(struct ne
&bar0->rmac_addr_data1_mem);
val64 = RMAC_ADDR_CMD_MEM_WE |
RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
- RMAC_ADDR_CMD_MEM_OFFSET(MAC_MC_ALL_MC_ADDR_OFFSET);
+ RMAC_ADDR_CMD_MEM_OFFSET(config->max_mc_addr - 1);
writeq(val64, &bar0->rmac_addr_cmd_mem);
/* Wait till command completes */
wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
@@ -4720,7 +4730,7 @@ static void s2io_set_multicast(struct ne
S2IO_BIT_RESET);
sp->m_cast_flg = 1;
- sp->all_multi_pos = MAC_MC_ALL_MC_ADDR_OFFSET;
+ sp->all_multi_pos = config->max_mc_addr - 1;
} else if ((dev->flags & IFF_ALLMULTI) && (sp->m_cast_flg)) {
/* Disable all Multicast addresses */
writeq(RMAC_ADDR_DATA0_MEM_ADDR(dis_addr),
@@ -4789,7 +4799,8 @@ static void s2io_set_multicast(struct ne
/* Update individual M_CAST address list */
if ((!sp->m_cast_flg) && dev->mc_count) {
if (dev->mc_count >
- (MAX_ADDRS_SUPPORTED - MAC_MC_ADDR_START_OFFSET - 1)) {
+ ((config->max_mc_addr - config->max_mac_addr)
+ - config->mc_start_offset - 1)) {
DBG_PRINT(ERR_DBG, "%s: No more Rx filters ",
dev->name);
DBG_PRINT(ERR_DBG, "can be added, please enable ");
@@ -4809,7 +4820,7 @@ static void s2io_set_multicast(struct ne
val64 = RMAC_ADDR_CMD_MEM_WE |
RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
RMAC_ADDR_CMD_MEM_OFFSET
- (MAC_MC_ADDR_START_OFFSET + i);
+ (config->mc_start_offset + i);
writeq(val64, &bar0->rmac_addr_cmd_mem);
/* Wait for command completes */
@@ -4841,7 +4852,7 @@ static void s2io_set_multicast(struct ne
val64 = RMAC_ADDR_CMD_MEM_WE |
RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
RMAC_ADDR_CMD_MEM_OFFSET
- (i + MAC_MC_ADDR_START_OFFSET);
+ (i + config->mc_start_offset);
writeq(val64, &bar0->rmac_addr_cmd_mem);
/* Wait for command completes */
@@ -4857,8 +4868,76 @@ static void s2io_set_multicast(struct ne
}
}
-/* add unicast MAC address to CAM */
-static int do_s2io_add_unicast(struct s2io_nic *sp, u64 addr, int off)
+/* read from CAM unicast & multicast addresses and store it in def_mac_addr structure
+ **/
+void do_s2io_store_unicast_mc(struct s2io_nic *sp)
+{
+ int offset;
+ u64 mac_addr=0x0;
+ struct config_param *config = &sp->config;
+
+ /* store unicast & multicast mac addresses */
+ for(offset = 0; offset < config->max_mc_addr; offset++) {
+ mac_addr = do_s2io_read_unicast_mc(sp,offset);
+ /* if read fails disable the entry */
+ if(mac_addr == FAILURE)
+ mac_addr = S2IO_DISABLE_MAC_ENTRY;
+ do_s2io_copy_mac_addr(sp, offset, mac_addr);
+ }
+}
+
+/* restore unicast addresses & multicast to CAM from def_mac_addr structure */
+static void do_s2io_restore_unicast_mc(struct s2io_nic *sp)
+{
+ int offset;
+ struct config_param *config = &sp->config;
+
+ /* restore unicast mac address */
+ for(offset = 0; offset < config->max_mac_addr; offset++)
+ do_s2io_prog_unicast(sp->dev,sp->def_mac_addr[offset].mac_addr);
+
+ /* restore multicast mac address */
+ for(offset = config->mc_start_offset;
+ offset < config->max_mc_addr; offset++)
+ do_s2io_add_mc(sp, sp->def_mac_addr[offset].mac_addr);
+}
+
+/* add a multicast MAC address to CAM */
+static int do_s2io_add_mc(struct s2io_nic *sp, u8* addr)
+{
+ int i;
+ u64 mac_addr=0;
+ struct config_param *config = &sp->config;
+
+ for (i = 0; i < ETH_ALEN; i++) {
+ mac_addr <<= 8;
+ mac_addr |= addr[i];
+ }
+ if((0ULL == mac_addr) || (mac_addr == S2IO_DISABLE_MAC_ENTRY))
+ return SUCCESS;
+
+ /* check if the multicast mac already preset in CAM */
+ for(i = config->mc_start_offset; i < config->max_mc_addr; i++) {
+ u64 tmp64;
+ tmp64 = do_s2io_read_unicast_mc(sp,i);
+ if(tmp64 == S2IO_DISABLE_MAC_ENTRY) /* CAM entry is empty */
+ break;
+
+ if(tmp64 == mac_addr)
+ return SUCCESS;
+ }
+ if(i == config->max_mc_addr) {
+ DBG_PRINT(ERR_DBG,"CAM full no space left for multicast MAC\n");
+ return FAILURE;
+ }
+ /* Update the internal structure with this new mac address */
+ do_s2io_copy_mac_addr(sp, i, mac_addr);
+
+ return (do_s2io_add_mac(sp,mac_addr,i));
+}
+
+/* add MAC address to CAM memory */
+static int do_s2io_add_mac(struct s2io_nic *sp, u64 addr, int off)
{
u64 val64;
struct XENA_dev_config __iomem *bar0 = sp->bar0;
@@ -4881,6 +4960,53 @@ static int do_s2io_add_unicast(struct s2
return SUCCESS;
}
+/* deletes a specified unicast/multicast mac entry from CAM */
+static int do_s2io_delete_unicast_mc(struct s2io_nic *sp, u64 addr)
+{
+ int off;
+ u64 dis_addr = S2IO_DISABLE_MAC_ENTRY,tmp64;
+ struct config_param *config = &sp->config;
+
+ for(off = 1;
+ off < config->max_mc_addr; off++) {
+ tmp64 = do_s2io_read_unicast_mc(sp,off);
+ if(tmp64 == addr) {
+ /* disable the entry by writing 0xffffffffffffULL */
+ if(do_s2io_add_mac(sp,dis_addr,off) == FAILURE)
+ return FAILURE;
+ /* store the new mac list from CAM */
+ do_s2io_store_unicast_mc(sp);
+ return SUCCESS;
+ }
+ }
+ DBG_PRINT(ERR_DBG,"MAC address 0x%llx not found in CAM\n",
+ (unsigned long long)addr);
+ return FAILURE;
+}
+
+/* read mac entries from CAM */
+static u64 do_s2io_read_unicast_mc(struct s2io_nic *sp, int offset)
+{
+ u64 tmp64=0xffffffffffff0000ULL, val64;
+ struct XENA_dev_config __iomem *bar0 = sp->bar0;
+
+ /* read mac addr */
+ val64 =
+ RMAC_ADDR_CMD_MEM_RD | RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
+ RMAC_ADDR_CMD_MEM_OFFSET(offset);
+ writeq(val64, &bar0->rmac_addr_cmd_mem);
+
+ /* Wait till command completes */
+ if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
+ RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
+ S2IO_BIT_RESET)) {
+ DBG_PRINT(INFO_DBG, "do_s2io_read_unicast_mc failed\n");
+ return FAILURE;
+ }
+ tmp64 = readq(&bar0->rmac_addr_data0_mem);
+ return (tmp64 >> 16);
+}
+
/**
* s2io_set_mac_addr driver entry point
*/
@@ -4911,6 +5037,8 @@ static int do_s2io_prog_unicast(struct n
struct s2io_nic *sp = dev->priv;
register u64 mac_addr = 0,perm_addr=0;
int i;
+ u64 tmp64;
+ struct config_param *config = &sp->config;
/*
* Set the new MAC address as the new unicast filter and reflect this
@@ -4928,9 +5056,27 @@ static int do_s2io_prog_unicast(struct n
if(mac_addr == perm_addr)
return SUCCESS;
+ /* check if the mac already preset in CAM */
+ for(i = 1; i < config->max_mac_addr; i++) {
+ tmp64 = do_s2io_read_unicast_mc(sp,i);
+ if(tmp64 == S2IO_DISABLE_MAC_ENTRY) /* CAM entry is empty */
+ break;
+
+ if(tmp64 == mac_addr) {
+ DBG_PRINT(INFO_DBG,
+ "MAC addr:0x%llx already present in CAM\n",
+ (unsigned long long)mac_addr);
+ return SUCCESS;
+ }
+ }
+ if(i == config->max_mac_addr) {
+ DBG_PRINT(ERR_DBG,"CAM full no space left for Unicast MAC\n");
+ return FAILURE;
+ }
+
/* Update the internal structure with this new mac address */
- do_s2io_copy_mac_addr(sp, 0, mac_addr);
- return (do_s2io_add_unicast(sp,mac_addr,0));
+ do_s2io_copy_mac_addr(sp, i, mac_addr);
+ return (do_s2io_add_mac(sp,mac_addr,i));
}
/**
@@ -7636,7 +7782,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
*/
bar0 = sp->bar0;
val64 = RMAC_ADDR_CMD_MEM_RD | RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
- RMAC_ADDR_CMD_MEM_OFFSET(0 + MAC_MAC_ADDR_START_OFFSET);
+ RMAC_ADDR_CMD_MEM_OFFSET(0 + S2IO_MAC_ADDR_START_OFFSET);
writeq(val64, &bar0->rmac_addr_cmd_mem);
wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, S2IO_BIT_RESET);
@@ -7656,7 +7802,22 @@ s2io_init_nic(struct pci_dev *pdev, cons
memcpy(dev->dev_addr, sp->def_mac_addr, ETH_ALEN);
memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
- /* Store the values of the MSIX table in the s2io_nic structure */
+ /* initialize number of multicast & unicast MAC entries variables */
+ if (sp->device_type == XFRAME_I_DEVICE) {
+ config->max_mc_addr = S2IO_XENA_MAX_MC_ADDRESSES;
+ config->max_mac_addr = S2IO_XENA_MAX_MAC_ADDRESSES;
+ config->mc_start_offset = S2IO_XENA_MC_ADDR_START_OFFSET;
+ }
+ else if (sp->device_type == XFRAME_II_DEVICE) {
+ config->max_mc_addr = S2IO_HERC_MAX_MC_ADDRESSES;
+ config->max_mac_addr = S2IO_HERC_MAX_MAC_ADDRESSES;
+ config->mc_start_offset = S2IO_HERC_MC_ADDR_START_OFFSET;
+ }
+
+ /* store mac addresses from CAM to s2io_nic structure */
+ do_s2io_store_unicast_mc(sp);
+
+ /* Store the values of the MSIX table in the s2io_nic structure */
store_xmsi_data(sp);
/* reset Nic and bring it to known state */
s2io_reset(sp);
diff -Nurp 2.0.26.5-1/drivers/net/s2io.h 2.0.26.5-2/drivers/net/s2io.h
--- 2.0.26.5-1/drivers/net/s2io.h 2007-09-06 14:42:24.000000000 -0700
+++ 2.0.26.5-2/drivers/net/s2io.h 2007-09-06 15:45:10.000000000 -0700
@@ -31,6 +31,7 @@
#define SUCCESS 0
#define FAILURE -1
#define S2IO_MINUS_ONE 0xFFFFFFFFFFFFFFFFULL
+#define S2IO_DISABLE_MAC_ENTRY 0xFFFFFFFFFFFFULL
#define S2IO_MAX_PCI_CONFIG_SPACE_REINIT 100
#define S2IO_BIT_RESET 1
#define S2IO_BIT_SET 2
@@ -458,6 +459,9 @@ struct config_param {
#define MAX_MTU_JUMBO (MAX_PYLD_JUMBO+18)
#define MAX_MTU_JUMBO_VLAN (MAX_PYLD_JUMBO+22)
u16 bus_speed;
+ int max_mc_addr; /* xena=64 herc=256 */
+ int max_mac_addr; /* xena=16 herc=64 */
+ int mc_start_offset; /* xena=16 herc=64 */
};
/* Structure representing MAC Addrs */
@@ -823,9 +827,8 @@ struct s2io_nic {
void __iomem *bar0;
void __iomem *bar1;
#define MAX_MAC_SUPPORTED 16
-#define MAX_SUPPORTED_MULTICASTS MAX_MAC_SUPPORTED
- struct mac_addr def_mac_addr[MAX_MAC_SUPPORTED];
+ struct mac_addr def_mac_addr[256];
struct net_device_stats stats;
int high_dma_flag;
@@ -849,10 +852,9 @@ struct s2io_nic {
#define PROMISC 1
#define ALL_MULTI 2
-#define MAX_ADDRS_SUPPORTED 64
u16 usr_addr_count;
u16 mc_addr_count;
- struct usr_addr usr_addrs[MAX_ADDRS_SUPPORTED];
+ struct usr_addr usr_addrs[256];
u16 m_cast_flg;
u16 all_multi_pos;
@@ -1065,6 +1067,12 @@ static int s2io_add_isr(struct s2io_nic
static void s2io_rem_isr(struct s2io_nic * sp);
static void restore_xmsi_data(struct s2io_nic *nic);
+static void do_s2io_store_unicast_mc(struct s2io_nic *sp);
+static void do_s2io_restore_unicast_mc(struct s2io_nic *sp);
+static u64 do_s2io_read_unicast_mc(struct s2io_nic *sp, int offset);
+static int do_s2io_add_mc(struct s2io_nic *sp, u8 *addr);
+static int do_s2io_add_mac(struct s2io_nic *sp, u64 addr, int offset);
+static int do_s2io_delete_unicast_mc(struct s2io_nic *sp, u64 addr);
static int
s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, struct lro **lro,
diff -Nurp 2.0.26.5-1/drivers/net/s2io-regs.h 2.0.26.5-2/drivers/net/s2io-regs.h
--- 2.0.26.5-1/drivers/net/s2io-regs.h 2007-09-06 14:42:24.000000000 -0700
+++ 2.0.26.5-2/drivers/net/s2io-regs.h 2007-09-06 15:45:10.000000000 -0700
@@ -721,12 +721,16 @@ struct XENA_dev_config {
u64 rmac_cfg_key;
#define RMAC_CFG_KEY(val) vBIT(val,0,16)
+#define S2IO_MAC_ADDR_START_OFFSET 0
-#define MAX_MAC_ADDRESSES 16
-#define MAX_MC_ADDRESSES 32 /* Multicast addresses */
-#define MAC_MAC_ADDR_START_OFFSET 0
-#define MAC_MC_ADDR_START_OFFSET 16
-#define MAC_MC_ALL_MC_ADDR_OFFSET 63 /* enables all multicast pkts */
+#define S2IO_XENA_MAX_MC_ADDRESSES 64 /* multicast addresses */
+#define S2IO_HERC_MAX_MC_ADDRESSES 256
+
+#define S2IO_XENA_MAX_MAC_ADDRESSES 16
+#define S2IO_HERC_MAX_MAC_ADDRESSES 64
+
+#define S2IO_XENA_MC_ADDR_START_OFFSET 16
+#define S2IO_HERC_MC_ADDR_START_OFFSET 64
u64 rmac_addr_cmd_mem;
#define RMAC_ADDR_CMD_MEM_WE BIT(7)
#define RMAC_ADDR_CMD_MEM_RD 0
^ permalink raw reply
* [PATCH 2.6.24 1/3]S2io: Added support set_mac_address driver entry point
From: Sivakumar Subramani @ 2007-09-14 11:39 UTC (permalink / raw)
To: jeff, netdev; +Cc: support
- Added set_mac_address driver entry point
- Copying permanent mac address to dev->perm_addr
- Incorporated following review comments from Jeff
- Converted the macro to a function and removed call to memset
- regarding function naming convention, for all callbacks and entry points
will have 's2io_' prefix and helper functions will have 'do_s2io_' prefix.
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
---
diff -urpN orig/drivers/net/s2io.c patch1/drivers/net/s2io.c
--- orig/drivers/net/s2io.c 2007-09-06 14:30:16.000000000 +0530
+++ patch1/drivers/net/s2io.c 2007-09-06 16:21:33.000000000 +0530
@@ -355,6 +355,16 @@ static char ethtool_driver_stats_keys[][
timer.data = (unsigned long) arg; \
mod_timer(&timer, (jiffies + exp)) \
+/* copy mac addr to def_mac_addr array */
+static void do_s2io_copy_mac_addr(struct s2io_nic* sp, int offset, u64 mac_addr)
+{
+ sp->def_mac_addr[offset].mac_addr[5] = (u8) (mac_addr);
+ sp->def_mac_addr[offset].mac_addr[4] = (u8) (mac_addr >> 8);
+ sp->def_mac_addr[offset].mac_addr[3] = (u8) (mac_addr >> 16);
+ sp->def_mac_addr[offset].mac_addr[2] = (u8) (mac_addr >> 24);
+ sp->def_mac_addr[offset].mac_addr[1] = (u8) (mac_addr >> 32);
+ sp->def_mac_addr[offset].mac_addr[0] = (u8) (mac_addr >> 40);
+}
/* Add the vlan */
static void s2io_vlan_rx_register(struct net_device *dev,
struct vlan_group *grp)
@@ -3420,7 +3430,7 @@ static void s2io_reset(struct s2io_nic *
}
/* restore the previously assigned mac address */
- s2io_set_mac_addr(sp->dev, (u8 *)&sp->def_mac_addr[0].mac_addr);
+ do_s2io_prog_unicast(sp->dev, (u8 *)&sp->def_mac_addr[0].mac_addr);
sp->device_enabled_once = FALSE;
}
@@ -3849,7 +3859,7 @@ static int s2io_open(struct net_device *
goto hw_init_failed;
}
- if (s2io_set_mac_addr(dev, dev->dev_addr) == FAILURE) {
+ if (do_s2io_prog_unicast(dev, dev->dev_addr) == FAILURE) {
DBG_PRINT(ERR_DBG, "Set Mac Address Failed\n");
s2io_card_down(sp);
err = -ENODEV;
@@ -4847,8 +4857,48 @@ static void s2io_set_multicast(struct ne
}
}
+/* add unicast MAC address to CAM */
+static int do_s2io_add_unicast(struct s2io_nic *sp, u64 addr, int off)
+{
+ u64 val64;
+ struct XENA_dev_config __iomem *bar0 = sp->bar0;
+
+ writeq(RMAC_ADDR_DATA0_MEM_ADDR(addr),
+ &bar0->rmac_addr_data0_mem);
+
+ val64 =
+ RMAC_ADDR_CMD_MEM_WE | RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
+ RMAC_ADDR_CMD_MEM_OFFSET(off);
+ writeq(val64, &bar0->rmac_addr_cmd_mem);
+
+ /* Wait till command completes */
+ if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
+ RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING,
+ S2IO_BIT_RESET)) {
+ DBG_PRINT(INFO_DBG, "add_mac_addr failed\n");
+ return FAILURE;
+ }
+ return SUCCESS;
+}
+
+/**
+ * s2io_set_mac_addr driver entry point
+ */
+static int s2io_set_mac_addr(struct net_device *dev, void* p)
+{
+ struct sockaddr *addr=p;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EINVAL;
+
+ memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
+
+ /* store the MAC address in CAM */
+ return (do_s2io_prog_unicast(dev, dev->dev_addr));
+}
+
/**
- * s2io_set_mac_addr - Programs the Xframe mac address
+ * do_s2io_prog_unicast - Programs the Xframe mac address
* @dev : pointer to the device structure.
* @addr: a uchar pointer to the new mac address which is to be set.
* Description : This procedure will program the Xframe to receive
@@ -4856,56 +4906,31 @@ static void s2io_set_multicast(struct ne
* Return value: SUCCESS on success and an appropriate (-)ve integer
* as defined in errno.h file on failure.
*/
-
-static int s2io_set_mac_addr(struct net_device *dev, u8 * addr)
+static int do_s2io_prog_unicast(struct net_device *dev, u8 * addr)
{
struct s2io_nic *sp = dev->priv;
- struct XENA_dev_config __iomem *bar0 = sp->bar0;
- register u64 val64, mac_addr = 0;
+ register u64 mac_addr = 0,perm_addr=0;
int i;
- u64 old_mac_addr = 0;
/*
- * Set the new MAC address as the new unicast filter and reflect this
- * change on the device address registered with the OS. It will be
- * at offset 0.
- */
+ * Set the new MAC address as the new unicast filter and reflect this
+ * change on the device address registered with the OS. It will be
+ * at offset 0.
+ */
for (i = 0; i < ETH_ALEN; i++) {
mac_addr <<= 8;
mac_addr |= addr[i];
- old_mac_addr <<= 8;
- old_mac_addr |= sp->def_mac_addr[0].mac_addr[i];
+ perm_addr <<= 8;
+ perm_addr |= sp->def_mac_addr[0].mac_addr[i];
}
- if(0 == mac_addr)
+ /* check if the dev_addr is different than perm_addr */
+ if(mac_addr == perm_addr)
return SUCCESS;
/* Update the internal structure with this new mac address */
- if(mac_addr != old_mac_addr) {
- memset(sp->def_mac_addr[0].mac_addr, 0, sizeof(ETH_ALEN));
- sp->def_mac_addr[0].mac_addr[5] = (u8) (mac_addr);
- sp->def_mac_addr[0].mac_addr[4] = (u8) (mac_addr >> 8);
- sp->def_mac_addr[0].mac_addr[3] = (u8) (mac_addr >> 16);
- sp->def_mac_addr[0].mac_addr[2] = (u8) (mac_addr >> 24);
- sp->def_mac_addr[0].mac_addr[1] = (u8) (mac_addr >> 32);
- sp->def_mac_addr[0].mac_addr[0] = (u8) (mac_addr >> 40);
- }
-
- writeq(RMAC_ADDR_DATA0_MEM_ADDR(mac_addr),
- &bar0->rmac_addr_data0_mem);
-
- val64 =
- RMAC_ADDR_CMD_MEM_WE | RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
- RMAC_ADDR_CMD_MEM_OFFSET(0);
- writeq(val64, &bar0->rmac_addr_cmd_mem);
- /* Wait till command completes */
- if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem,
- RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, S2IO_BIT_RESET)) {
- DBG_PRINT(ERR_DBG, "%s: set_mac_addr failed\n", dev->name);
- return FAILURE;
- }
-
- return SUCCESS;
+ do_s2io_copy_mac_addr(sp, 0, mac_addr);
+ return (do_s2io_add_unicast(sp,mac_addr,0));
}
/**
@@ -7542,6 +7567,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
dev->get_stats = &s2io_get_stats;
dev->set_multicast_list = &s2io_set_multicast;
dev->do_ioctl = &s2io_ioctl;
+ dev->set_mac_address = &s2io_set_mac_addr;
dev->change_mtu = &s2io_change_mtu;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
@@ -7628,6 +7654,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
/* Set the factory defined MAC address initially */
dev->addr_len = ETH_ALEN;
memcpy(dev->dev_addr, sp->def_mac_addr, ETH_ALEN);
+ memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
/* Store the values of the MSIX table in the s2io_nic structure */
store_xmsi_data(sp);
diff -urpN orig/drivers/net/s2io.h patch1/drivers/net/s2io.h
--- orig/drivers/net/s2io.h 2007-09-06 14:30:16.000000000 +0530
+++ patch1/drivers/net/s2io.h 2007-09-06 16:15:16.000000000 +0530
@@ -1046,7 +1046,7 @@ static void s2io_link(struct s2io_nic *
static void s2io_reset(struct s2io_nic * sp);
static int s2io_poll(struct net_device *dev, int *budget);
static void s2io_init_pci(struct s2io_nic * sp);
-static int s2io_set_mac_addr(struct net_device *dev, u8 * addr);
+static int do_s2io_prog_unicast(struct net_device *dev, u8 * addr);
static void s2io_alarm_handle(unsigned long data);
static irqreturn_t
s2io_msix_ring_handle(int irq, void *dev_id);
^ permalink raw reply
* [PATCH 2.6.24 2/2]S2io: Removed unused feature - bimodal interrupts
From: Sivakumar Subramani @ 2007-09-14 11:32 UTC (permalink / raw)
To: jeff, netdev; +Cc: support
- Removed bimodal interrupt support - unused feature
Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
---
diff -pNur prior/drivers/net/s2io.c patch_dir/drivers/net/s2io.c
--- prior/drivers/net/s2io.c 2007-09-06 11:31:04.000000000 -0700
+++ patch_dir/drivers/net/s2io.c 2007-09-06 11:37:10.000000000 -0700
@@ -84,7 +84,7 @@
#include "s2io.h"
#include "s2io-regs.h"
-#define DRV_VERSION "2.0.26.2"
+#define DRV_VERSION "2.0.26.4"
/* S2io Driver name & version. */
static char s2io_driver_name[] = "Neterion";
@@ -452,7 +452,6 @@ S2IO_PARM_INT(mc_pause_threshold_q4q7, 1
S2IO_PARM_INT(shared_splits, 0);
S2IO_PARM_INT(tmac_util_period, 5);
S2IO_PARM_INT(rmac_util_period, 5);
-S2IO_PARM_INT(bimodal, 0);
S2IO_PARM_INT(l3l4hdr_size, 128);
/* Frequency of Rx desc syncs expressed as power of 2 */
S2IO_PARM_INT(rxsync_frequency, 3);
@@ -1565,90 +1564,57 @@ static int init_nic(struct s2io_nic *nic
time++;
}
- if (nic->config.bimodal) {
- int k = 0;
- for (k = 0; k < config->rx_ring_num; k++) {
- val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD;
- val64 |= TTI_CMD_MEM_OFFSET(0x38+k);
- writeq(val64, &bar0->tti_command_mem);
-
+ /* RTI Initialization */
+ if (nic->device_type == XFRAME_II_DEVICE) {
/*
- * Once the operation completes, the Strobe bit of the command
- * register will be reset. We poll for this particular condition
- * We wait for a maximum of 500ms for the operation to complete,
- * if it's not complete by then we return error.
- */
- time = 0;
- while (TRUE) {
- val64 = readq(&bar0->tti_command_mem);
- if (!(val64 & TTI_CMD_MEM_STROBE_NEW_CMD)) {
- break;
- }
- if (time > 10) {
- DBG_PRINT(ERR_DBG,
- "%s: TTI init Failed\n",
- dev->name);
- return -1;
- }
- time++;
- msleep(50);
- }
- }
- } else {
+ * Programmed to generate Apprx 500 Intrs per
+ * second
+ */
+ int count = (nic->config.bus_speed * 125)/4;
+ val64 = RTI_DATA1_MEM_RX_TIMER_VAL(count);
+ } else
+ val64 = RTI_DATA1_MEM_RX_TIMER_VAL(0xFFF);
+ val64 |= RTI_DATA1_MEM_RX_URNG_A(0xA) |
+ RTI_DATA1_MEM_RX_URNG_B(0x10) |
+ RTI_DATA1_MEM_RX_URNG_C(0x30) | RTI_DATA1_MEM_RX_TIMER_AC_EN;
+
+ writeq(val64, &bar0->rti_data1_mem);
+
+ val64 = RTI_DATA2_MEM_RX_UFC_A(0x1) |
+ RTI_DATA2_MEM_RX_UFC_B(0x2) ;
+ if (nic->config.intr_type == MSI_X)
+ val64 |= (RTI_DATA2_MEM_RX_UFC_C(0x20) | \
+ RTI_DATA2_MEM_RX_UFC_D(0x40));
+ else
+ val64 |= (RTI_DATA2_MEM_RX_UFC_C(0x40) | \
+ RTI_DATA2_MEM_RX_UFC_D(0x80));
+ writeq(val64, &bar0->rti_data2_mem);
- /* RTI Initialization */
- if (nic->device_type == XFRAME_II_DEVICE) {
- /*
- * Programmed to generate Apprx 500 Intrs per
- * second
- */
- int count = (nic->config.bus_speed * 125)/4;
- val64 = RTI_DATA1_MEM_RX_TIMER_VAL(count);
- } else {
- val64 = RTI_DATA1_MEM_RX_TIMER_VAL(0xFFF);
- }
- val64 |= RTI_DATA1_MEM_RX_URNG_A(0xA) |
- RTI_DATA1_MEM_RX_URNG_B(0x10) |
- RTI_DATA1_MEM_RX_URNG_C(0x30) | RTI_DATA1_MEM_RX_TIMER_AC_EN;
-
- writeq(val64, &bar0->rti_data1_mem);
-
- val64 = RTI_DATA2_MEM_RX_UFC_A(0x1) |
- RTI_DATA2_MEM_RX_UFC_B(0x2) ;
- if (nic->config.intr_type == MSI_X)
- val64 |= (RTI_DATA2_MEM_RX_UFC_C(0x20) | \
- RTI_DATA2_MEM_RX_UFC_D(0x40));
- else
- val64 |= (RTI_DATA2_MEM_RX_UFC_C(0x40) | \
- RTI_DATA2_MEM_RX_UFC_D(0x80));
- writeq(val64, &bar0->rti_data2_mem);
+ for (i = 0; i < config->rx_ring_num; i++) {
+ val64 = RTI_CMD_MEM_WE | RTI_CMD_MEM_STROBE_NEW_CMD
+ | RTI_CMD_MEM_OFFSET(i);
+ writeq(val64, &bar0->rti_command_mem);
- for (i = 0; i < config->rx_ring_num; i++) {
- val64 = RTI_CMD_MEM_WE | RTI_CMD_MEM_STROBE_NEW_CMD
- | RTI_CMD_MEM_OFFSET(i);
- writeq(val64, &bar0->rti_command_mem);
+ /*
+ * Once the operation completes, the Strobe bit of the
+ * command register will be reset. We poll for this
+ * particular condition. We wait for a maximum of 500ms
+ * for the operation to complete, if it's not complete
+ * by then we return error.
+ */
+ time = 0;
+ while (TRUE) {
+ val64 = readq(&bar0->rti_command_mem);
+ if (!(val64 & RTI_CMD_MEM_STROBE_NEW_CMD))
+ break;
- /*
- * Once the operation completes, the Strobe bit of the
- * command register will be reset. We poll for this
- * particular condition. We wait for a maximum of 500ms
- * for the operation to complete, if it's not complete
- * by then we return error.
- */
- time = 0;
- while (TRUE) {
- val64 = readq(&bar0->rti_command_mem);
- if (!(val64 & RTI_CMD_MEM_STROBE_NEW_CMD)) {
- break;
- }
- if (time > 10) {
- DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n",
- dev->name);
- return -1;
- }
- time++;
- msleep(50);
+ if (time > 10) {
+ DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n",
+ dev->name);
+ return -1;
}
+ time++;
+ msleep(50);
}
}
@@ -2151,8 +2117,6 @@ static int start_nic(struct s2io_nic *ni
&bar0->prc_rxd0_n[i]);
val64 = readq(&bar0->prc_ctrl_n[i]);
- if (nic->config.bimodal)
- val64 |= PRC_CTRL_BIMODAL_INTERRUPT;
if (nic->rxd_mode == RXD_MODE_1)
val64 |= PRC_CTRL_RC_ENABLED;
else
@@ -3710,27 +3674,15 @@ static int s2io_enable_msi_x(struct s2io
}
writeq(tx_mat, &bar0->tx_mat0_n[0]);
- if (!nic->config.bimodal) {
- rx_mat = readq(&bar0->rx_mat);
- for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) {
- rx_mat |= RX_MAT_SET(j, msix_indx);
- nic->s2io_entries[msix_indx].arg
- = &nic->mac_control.rings[j];
- nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE;
- nic->s2io_entries[msix_indx].in_use = MSIX_FLG;
- }
- writeq(rx_mat, &bar0->rx_mat);
- } else {
- tx_mat = readq(&bar0->tx_mat0_n[7]);
- for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) {
- tx_mat |= TX_MAT_SET(i, msix_indx);
- nic->s2io_entries[msix_indx].arg
- = &nic->mac_control.rings[j];
- nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE;
- nic->s2io_entries[msix_indx].in_use = MSIX_FLG;
- }
- writeq(tx_mat, &bar0->tx_mat0_n[7]);
+ rx_mat = readq(&bar0->rx_mat);
+ for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) {
+ rx_mat |= RX_MAT_SET(j, msix_indx);
+ nic->s2io_entries[msix_indx].arg
+ = &nic->mac_control.rings[j];
+ nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE;
+ nic->s2io_entries[msix_indx].in_use = MSIX_FLG;
}
+ writeq(rx_mat, &bar0->rx_mat);
nic->avail_msix_vectors = 0;
ret = pci_enable_msix(nic->pdev, nic->entries, MAX_REQUESTED_MSI_X);
@@ -7771,14 +7723,6 @@ s2io_init_nic(struct pci_dev *pdev, cons
/* Initialize device name */
sprintf(sp->name, "%s Neterion %s", dev->name, sp->product_name);
- /* Initialize bimodal Interrupts */
- sp->config.bimodal = bimodal;
- if (!(sp->device_type & XFRAME_II_DEVICE) && bimodal) {
- sp->config.bimodal = 0;
- DBG_PRINT(ERR_DBG,"%s:Bimodal intr not supported by Xframe I\n",
- dev->name);
- }
-
/*
* Make Link state as off at this point, when the Link change
* interrupt comes the state will be automatically changed to
diff -pNur prior/drivers/net/s2io.h patch_dir/drivers/net/s2io.h
--- prior/drivers/net/s2io.h 2007-09-06 11:30:57.000000000 -0700
+++ patch_dir/drivers/net/s2io.h 2007-09-06 11:25:22.000000000 -0700
@@ -444,7 +444,6 @@ struct config_param {
#define MAX_RX_BLOCKS_PER_RING 150
struct rx_ring_config rx_cfg[MAX_RX_RINGS]; /*Per-Rx Ring config */
- u8 bimodal; /*Flag for setting bimodal interrupts*/
#define HEADER_ETHERNET_II_802_3_SIZE 14
#define HEADER_802_2_SIZE 3
^ permalink raw reply
* [PATCH 2.6.24 1/2]S2io: Change kmalloc+memset to k[zc]alloc
From: Sivakumar Subramani @ 2007-09-14 11:28 UTC (permalink / raw)
To: jeff, netdev; +Cc: support
- Changed kmalloc+memset to k[zc]alloc as per Mariusz's patch
<m.kozlowski@tuxland.pl>
Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
---
diff -urpN org/drivers/net/s2io.c patch1/drivers/net/s2io.c
--- org/drivers/net/s2io.c 2007-08-09 17:28:19.000000000 +0530
+++ patch1/drivers/net/s2io.c 2007-08-10 11:53:46.000000000 +0530
@@ -556,7 +556,7 @@ static int init_shared_mem(struct s2io_n
for (i = 0; i < config->tx_fifo_num; i++) {
int fifo_len = config->tx_cfg[i].fifo_len;
int list_holder_size = fifo_len * sizeof(struct list_info_hold);
- mac_control->fifos[i].list_info = kmalloc(list_holder_size,
+ mac_control->fifos[i].list_info = kzalloc(list_holder_size,
GFP_KERNEL);
if (!mac_control->fifos[i].list_info) {
DBG_PRINT(INFO_DBG,
@@ -564,7 +564,6 @@ static int init_shared_mem(struct s2io_n
return -ENOMEM;
}
mem_allocated += list_holder_size;
- memset(mac_control->fifos[i].list_info, 0, list_holder_size);
}
for (i = 0; i < config->tx_fifo_num; i++) {
int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
@@ -3883,9 +3882,9 @@ static int s2io_enable_msi_x(struct s2io
u16 msi_control; /* Temp variable */
int ret, i, j, msix_indx = 1;
- nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry),
+ nic->entries = kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct msix_entry),
GFP_KERNEL);
- if (nic->entries == NULL) {
+ if (!nic->entries) {
DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \
__FUNCTION__);
nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3893,12 +3892,11 @@ static int s2io_enable_msi_x(struct s2io
}
nic->mac_control.stats_info->sw_stat.mem_allocated
+= (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
- memset(nic->entries, 0,MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
nic->s2io_entries =
- kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry),
+ kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct s2io_msix_entry),
GFP_KERNEL);
- if (nic->s2io_entries == NULL) {
+ if (!nic->s2io_entries) {
DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
__FUNCTION__);
nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3909,8 +3907,6 @@ static int s2io_enable_msi_x(struct s2io
}
nic->mac_control.stats_info->sw_stat.mem_allocated
+= (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
- memset(nic->s2io_entries, 0,
- MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
for (i=0; i< MAX_REQUESTED_MSI_X; i++) {
nic->entries[i].entry = i;
^ permalink raw reply
* [PATCH] small cleanup for fib rules
From: Denis V. Lunev @ 2007-09-14 11:06 UTC (permalink / raw)
To: davem; +Cc: kuznet, netdev, devel, dev, den
From: Denis V. Lunev <den@openvz.org>
This patch slightly cleanups FIB rules framework. rules_list as a pointer
on struct fib_rules_ops is useless. It is always assigned with a static
per/subsystem list in IPv4, IPv6 and DecNet.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
---------
include/net/fib_rules.h | 2 +-
net/core/fib_rules.c | 22 +++++++++++-----------
net/decnet/dn_rules.c | 13 ++++++-------
net/ipv4/fib_rules.c | 16 +++++++---------
net/ipv6/fib6_rules.c | 8 +++-----
5 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 83e41dd..017aebd 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -65,7 +65,7 @@ struct fib_rules_ops
int nlgroup;
const struct nla_policy *policy;
- struct list_head *rules_list;
+ struct list_head rules_list;
struct module *owner;
};
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 8c5474e..051cca1 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -82,7 +82,7 @@ static void cleanup_ops(struct fib_rules_ops *ops)
{
struct fib_rule *rule, *tmp;
- list_for_each_entry_safe(rule, tmp, ops->rules_list, list) {
+ list_for_each_entry_safe(rule, tmp, &ops->rules_list, list) {
list_del_rcu(&rule->list);
fib_rule_put(rule);
}
@@ -137,7 +137,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
rcu_read_lock();
- list_for_each_entry_rcu(rule, ops->rules_list, list) {
+ list_for_each_entry_rcu(rule, &ops->rules_list, list) {
jumped:
if (!fib_rule_match(rule, ops, fl, flags))
continue;
@@ -268,7 +268,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (rule->target <= rule->pref)
goto errout_free;
- list_for_each_entry(r, ops->rules_list, list) {
+ list_for_each_entry(r, &ops->rules_list, list) {
if (r->pref == rule->target) {
rule->ctarget = r;
break;
@@ -284,7 +284,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (err < 0)
goto errout_free;
- list_for_each_entry(r, ops->rules_list, list) {
+ list_for_each_entry(r, &ops->rules_list, list) {
if (r->pref > rule->pref)
break;
last = r;
@@ -297,7 +297,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
* There are unresolved goto rules in the list, check if
* any of them are pointing to this new rule.
*/
- list_for_each_entry(r, ops->rules_list, list) {
+ list_for_each_entry(r, &ops->rules_list, list) {
if (r->action == FR_ACT_GOTO &&
r->target == rule->pref) {
BUG_ON(r->ctarget != NULL);
@@ -317,7 +317,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (last)
list_add_rcu(&rule->list, &last->list);
else
- list_add_rcu(&rule->list, ops->rules_list);
+ list_add_rcu(&rule->list, &ops->rules_list);
notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid);
flush_route_cache(ops);
@@ -356,7 +356,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (err < 0)
goto errout;
- list_for_each_entry(rule, ops->rules_list, list) {
+ list_for_each_entry(rule, &ops->rules_list, list) {
if (frh->action && (frh->action != rule->action))
continue;
@@ -399,7 +399,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
* actually been added.
*/
if (ops->nr_goto_rules > 0) {
- list_for_each_entry(tmp, ops->rules_list, list) {
+ list_for_each_entry(tmp, &ops->rules_list, list) {
if (tmp->ctarget == rule) {
rcu_assign_pointer(tmp->ctarget, NULL);
ops->unresolved_rules++;
@@ -495,7 +495,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
int idx = 0;
struct fib_rule *rule;
- list_for_each_entry(rule, ops->rules_list, list) {
+ list_for_each_entry(rule, &ops->rules_list, list) {
if (idx < cb->args[1])
goto skip;
@@ -602,12 +602,12 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event,
switch (event) {
case NETDEV_REGISTER:
list_for_each_entry(ops, &rules_ops, list)
- attach_rules(ops->rules_list, dev);
+ attach_rules(&ops->rules_list, dev);
break;
case NETDEV_UNREGISTER:
list_for_each_entry(ops, &rules_ops, list)
- detach_rules(ops->rules_list, dev);
+ detach_rules(&ops->rules_list, dev);
break;
}
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 84ff3dd..4188d4a 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -57,8 +56,6 @@ static struct dn_fib_rule default_rule = {
},
};
-static LIST_HEAD(dn_fib_rules);
-
int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
{
@@ -228,9 +225,9 @@ static u32 dn_fib_rule_default_pref(void)
struct list_head *pos;
struct fib_rule *rule;
- if (!list_empty(&dn_fib_rules)) {
- pos = dn_fib_rules.next;
- if (pos->next != &dn_fib_rules) {
+ if (!list_empty(&dn_fib_rules_ops.rules_list)) {
+ pos = dn_fib_rules_ops.rules_list.next;
+ if (pos->next != &dn_fib_rules_ops.rules_list) {
rule = list_entry(pos->next, struct fib_rule, list);
if (rule->pref)
return rule->pref - 1;
@@ -258,13 +255,14 @@ static struct fib_rules_ops dn_fib_rules_ops = {
.flush_cache = dn_fib_rule_flush_cache,
.nlgroup = RTNLGRP_DECnet_RULE,
.policy = dn_fib_rule_policy,
- .rules_list = &dn_fib_rules,
+ .rules_list = LIST_HEAD_INIT(dn_fib_rules_ops.rules_list),
.owner = THIS_MODULE,
};
void __init dn_fib_rules_init(void)
{
- list_add_tail(&default_rule.common.list, &dn_fib_rules);
+ list_add_tail(&default_rule.common.list,
+ &dn_fib_rules_ops.rules_list);
fib_rules_register(&dn_fib_rules_ops);
}
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 2a94784..f16839c 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -76,8 +76,6 @@ static struct fib4_rule local_rule = {
},
};
-static LIST_HEAD(fib4_rules);
-
#ifdef CONFIG_NET_CLS_ROUTE
u32 fib_rules_tclass(struct fib_result *res)
{
@@ -279,9 +277,9 @@ static u32 fib4_rule_default_pref(void)
struct list_head *pos;
struct fib_rule *rule;
- if (!list_empty(&fib4_rules)) {
- pos = fib4_rules.next;
- if (pos->next != &fib4_rules) {
+ if (!list_empty(&fib4_rules_ops.rules_list)) {
+ pos = fib4_rules_ops.rules_list.next;
+ if (pos->next != &fib4_rules_ops.rules_list) {
rule = list_entry(pos->next, struct fib_rule, list);
if (rule->pref)
return rule->pref - 1;
@@ -317,15 +315,15 @@ static struct fib_rules_ops fib4_rules_ops = {
.flush_cache = fib4_rule_flush_cache,
.nlgroup = RTNLGRP_IPV4_RULE,
.policy = fib4_rule_policy,
- .rules_list = &fib4_rules,
+ .rules_list = LIST_HEAD_INIT(fib4_rules_ops.rules_list),
.owner = THIS_MODULE,
};
void __init fib4_rules_init(void)
{
- list_add_tail(&local_rule.common.list, &fib4_rules);
- list_add_tail(&main_rule.common.list, &fib4_rules);
- list_add_tail(&default_rule.common.list, &fib4_rules);
+ list_add_tail(&local_rule.common.list, &fib4_rules_ops.rules_list);
+ list_add_tail(&main_rule.common.list, &fib4_rules_ops.rules_list);
+ list_add_tail(&default_rule.common.list, &fib4_rules_ops.rules_list);
fib_rules_register(&fib4_rules_ops);
}
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 53b3998..706622a 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -50,8 +50,6 @@ static struct fib6_rule local_rule = {
},
};
-static LIST_HEAD(fib6_rules);
-
struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
pol_lookup_t lookup)
{
@@ -268,14 +266,14 @@ static struct fib_rules_ops fib6_rules_ops = {
.nlmsg_payload = fib6_rule_nlmsg_payload,
.nlgroup = RTNLGRP_IPV6_RULE,
.policy = fib6_rule_policy,
- .rules_list = &fib6_rules,
+ .rules_list = LIST_HEAD_INIT(fib6_rules_ops.rules_list),
.owner = THIS_MODULE,
};
void __init fib6_rules_init(void)
{
- list_add_tail(&local_rule.common.list, &fib6_rules);
- list_add_tail(&main_rule.common.list, &fib6_rules);
+ list_add_tail(&local_rule.common.list, &fib6_rules_ops.rules_list);
+ list_add_tail(&main_rule.common.list, &fib6_rules_ops.rules_list);
fib_rules_register(&fib6_rules_ops);
}
^ permalink raw reply related
* [PATCH] NET_SB1250_MAC: Rename to SB1250_MAC
From: Maciej W. Rozycki @ 2007-09-14 11:05 UTC (permalink / raw)
To: Andrew Morton, Jeff Garzik; +Cc: netdev, linux-mips, linux-kernel
Rename NET_SB1250_MAC to SB1250_MAC to follow the convention.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
The NET prefix seems to be used mainly for device groups (NET_ISA,
NET_VENDOR_*, etc.) rather than single drivers and adds no information. I
suggest it to be removed.
Depends on "patch-netdev-2.6.23-rc6-20070913-sb1250-mac-kconfig-0".
Please consider,
Maciej
patch-netdev-2.6.23-rc6-20070913-sb1250-mac-config-0
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/arch/mips/configs/bigsur_defconfig linux-netdev-2.6.23-rc6-20070913/arch/mips/configs/bigsur_defconfig
--- linux-netdev-2.6.23-rc6-20070913.macro/arch/mips/configs/bigsur_defconfig 2007-09-04 04:55:19.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/arch/mips/configs/bigsur_defconfig 2007-09-14 00:22:18.000000000 +0000
@@ -574,7 +574,7 @@ CONFIG_MII=y
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
-CONFIG_NET_SB1250_MAC=y
+CONFIG_SB1250_MAC=y
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/arch/mips/configs/sb1250-swarm_defconfig linux-netdev-2.6.23-rc6-20070913/arch/mips/configs/sb1250-swarm_defconfig
--- linux-netdev-2.6.23-rc6-20070913.macro/arch/mips/configs/sb1250-swarm_defconfig 2007-09-04 04:55:19.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/arch/mips/configs/sb1250-swarm_defconfig 2007-09-14 00:22:29.000000000 +0000
@@ -566,7 +566,7 @@ CONFIG_MII=y
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
-CONFIG_NET_SB1250_MAC=y
+CONFIG_SB1250_MAC=y
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/Kconfig linux-netdev-2.6.23-rc6-20070913/drivers/net/Kconfig
--- linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/Kconfig 2007-09-14 00:02:05.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/drivers/net/Kconfig 2007-09-14 00:21:06.000000000 +0000
@@ -2153,7 +2153,7 @@ config R8169_VLAN
If in doubt, say Y.
-config NET_SB1250_MAC
+config SB1250_MAC
tristate "SB1250 Gigabit Ethernet support"
depends on SIBYTE_SB1xxx_SOC
---help---
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/Makefile linux-netdev-2.6.23-rc6-20070913/drivers/net/Makefile
--- linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/Makefile 2007-09-13 17:27:52.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/drivers/net/Makefile 2007-09-14 00:21:20.000000000 +0000
@@ -107,7 +107,7 @@ obj-$(CONFIG_E2100) += e2100.o 8390.o
obj-$(CONFIG_ES3210) += es3210.o 8390.o
obj-$(CONFIG_LNE390) += lne390.o 8390.o
obj-$(CONFIG_NE3210) += ne3210.o 8390.o
-obj-$(CONFIG_NET_SB1250_MAC) += sb1250-mac.o
+obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
obj-$(CONFIG_B44) += b44.o
obj-$(CONFIG_FORCEDETH) += forcedeth.o
obj-$(CONFIG_NE_H8300) += ne-h8300.o
^ permalink raw reply
* [PATCH] NET_SB1250_MAC: Update Kconfig entry
From: Maciej W. Rozycki @ 2007-09-14 10:57 UTC (permalink / raw)
To: Andrew Morton, Jeff Garzik; +Cc: netdev, linux-mips, linux-kernel
The SB1250 network interfaces are Gigabit Ethernet ones. Move the
Kconfig entry to the appropriate section and add some help text.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
It should be obvious; I hope the help text will be useful to somebody and
will prevent from misclassifying the interface again in the future.
Please apply,
Maciej
patch-netdev-2.6.23-rc6-20070913-sb1250-mac-kconfig-0
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/Kconfig linux-netdev-2.6.23-rc6-20070913/drivers/net/Kconfig
--- linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/Kconfig 2007-09-13 17:27:52.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/drivers/net/Kconfig 2007-09-14 00:02:05.000000000 +0000
@@ -466,10 +466,6 @@ config MIPS_AU1X00_ENET
If you have an Alchemy Semi AU1X00 based system
say Y. Otherwise, say N.
-config NET_SB1250_MAC
- tristate "SB1250 Ethernet support"
- depends on SIBYTE_SB1xxx_SOC
-
config SGI_IOC3_ETH
bool "SGI IOC3 Ethernet"
depends on PCI && SGI_IP27
@@ -2157,6 +2153,18 @@ config R8169_VLAN
If in doubt, say Y.
+config NET_SB1250_MAC
+ tristate "SB1250 Gigabit Ethernet support"
+ depends on SIBYTE_SB1xxx_SOC
+ ---help---
+ This driver supports Gigabit Ethernet interfaces based on the
+ Broadcom SiByte family of System-On-a-Chip parts. They include
+ the BCM1120, BCM1125, BCM1125H, BCM1250, BCM1255, BCM1280, BCM1455
+ and BCM1480 chips.
+
+ To compile this driver as a module, choose M here: the module
+ will be called sb1250-mac.
+
config SIS190
tristate "SiS190/SiS191 gigabit ethernet support"
depends on PCI
^ permalink raw reply
* Re: [PATCH] sb1250-mac.c: De-typedef, de-volatile, de-etc...
From: Maciej W. Rozycki @ 2007-09-14 10:48 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Ralf Baechle, Andrew Morton, netdev, linux-mips, linux-kernel
In-Reply-To: <46E95C7F.1050302@pobox.com>
Remove typedefs, volatiles and convert kmalloc()/memset() pairs to
kcalloc(). Also reformat the surrounding clutter.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
---
On Thu, 13 Sep 2007, Jeff Garzik wrote:
> Net driver patches should apply on top of netdev-2.6.git#upstream, which is
> where changes to net drivers are queued for the next release.
I can see Andrew has done some changes to the patch and applied it
anyway, but here's a version I generated against your tree. Please feel
free to choose either.
You may be pleased (or less so) to hear that the version of sb1250-mac.c
in your tree does not even build (because of
42d53d6be113f974d8152979c88e1061b953bd12) and the patch below does not
address it. I ran out of time in the evening, but I will send you a fix
shortly. To be honest I think even with bulk changes it may be worth
checking whether they do not break stuff. ;-)
Maciej
patch-netdev-2.6.23-rc6-20070913-sb1250-mac-typedef-8
diff -up --recursive --new-file linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/sb1250-mac.c linux-netdev-2.6.23-rc6-20070913/drivers/net/sb1250-mac.c
--- linux-netdev-2.6.23-rc6-20070913.macro/drivers/net/sb1250-mac.c 2007-09-13 17:27:52.000000000 +0000
+++ linux-netdev-2.6.23-rc6-20070913/drivers/net/sb1250-mac.c 2007-09-13 23:44:45.000000000 +0000
@@ -140,17 +140,17 @@ MODULE_PARM_DESC(int_timeout_rx, "RX tim
********************************************************************* */
-typedef enum { sbmac_speed_auto, sbmac_speed_10,
- sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t;
+enum sbmac_speed { sbmac_speed_auto, sbmac_speed_10,
+ sbmac_speed_100, sbmac_speed_1000 };
-typedef enum { sbmac_duplex_auto, sbmac_duplex_half,
- sbmac_duplex_full } sbmac_duplex_t;
+enum sbmac_duplex { sbmac_duplex_auto, sbmac_duplex_half,
+ sbmac_duplex_full };
-typedef enum { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame,
- sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t;
+enum sbmac_fc { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame,
+ sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t;
-typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
- sbmac_state_broken } sbmac_state_t;
+enum sbmac_state { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
+ sbmac_state_broken };
/**********************************************************************
@@ -176,55 +176,61 @@ typedef enum { sbmac_state_uninit, sbmac
* DMA Descriptor structure
********************************************************************* */
-typedef struct sbdmadscr_s {
+struct sbdmadscr {
uint64_t dscr_a;
uint64_t dscr_b;
-} sbdmadscr_t;
-
-typedef unsigned long paddr_t;
+};
/**********************************************************************
* DMA Controller structure
********************************************************************* */
-typedef struct sbmacdma_s {
+struct sbmacdma {
/*
* This stuff is used to identify the channel and the registers
* associated with it.
*/
-
- struct sbmac_softc *sbdma_eth; /* back pointer to associated MAC */
- int sbdma_channel; /* channel number */
- int sbdma_txdir; /* direction (1=transmit) */
- int sbdma_maxdescr; /* total # of descriptors in ring */
+ struct sbmac_softc *sbdma_eth; /* back pointer to associated
+ MAC */
+ int sbdma_channel; /* channel number */
+ int sbdma_txdir; /* direction (1=transmit) */
+ int sbdma_maxdescr; /* total # of descriptors
+ in ring */
#ifdef CONFIG_SBMAC_COALESCE
- int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/
- int sbdma_int_timeout; /* # usec rx/tx interrupt */
-#endif
-
- volatile void __iomem *sbdma_config0; /* DMA config register 0 */
- volatile void __iomem *sbdma_config1; /* DMA config register 1 */
- volatile void __iomem *sbdma_dscrbase; /* Descriptor base address */
- volatile void __iomem *sbdma_dscrcnt; /* Descriptor count register */
- volatile void __iomem *sbdma_curdscr; /* current descriptor address */
- volatile void __iomem *sbdma_oodpktlost;/* pkt drop (rx only) */
-
+ int sbdma_int_pktcnt;
+ /* # descriptors rx/tx
+ before interrupt */
+ int sbdma_int_timeout;
+ /* # usec rx/tx interrupt */
+#endif
+ void __iomem *sbdma_config0; /* DMA config register 0 */
+ void __iomem *sbdma_config1; /* DMA config register 1 */
+ void __iomem *sbdma_dscrbase;
+ /* descriptor base address */
+ void __iomem *sbdma_dscrcnt; /* descriptor count register */
+ void __iomem *sbdma_curdscr; /* current descriptor
+ address */
+ void __iomem *sbdma_oodpktlost;
+ /* pkt drop (rx only) */
/*
* This stuff is for maintenance of the ring
*/
-
- sbdmadscr_t *sbdma_dscrtable_unaligned;
- sbdmadscr_t *sbdma_dscrtable; /* base of descriptor table */
- sbdmadscr_t *sbdma_dscrtable_end; /* end of descriptor table */
-
- struct sk_buff **sbdma_ctxtable; /* context table, one per descr */
-
- paddr_t sbdma_dscrtable_phys; /* and also the phys addr */
- sbdmadscr_t *sbdma_addptr; /* next dscr for sw to add */
- sbdmadscr_t *sbdma_remptr; /* next dscr for sw to remove */
-} sbmacdma_t;
+ void *sbdma_dscrtable_unaligned;
+ struct sbdmadscr *sbdma_dscrtable;
+ /* base of descriptor table */
+ struct sbdmadscr *sbdma_dscrtable_end;
+ /* end of descriptor table */
+ struct sk_buff **sbdma_ctxtable;
+ /* context table, one
+ per descr */
+ dma_addr_t sbdma_dscrtable_phys;
+ /* and also the phys addr */
+ struct sbdmadscr *sbdma_addptr; /* next dscr for sw to add */
+ struct sbdmadscr *sbdma_remptr; /* next dscr for sw
+ to remove */
+};
/**********************************************************************
@@ -236,46 +242,44 @@ struct sbmac_softc {
/*
* Linux-specific things
*/
+ struct net_device *sbm_dev; /* pointer to linux device */
+ spinlock_t sbm_lock; /* spin lock */
+ struct timer_list sbm_timer; /* for monitoring MII */
+ int sbm_devflags; /* current device flags */
+
+ int sbm_phy_oldbmsr;
+ int sbm_phy_oldanlpar;
+ int sbm_phy_oldk1stsr;
+ int sbm_phy_oldlinkstat;
+ int sbm_buffersize;
- struct net_device *sbm_dev; /* pointer to linux device */
- spinlock_t sbm_lock; /* spin lock */
- struct timer_list sbm_timer; /* for monitoring MII */
- int sbm_devflags; /* current device flags */
-
- int sbm_phy_oldbmsr;
- int sbm_phy_oldanlpar;
- int sbm_phy_oldk1stsr;
- int sbm_phy_oldlinkstat;
- int sbm_buffersize;
-
- unsigned char sbm_phys[2];
+ unsigned char sbm_phys[2];
/*
* Controller-specific things
*/
+ void __iomem *sbm_base; /* MAC's base address */
+ enum sbmac_state sbm_state; /* current state */
- void __iomem *sbm_base; /* MAC's base address */
- sbmac_state_t sbm_state; /* current state */
-
- volatile void __iomem *sbm_macenable; /* MAC Enable Register */
- volatile void __iomem *sbm_maccfg; /* MAC Configuration Register */
- volatile void __iomem *sbm_fifocfg; /* FIFO configuration register */
- volatile void __iomem *sbm_framecfg; /* Frame configuration register */
- volatile void __iomem *sbm_rxfilter; /* receive filter register */
- volatile void __iomem *sbm_isr; /* Interrupt status register */
- volatile void __iomem *sbm_imr; /* Interrupt mask register */
- volatile void __iomem *sbm_mdio; /* MDIO register */
-
- sbmac_speed_t sbm_speed; /* current speed */
- sbmac_duplex_t sbm_duplex; /* current duplex */
- sbmac_fc_t sbm_fc; /* current flow control setting */
-
- unsigned char sbm_hwaddr[ETHER_ADDR_LEN];
-
- sbmacdma_t sbm_txdma; /* for now, only use channel 0 */
- sbmacdma_t sbm_rxdma;
- int rx_hw_checksum;
- int sbe_idx;
+ void __iomem *sbm_macenable; /* MAC Enable Register */
+ void __iomem *sbm_maccfg; /* MAC Config Register */
+ void __iomem *sbm_fifocfg; /* FIFO Config Register */
+ void __iomem *sbm_framecfg; /* Frame Config Register */
+ void __iomem *sbm_rxfilter; /* Receive Filter Register */
+ void __iomem *sbm_isr; /* Interrupt Status Register */
+ void __iomem *sbm_imr; /* Interrupt Mask Register */
+ void __iomem *sbm_mdio; /* MDIO Register */
+
+ enum sbmac_speed sbm_speed; /* current speed */
+ enum sbmac_duplex sbm_duplex; /* current duplex */
+ enum sbmac_fc sbm_fc; /* cur. flow control setting */
+
+ unsigned char sbm_hwaddr[ETHER_ADDR_LEN];
+
+ struct sbmacdma sbm_txdma; /* only channel 0 for now */
+ struct sbmacdma sbm_rxdma;
+ int rx_hw_checksum;
+ int sbe_idx;
};
@@ -287,30 +291,31 @@ struct sbmac_softc {
* Prototypes
********************************************************************* */
-static void sbdma_initctx(sbmacdma_t *d,
- struct sbmac_softc *s,
- int chan,
- int txrx,
- int maxdescr);
-static void sbdma_channel_start(sbmacdma_t *d, int rxtx);
-static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *m);
-static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m);
-static void sbdma_emptyring(sbmacdma_t *d);
-static void sbdma_fillring(sbmacdma_t *d);
-static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, int work_to_do, int poll);
-static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll);
+static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
+ int txrx, int maxdescr);
+static void sbdma_channel_start(struct sbmacdma *d, int rxtx);
+static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *m);
+static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m);
+static void sbdma_emptyring(struct sbmacdma *d);
+static void sbdma_fillring(struct sbmacdma *d);
+static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
+ int work_to_do, int poll);
+static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
+ int poll);
static int sbmac_initctx(struct sbmac_softc *s);
static void sbmac_channel_start(struct sbmac_softc *s);
static void sbmac_channel_stop(struct sbmac_softc *s);
-static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *,sbmac_state_t);
-static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff);
+static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *,
+ enum sbmac_state);
+static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff);
static uint64_t sbmac_addr2reg(unsigned char *ptr);
-static irqreturn_t sbmac_intr(int irq,void *dev_instance);
+static irqreturn_t sbmac_intr(int irq, void *dev_instance);
static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev);
static void sbmac_setmulti(struct sbmac_softc *sc);
static int sbmac_init(struct net_device *dev, int idx);
-static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed);
-static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc);
+static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed);
+static int sbmac_set_duplex(struct sbmac_softc *s, enum sbmac_duplex duplex,
+ enum sbmac_fc fc);
static int sbmac_open(struct net_device *dev);
static void sbmac_timer(unsigned long data);
@@ -320,13 +325,15 @@ static int sbmac_mii_ioctl(struct net_de
static int sbmac_close(struct net_device *dev);
static int sbmac_poll(struct net_device *poll_dev, int *budget);
-static int sbmac_mii_poll(struct sbmac_softc *s,int noisy);
+static int sbmac_mii_poll(struct sbmac_softc *s, int noisy);
static int sbmac_mii_probe(struct net_device *dev);
static void sbmac_mii_sync(struct sbmac_softc *s);
-static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitcnt);
-static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx);
-static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx,
+static void sbmac_mii_senddata(struct sbmac_softc *s, unsigned int data,
+ int bitcnt);
+static unsigned int sbmac_mii_read(struct sbmac_softc *s, int phyaddr,
+ int regidx);
+static void sbmac_mii_write(struct sbmac_softc *s, int phyaddr, int regidx,
unsigned int regval);
@@ -675,8 +682,8 @@ static void sbmac_mii_write(struct sbmac
* way.
*
* Input parameters:
- * d - sbmacdma_t structure (DMA channel context)
- * s - sbmac_softc structure (pointer to a MAC)
+ * d - struct sbmacdma (DMA channel context)
+ * s - struct sbmac_softc (pointer to a MAC)
* chan - channel number (0..1 right now)
* txrx - Identifies DMA_TX or DMA_RX for channel direction
* maxdescr - number of descriptors
@@ -685,11 +692,8 @@ static void sbmac_mii_write(struct sbmac
* nothing
********************************************************************* */
-static void sbdma_initctx(sbmacdma_t *d,
- struct sbmac_softc *s,
- int chan,
- int txrx,
- int maxdescr)
+static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
+ int txrx, int maxdescr)
{
#ifdef CONFIG_SBMAC_COALESCE
int int_pktcnt, int_timeout;
@@ -756,18 +760,17 @@ static void sbdma_initctx(sbmacdma_t *d,
d->sbdma_maxdescr = maxdescr;
- d->sbdma_dscrtable_unaligned =
- d->sbdma_dscrtable = (sbdmadscr_t *)
- kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL);
+ d->sbdma_dscrtable_unaligned = kcalloc(d->sbdma_maxdescr + 1,
+ sizeof(*d->sbdma_dscrtable),
+ GFP_KERNEL);
/*
* The descriptor table must be aligned to at least 16 bytes or the
* MAC will corrupt it.
*/
- d->sbdma_dscrtable = (sbdmadscr_t *)
- ALIGN((unsigned long)d->sbdma_dscrtable, sizeof(sbdmadscr_t));
-
- memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t));
+ d->sbdma_dscrtable = (struct sbdmadscr *)
+ ALIGN((unsigned long)d->sbdma_dscrtable_unaligned,
+ sizeof(*d->sbdma_dscrtable));
d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr;
@@ -778,7 +781,7 @@ static void sbdma_initctx(sbmacdma_t *d,
*/
d->sbdma_ctxtable = kcalloc(d->sbdma_maxdescr,
- sizeof(struct sk_buff *), GFP_KERNEL);
+ sizeof(*d->sbdma_ctxtable), GFP_KERNEL);
#ifdef CONFIG_SBMAC_COALESCE
/*
@@ -815,7 +818,7 @@ static void sbdma_initctx(sbmacdma_t *d,
* nothing
********************************************************************* */
-static void sbdma_channel_start(sbmacdma_t *d, int rxtx )
+static void sbdma_channel_start(struct sbmacdma *d, int rxtx)
{
/*
* Turn on the DMA channel
@@ -856,7 +859,7 @@ static void sbdma_channel_start(sbmacdma
* nothing
********************************************************************* */
-static void sbdma_channel_stop(sbmacdma_t *d)
+static void sbdma_channel_stop(struct sbmacdma *d)
{
/*
* Turn off the DMA channel
@@ -905,10 +908,10 @@ static void sbdma_align_skb(struct sk_bu
********************************************************************* */
-static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb)
+static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb)
{
- sbdmadscr_t *dsc;
- sbdmadscr_t *nextdsc;
+ struct sbdmadscr *dsc;
+ struct sbdmadscr *nextdsc;
struct sk_buff *sb_new = NULL;
int pktsize = ENET_PACKET_SIZE;
@@ -1020,10 +1023,10 @@ static int sbdma_add_rcvbuffer(sbmacdma_
********************************************************************* */
-static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb)
+static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *sb)
{
- sbdmadscr_t *dsc;
- sbdmadscr_t *nextdsc;
+ struct sbdmadscr *dsc;
+ struct sbdmadscr *nextdsc;
uint64_t phys;
uint64_t ncb;
int length;
@@ -1109,7 +1112,7 @@ static int sbdma_add_txbuffer(sbmacdma_t
* nothing
********************************************************************* */
-static void sbdma_emptyring(sbmacdma_t *d)
+static void sbdma_emptyring(struct sbmacdma *d)
{
int idx;
struct sk_buff *sb;
@@ -1137,7 +1140,7 @@ static void sbdma_emptyring(sbmacdma_t *
* nothing
********************************************************************* */
-static void sbdma_fillring(sbmacdma_t *d)
+static void sbdma_fillring(struct sbmacdma *d)
{
int idx;
@@ -1184,12 +1187,12 @@ static void sbmac_netpoll(struct net_dev
* nothing
********************************************************************* */
-static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d,
- int work_to_do, int poll)
+static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
+ int work_to_do, int poll)
{
int curidx;
int hwidx;
- sbdmadscr_t *dsc;
+ struct sbdmadscr *dsc;
struct sk_buff *sb;
int len;
int work_done = 0;
@@ -1221,8 +1224,9 @@ again:
prefetch(dsc);
prefetch(&d->sbdma_ctxtable[curidx]);
- hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
- d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t));
+ hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
+ d->sbdma_dscrtable_phys) /
+ sizeof(*d->sbdma_dscrtable);
/*
* If they're the same, that means we've processed all
@@ -1346,11 +1350,12 @@ done:
* nothing
********************************************************************* */
-static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
+static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
+ int poll)
{
int curidx;
int hwidx;
- sbdmadscr_t *dsc;
+ struct sbdmadscr *dsc;
struct sk_buff *sb;
unsigned long flags;
int packets_handled = 0;
@@ -1360,8 +1365,8 @@ static void sbdma_tx_process(struct sbma
if (d->sbdma_remptr == d->sbdma_addptr)
goto end_unlock;
- hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
- d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t));
+ hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
+ d->sbdma_dscrtable_phys) / sizeof(*d->sbdma_dscrtable);
for (;;) {
/*
@@ -1498,7 +1503,7 @@ static int sbmac_initctx(struct sbmac_so
}
-static void sbdma_uninitctx(struct sbmacdma_s *d)
+static void sbdma_uninitctx(struct sbmacdma *d)
{
if (d->sbdma_dscrtable_unaligned) {
kfree(d->sbdma_dscrtable_unaligned);
@@ -1534,7 +1539,7 @@ static void sbmac_uninitctx(struct sbmac
static void sbmac_channel_start(struct sbmac_softc *s)
{
uint64_t reg;
- volatile void __iomem *port;
+ void __iomem *port;
uint64_t cfg,fifo,framecfg;
int idx, th_value;
@@ -1797,10 +1802,10 @@ static void sbmac_channel_stop(struct sb
* Return value:
* old state
********************************************************************* */
-static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc,
- sbmac_state_t state)
+static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *sc,
+ enum sbmac_state state)
{
- sbmac_state_t oldstate = sc->sbm_state;
+ enum sbmac_state oldstate = sc->sbm_state;
/*
* If same as previous state, return
@@ -1935,14 +1940,14 @@ static uint64_t sbmac_addr2reg(unsigned
*
* Input parameters:
* s - sbmac structure
- * speed - speed to set MAC to (see sbmac_speed_t enum)
+ * speed - speed to set MAC to (see enum sbmac_speed)
*
* Return value:
* 1 if successful
* 0 indicates invalid parameters
********************************************************************* */
-static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed)
+static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed)
{
uint64_t cfg;
uint64_t framecfg;
@@ -2024,15 +2029,16 @@ static int sbmac_set_speed(struct sbmac_
*
* Input parameters:
* s - sbmac structure
- * duplex - duplex setting (see sbmac_duplex_t)
- * fc - flow control setting (see sbmac_fc_t)
+ * duplex - duplex setting (see enum sbmac_duplex)
+ * fc - flow control setting (see enum sbmac_fc)
*
* Return value:
* 1 if ok
* 0 if an invalid parameter combination was specified
********************************************************************* */
-static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc)
+static int sbmac_set_duplex(struct sbmac_softc *s, enum sbmac_duplex duplex,
+ enum sbmac_fc fc)
{
uint64_t cfg;
@@ -2232,7 +2238,7 @@ static int sbmac_start_tx(struct sk_buff
static void sbmac_setmulti(struct sbmac_softc *sc)
{
uint64_t reg;
- volatile void __iomem *port;
+ void __iomem *port;
int idx;
struct dev_mc_list *mclist;
struct net_device *dev = sc->sbm_dev;
^ permalink raw reply
* [PATCH] Cleanup calling netdev notifiers
From: Pavel Emelyanov @ 2007-09-14 10:34 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, devel
The call_netdev_notifiers routine can successfully be used in
the net/core_dev.c itself.
This will save 6 lines of code and 62 ;) bytes of .text section.
62 is rather small, but I have one more patch saving ~30 bytes
from netns code (sent to Eric), so altogether they can save
some more noticeable amount.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
net/core/dev.c | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index a76021c..c1c292f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -850,7 +850,7 @@ rollback:
hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
write_unlock_bh(&dev_base_lock);
- ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
+ ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
ret = notifier_to_errno(ret);
if (ret) {
@@ -876,7 +876,7 @@ rollback:
*/
void netdev_features_change(struct net_device *dev)
{
- raw_notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev);
+ call_netdevice_notifiers(NETDEV_FEAT_CHANGE, dev);
}
EXPORT_SYMBOL(netdev_features_change);
@@ -891,8 +891,7 @@ EXPORT_SYMBOL(netdev_features_change);
void netdev_state_change(struct net_device *dev)
{
if (dev->flags & IFF_UP) {
- raw_notifier_call_chain(&netdev_chain,
- NETDEV_CHANGE, dev);
+ call_netdevice_notifiers(NETDEV_CHANGE, dev);
rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
}
}
@@ -988,7 +987,7 @@ int dev_open(struct net_device *dev)
/*
* ... and announce new interface.
*/
- raw_notifier_call_chain(&netdev_chain, NETDEV_UP, dev);
+ call_netdevice_notifiers(NETDEV_UP, dev);
}
return ret;
}
@@ -1011,7 +1010,7 @@ int dev_close(struct net_device *dev)
* Tell people we are going down, so that they can
* prepare to death, when device is still operating.
*/
- raw_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev);
+ call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
dev_deactivate(dev);
@@ -1048,7 +1047,7 @@ int dev_close(struct net_device *dev)
/*
* Tell people we are down
*/
- raw_notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev);
+ call_netdevice_notifiers(NETDEV_DOWN, dev);
return 0;
}
@@ -2906,8 +2905,7 @@ int dev_change_flags(struct net_device *
if (dev->flags & IFF_UP &&
((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
IFF_VOLATILE)))
- raw_notifier_call_chain(&netdev_chain,
- NETDEV_CHANGE, dev);
+ call_netdevice_notifiers(NETDEV_CHANGE, dev);
if ((flags ^ dev->gflags) & IFF_PROMISC) {
int inc = (flags & IFF_PROMISC) ? +1 : -1;
@@ -2953,8 +2951,7 @@ int dev_set_mtu(struct net_device *dev,
else
dev->mtu = new_mtu;
if (!err && dev->flags & IFF_UP)
- raw_notifier_call_chain(&netdev_chain,
- NETDEV_CHANGEMTU, dev);
+ call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
return err;
}
@@ -2970,8 +2967,7 @@ int dev_set_mac_address(struct net_devic
return -ENODEV;
err = dev->set_mac_address(dev, sa);
if (!err)
- raw_notifier_call_chain(&netdev_chain,
- NETDEV_CHANGEADDR, dev);
+ call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
return err;
}
@@ -3027,8 +3023,7 @@ static int dev_ifsioc(struct ifreq *ifr,
return -EINVAL;
memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data,
min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
- raw_notifier_call_chain(&netdev_chain,
- NETDEV_CHANGEADDR, dev);
+ call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
return 0;
case SIOCGIFMAP:
@@ -3475,7 +3470,7 @@ int register_netdevice(struct net_device
write_unlock_bh(&dev_base_lock);
/* Notify protocols, that a new device appeared. */
- ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
+ ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
ret = notifier_to_errno(ret);
if (ret)
unregister_netdevice(dev);
@@ -3546,8 +3541,7 @@ static void netdev_wait_allrefs(struct n
rtnl_lock();
/* Rebroadcast unregister notification */
- raw_notifier_call_chain(&netdev_chain,
- NETDEV_UNREGISTER, dev);
+ call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
&dev->state)) {
@@ -3794,7 +3788,7 @@ void unregister_netdevice(struct net_dev
/* Notify protocols, that we are about to destroy
this device. They should clean all the things.
*/
- raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
+ call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
/*
* Flush the unicast and multicast chains
^ permalink raw reply related
* Re: [RFC] af_packet: allow disabling timestamps
From: Stephen Hemminger @ 2007-09-14 10:26 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Unai Uribarri, David S. Miller, Evgeniy Polyakov, netdev
In-Reply-To: <20070913142406.299944c3.dada1@cosmosbay.com>
On Thu, 13 Sep 2007 14:24:06 +0200
Eric Dumazet <dada1@cosmosbay.com> wrote:
> On Thu, 13 Sep 2007 12:42:53 +0200
> Stephen Hemminger <shemminger@linux-foundation.org> wrote:
>
> > Currently, af_packet does not allow disabling timestamps. This patch changes
> > that but doesn't force global timestamps on.
> >
> > This shows up in bugzilla as:
> > http://bugzilla.kernel.org/show_bug.cgi?id=4809
> >
> > Patch against net-2.6.24 tree.
> >
>
> I am not sure I understood this patch.
>
> This means that tcpdump/ethereal wont get precise timestamps
> (gathered when packet is received), but imprecise ones (gathered when the sniffer reads the packet)
>
> I added some time ago ktime infrastructure to eventually get nanosecond
> precision in libpcap, so I would prefer a step in the right direction :)
>
> Should'nt we use something like :
>
> [PATCH] af_packet : allow disabling timestamps, or requesting nanosecond precision.
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
>
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 5a16e38..1c10b9d 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -563,6 +563,7 @@ set_rcvbuf:
> } else {
> sock_reset_flag(sk, SOCK_RCVTSTAMP);
> sock_reset_flag(sk, SOCK_RCVTSTAMPNS);
> + sock_disable_timestamp(sk);
> }
> break;
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 745e2cb..409de44 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -650,12 +650,27 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
> h->tp_snaplen = snaplen;
> h->tp_mac = macoff;
> h->tp_net = netoff;
> - if (skb->tstamp.tv64)
> - tv = ktime_to_timeval(skb->tstamp);
> - else
> - do_gettimeofday(&tv);
> - h->tp_sec = tv.tv_sec;
> - h->tp_usec = tv.tv_usec;
> + h->tp_sec = 0;
> + h->tp_usec = 0;
> + if ((sock_flag(sk, SOCK_TIMESTAMP))) {
> + if (sock_flag(sk, SOCK_RCVTSTAMPNS)) {
> + struct timespec ts;
> + if (skb->tstamp.tv64)
> + ts = ktime_to_timespec(skb->tstamp);
> + else
> + getnstimeofday(&ts);
> + h->tp_sec = ts.tv_sec;
> + h->tp_usec = ts.tv_nsec; /* cheat a litle bit */
> + }
> + else {
> + if (skb->tstamp.tv64)
> + tv = ktime_to_timeval(skb->tstamp);
> + else
> + do_gettimeofday(&tv);
> + h->tp_sec = tv.tv_sec;
> + h->tp_usec = tv.tv_usec;
> + }
> + }
>
> sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
> sll->sll_halen = 0;
> @@ -1014,6 +1029,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
> sock->ops = &packet_ops_spkt;
>
> sock_init_data(sock, sk);
> + sock_enable_timestamp(sk);
>
> po = pkt_sk(sk);
> sk->sk_family = PF_PACKET;
No, then we end up timestamping all the packets, even if they get dropped by
packet filter. The change in 2.6.24 allows dhclient (and rstp) to only call
hires clock source for packets they want, not all packets.
Perhaps the timestamping needs to change into a tristate flag?
^ permalink raw reply
* Re: Network Namespace status
From: Eric W. Biederman @ 2007-09-14 9:33 UTC (permalink / raw)
To: Oliver Hartkopp
Cc: Linux Containers, netdev, David Miller, Tejun Heo,
Greg Kroah-Hartman, Andrew Morton, Thomas Gleixner, Urs Thuermann
In-Reply-To: <46EA244C.1050702@hartkopp.net>
Oliver Hartkopp <oliver@hartkopp.net> writes:
> can you send me your current AF_PACKET patch? I just want to update our
> recent post of the CAN (controller area network) subsystem (AF_CAN)
> which is (in some parts) similar to AF_PACKET. So i can take a look on
> it to provide the latest technique in the next post ...
Ok the last snapshot of my tree is at:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/linux-2.6-netns.git
And tagged as: netns/v2.6.23-rc5netns45
Although that is the same as the default HEAD until I rebase my tree
again.
Eric
^ 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