* Re: [PATCH net-2.6.22-rc7] xfrm beet interfamily support
From: Joakim Koskela @ 2007-07-19 17:54 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netdev, David Miller
In-Reply-To: <469F7952.207@trash.net>
On Thursday 19 July 2007 17:46:42 Patrick McHardy wrote:
> > -
> > + if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) {
> > + encap_family = xfrm[i]->props.family;
> > + if (encap_family == AF_INET) {
> > + remote.in = (struct in_addr *)
> > + &xfrm[i]->id.daddr.a4;
> > + local.in = (struct in_addr *)
> > + &xfrm[i]->props.saddr.a4;
> > +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
> > + } else if (encap_family == AF_INET6) {
> > + remote.in6 = (struct in6_addr *)
> > + xfrm[i]->id.daddr.a6;
> > + local.in6 = (struct in6_addr *)
> > + xfrm[i]->props.saddr.a6;
> > +#endif
>
> You set the addresses above ..
>
..
>
> and don't seem to use them for anything.
>
Right. Thought I removed that [redundant code], but apparently only on the
ipv6 side, thanks.
>
> > diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
> > + /* Rule 5: select IPsec BEET */
> > + for (i = 0; i < n; i++) {
> > + if (src[i] &&
> > + src[i]->props.mode == XFRM_MODE_BEET) {
> > + dst[j++] = src[i];
> > + src[i] = NULL;
> > + }
> > + }
>
> Just out of interest, is there any particular logic behind the
> ordering of the "rules"?
>
Got me there. Not that familiar with the details of the other modes to make
even any educated guesses..
> > if (likely(j == n))
> > goto end;
> >
> > diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> > index 157bfbd..75fdb7d 100644
> > --- a/net/xfrm/xfrm_policy.c
> > +++ b/net/xfrm/xfrm_policy.c
> > @@ -1299,7 +1299,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy,
> > struct flowi *fl, xfrm_address_t *local = saddr;
> > struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
> >
> > - if (tmpl->mode == XFRM_MODE_TUNNEL) {
> > + if (tmpl->mode == XFRM_MODE_TUNNEL ||
> > + tmpl->mode == XFRM_MODE_BEET) {
>
> Is this a bugfix?
>
> > remote = &tmpl->id.daddr;
> > local = &tmpl->saddr;
> > family = tmpl->encap_family;
> > diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> > index dfacb9c..0a2ff8e 100644
> > --- a/net/xfrm/xfrm_state.c
> > +++ b/net/xfrm/xfrm_state.c
> > @@ -611,7 +611,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t
> > *saddr, selector.
> > */
> > if (x->km.state == XFRM_STATE_VALID) {
> > - if (!xfrm_selector_match(&x->sel, fl, family) ||
> > + if (!xfrm_selector_match(&x->sel, fl, x->sel.family) ||
> > !security_xfrm_state_pol_flow_match(x, pol, fl))
> > continue;
> > if (!best ||
> > @@ -623,7 +623,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t
> > *saddr, acquire_in_progress = 1;
> > } else if (x->km.state == XFRM_STATE_ERROR ||
> > x->km.state == XFRM_STATE_EXPIRED) {
> > - if (xfrm_selector_match(&x->sel, fl, family) &&
> > + if (xfrm_selector_match(&x->sel, fl, x->sel.family) &&
> > security_xfrm_state_pol_flow_match(x, pol, fl))
> > error = -ESRCH;
> > }
>
> And these two? Also look like bugfixes ..
> -
Well yes if we're using interfamily anywhere. D'you think they deserve a patch
for themselves?
Thanks again for reviewing, I'll address the other issues asap. Sort of eager
to get this out as its been dangling for such a long time, but seems I'm
taking a lot of things for granted (..as its been sitting around 'ok' for so
long).
br, j
^ permalink raw reply
* Re: 2.6.22-git: known regressions with patches
From: Bartlomiej Zolnierkiewicz @ 2007-07-19 19:21 UTC (permalink / raw)
To: Michal Piotrowski
Cc: Linus Torvalds, Andrew Morton, LKML, Giacomo Catenazzi,
Jens Axboe, Stefan Richter, Jan Engelhardt, Jens Axboe,
Peter M. Jones, Larry Finger, S.Çağlar Onur,
Meelis Roos, Cornelia Huck, David Howells, netdev, Randy Dunlap,
Trond Myklebust, J. Bruce Fields
In-Reply-To: <469F92B8.5090809@googlemail.com>
Hi,
On Thursday 19 July 2007, Michal Piotrowski wrote:
> Unclassified
>
> Subject : disk error loop (panic?) ide_do_rw_disk-bad
> References : http://lkml.org/lkml/2007/7/17/467
> Last known good : ?
> Submitter : Giacomo Catenazzi <cate@cateee.net>
> Caused-By : ?
> Handled-By : Jens Axboe <jens.axboe@oracle.com>
> Linus Torvalds <torvalds@linux-foundation.org>
> Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Patch : http://lkml.org/lkml/2007/7/19/26
> Status : patch available
Additional patch is an improvement but the regression itself has already
been fixed in the mainline (by reverting problematic changes).
Thanks,
Bart
^ permalink raw reply
* Re: [PATCH v2 1/2] mac80211: improved short preamble handling
From: John W. Linville @ 2007-07-19 19:15 UTC (permalink / raw)
To: Daniel Drake
Cc: jbenc-AlSwsSmVLrQ, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
rt2400-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
mb-fseUSCV1ubazQB+pC5nmwQ, flamingice-R9e9/4HEdknk1uMJSBkQmQ
In-Reply-To: <20070715140739.C13187B409F-k/4jFdqg8LLlyo9zxV8I99HuzzzSOjJt@public.gmane.org>
On Sun, Jul 15, 2007 at 03:07:39PM +0100, Daniel Drake wrote:
> Similarly to CTS protection, whether short preambles are used for 802.11b
> transmissions should be a per-subif setting, not device global.
>
> For STAs, this patch makes short preamble handling automatic based on the ERP
> IE. For APs, hostapd still uses the prism ioctls, but the write ioctl has been
> restricted to AP-only subifs.
>
> ieee80211_txrx_data.short_preamble (an unused field) was removed.
>
> Unfortunately, some API changes were required for the following functions:
> - ieee80211_generic_frame_duration
> - ieee80211_rts_duration
> - ieee80211_ctstoself_duration
> - ieee80211_rts_get
> - ieee80211_ctstoself_get
> Affected drivers (bcm43xx, rt2x00 and rtl8187) were updated accordingly.
>
> Signed-off-by: Daniel Drake <dsd-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Jiri, Michael -- this applies to upstream w/ just some offsets if you
ignore the driver bits that aren't upstream. I'll be happy to handle
the patch monkeying if you are happy w/ this patch.
John
--
John W. Linville
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
^ permalink raw reply
* Re: [PATCH v2 2/2] mac80211: implement ERP info change notifications
From: John W. Linville @ 2007-07-19 19:16 UTC (permalink / raw)
To: Daniel Drake
Cc: jbenc-AlSwsSmVLrQ, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
flamingice-R9e9/4HEdknk1uMJSBkQmQ
In-Reply-To: <20070715140822.C9DC07B409F-k/4jFdqg8LLlyo9zxV8I99HuzzzSOjJt@public.gmane.org>
On Sun, Jul 15, 2007 at 03:08:22PM +0100, Daniel Drake wrote:
> zd1211rw and bcm43xx are interested in being notified when ERP IE conditions
> change, so that they can reprogram a register which affects how control frames
> are transmitted.
>
> This patch adds an interface similar to the one that can be found in softmac.
>
> Signed-off-by: Daniel Drake <dsd-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Jiri, Michael -- just like the other, this applies to upstream w/
just some offsets if you ignore the driver bits that aren't upstream.
Let me know if you are happy w/ this patch.
John
--
John W. Linville
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
^ permalink raw reply
* Re: Linux, tcpdump and vlan
From: Stephen Hemminger @ 2007-07-19 19:28 UTC (permalink / raw)
To: andrei radulescu-banu
Cc: Ben Greear, Patrick McHardy, Krzysztof Halasa, linux-kernel,
Linux Netdev List
In-Reply-To: <839334.9648.qm@web56605.mail.re3.yahoo.com>
On Thu, 19 Jul 2007 11:20:43 -0700 (PDT)
andrei radulescu-banu <iubica2@yahoo.com> wrote:
> > [Ben] If tcpdump and/or bridging needs to disable the hw-accel, then it can
> explicitly do so by some API. That is better than overloading
> the promisc flag in my opinion.
>
> I guess I could be persuaded in the end. But let me still play devil advocate. The semantics of 'promiscuous', in my opinion, mean 'receive everything', including vlan.
>
> > [Ben] This is especially true since promisc
> is not easily readable by user-space and things like tcpdump
> cannot have full control of promisc (if a mac-vlan has the NIC in
> promisc mode, for instance, then tcpdump can never disable it.)
>
> I agree with all the above. For example when you run 'ifconfig' during 'tcpdump', the interface does not have the promiscuous flag set!!
In kernel it is a nice atomic counter, no problem.
>
> This confused me for a while, until I realized that tcpdump's packet socket was using an obscure packet_dev_mc() API (af_packet.c) to get the interface in promiscuous mode. The reason for this is that packet_mc_add() implements a reference counted mechanism for promiscuous. So that:
> - starting tcpdump instance 1 sets promiscuous mode
> - starting tcpdump instance 2 bumps the ref count in packet_mc_add()
> - killing tcpdump instance 1 bumps down the ref count, the interface stays promiscuous
> - killing tcpdump instance 2 truly clear promiscuous mode.
>
> The trick here is that when you kill tcpdump, the kernel clears the packet socket, and in process bumps down the ref count. Had tcpdump manually set/cleared the promisc flag, the interface would have stayed promisc after tcpdump was killed.
>
> (The mac-vlan driver must have this corner problem as well. If a mac-vlan interface is disabled while tcpdump runs, it may yank promiscuousness from under tcpdump.)
The kernel has no such problem
> So if you want to create an ethtool API to set vlan-promiscuous mode, one problem to grapple is that we need a similar mechanism to the above, so you can run two concurrent tcpdump's (or tcpdump while bridging vlans) and the vlan-promiscuous mode gets set correctly each time. For tcpdump at least, the new ethtool API needs to be called from packet_mc_add().
^ permalink raw reply
* Re: [PATCH net-2.6.22-rc7] xfrm beet interfamily support
From: Patrick McHardy @ 2007-07-19 19:43 UTC (permalink / raw)
To: joakim.koskela; +Cc: netdev, David Miller
In-Reply-To: <200707192054.38945.joakim.koskela@hiit.fi>
Joakim Koskela wrote:
> On Thursday 19 July 2007 17:46:42 Patrick McHardy wrote:
>
>> And these two? Also look like bugfixes ..
>>
>>
>
> Well yes if we're using interfamily anywhere. D'you think they deserve a patch
> for themselves?
>
Yes, that looks worth it. And it will help reduce the size of your
patch and make it easier reviewable.
^ permalink raw reply
* Re: [PATCH v2 2/2] mac80211: implement ERP info change notifications
From: Jiri Benc @ 2007-07-19 19:50 UTC (permalink / raw)
To: John W. Linville; +Cc: Daniel Drake, netdev, linux-wireless, flamingice
In-Reply-To: <20070719191633.GE6603@tuxdriver.com>
On Thu, 19 Jul 2007 15:16:33 -0400, John W. Linville wrote:
> On Sun, Jul 15, 2007 at 03:08:22PM +0100, Daniel Drake wrote:
> > zd1211rw and bcm43xx are interested in being notified when ERP IE conditions
> > change, so that they can reprogram a register which affects how control frames
> > are transmitted.
> >
> > This patch adds an interface similar to the one that can be found in softmac.
> >
> > Signed-off-by: Daniel Drake <dsd@gentoo.org>
>
> Jiri, Michael -- just like the other, this applies to upstream w/
> just some offsets if you ignore the driver bits that aren't upstream.
> Let me know if you are happy w/ this patch.
ACK for both.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply
* Re: [PATCH 1/2] Fix error checking in Vitesse IRQ config
From: Kumar Gala @ 2007-07-19 19:57 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, linuxppc-dev@ozlabs.org list, Andy Fleming
In-Reply-To: <11847405503115-git-send-email-afleming@freescale.com>
On Jul 18, 2007, at 1:35 AM, Andy Fleming wrote:
> phy_read() returns a negative number if there's an error, but the
> error-checking code in the Vitesse driver's config_intr function
> triggers if phy_read() returns non-zero. Correct that.
>
> Signed-off-by: Andy Fleming <afleming@freescale.com>
Jeff,
Can you make sure to send this to linus since its need to properly
fix the Vitesse phy's used on the 8641HPCN and 8544 DS boards.
thanks
- k
> ---
> I made a really stupid mistake in the 4 patches I sent out,
> earlier. I
> thought those patches had been tested, but they hadn't been. This one
> corrects a tiny error in the patch, and they have now been tested.
> As before
> this change can be pulled from:
>
> http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev
>
> Really, REALLY sorry about that. I have been given a paper bag of
> appropriate
> size and shape to fit over my head.
>
> drivers/net/phy/vitesse.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
> index 6a53856..8874497 100644
> --- a/drivers/net/phy/vitesse.c
> +++ b/drivers/net/phy/vitesse.c
> @@ -109,7 +109,7 @@ static int vsc824x_config_intr(struct
> phy_device *phydev)
> */
> err = phy_read(phydev, MII_VSC8244_ISTAT);
>
> - if (err)
> + if (err < 0)
> return err;
>
> err = phy_write(phydev, MII_VSC8244_IMASK, 0);
> --
> 1.5.0.2.230.gfbe3d-dirty
>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: net/ipv4/inetpeer.c stack warnings
From: David Miller @ 2007-07-19 21:16 UTC (permalink / raw)
To: nix.or.die; +Cc: linux-kernel, netdev
In-Reply-To: <469F5941.7090900@googlemail.com>
From: Gabriel C <nix.or.die@googlemail.com>
Date: Thu, 19 Jul 2007 14:29:53 +0200
> Hello ,
>
> I noticed on current git this warning in net/ipv4/inetpeer.c
>
> ...
>
> CC net/ipv4/inetpeer.o
> net/ipv4/inetpeer.c: In function 'unlink_from_pool':
> net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always
> evaluate as 'true'
> net/ipv4/inetpeer.c:297: warning: the address of 'stack' will always
> evaluate as 'true'
> net/ipv4/inetpeer.c: In function 'inet_getpeer':
> net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always
> evaluate as 'true'
> net/ipv4/inetpeer.c:409: warning: the address of 'stack' will always
> evaluate as 'true'
The compiler should not warn about that at all, the lookup()
macro is called with "stack" set to NULL.
^ permalink raw reply
* Re: Linux, tcpdump and vlan
From: andrei radulescu-banu @ 2007-07-19 21:38 UTC (permalink / raw)
To: Patrick McHardy
Cc: Stephen Hemminger, Krzysztof Halasa, linux-kernel,
Linux Netdev List
During debugging, I noticed that dev_queue_xmit() is called twice for tx vlan frames. This results in a frame being passed twice to a packet socket bound to 'any' interface. If the packet socket is bound to a specific interface, though, it will get only one copy of the tx frame, which is good.
In more detail: suppose we're tx'ing a frame, and the route table lookup yields a vlan outgoing device eth0.2. dev_queue_xmit() is called, which calls dev_queue_xmit_nit() for dev = eth0.2 then dev->hard_start_xmit() for dev = eth0.2.
The latter call gets into the vlan layer, which attaches the vlan id 2 (accelerated or not... in my e1000 case accelerated) then calls dev_queue_xmit() again. This time around dev_queue_xmit_nit() is called for dev = eth0, and dev->hard_start_xmit() actually calls the ethernet driver.
The net result is that dev_queue_xmit_nit() is called twice, once for dev=eth0.2 then for dev=eth0.
____________________________________________________________________________________
Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
^ permalink raw reply
* Re: [PATCH] net/, drivers/net/ , missing EXPERIMENTAL in menus
From: Simon Arlott @ 2007-07-19 22:05 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Robert P. J. Day, Randy Dunlap, Stefan Richter, Adrian Bunk,
Jeff Garzik, Gabriel C, netdev
In-Reply-To: <Pine.LNX.4.64.0707191213130.8844@localhost.localdomain>
On 19/07/07 17:19, Robert P. J. Day wrote:
> On Thu, 19 Jul 2007, Randy Dunlap wrote:
>> I think that Stefan means a patch to the kconfig source code,
>> not the the Kconfig files. Good luck. I'd still like to see it.
>
> yes, i understand what he wanted now. as a first step (that
> theoretically shouldn't change any behaviour), i'd patch the Kconfig
> structure to add a new attribute ("maturity") which would be allowed
> to be set to *exactly one* of a pre-defined set of values (say,
> OBSOLETE, DEPRECATED, EXPERIMENTAL, and STILLBLEEDING). and that's
> it, nothing more.
>
> don't try to do anything with any of that just yet, just add the
> infrastructure to support the (optional) association of a maturity
> level with a config option. that's step one.
What about something like this? I'm not sure if the addition to sym_init
is desirable... I also had to prefix _ to the name for now otherwise it
conflicts badly with the current symbols. It probably should stop
"depends on _BROKEN" etc. too.
---
diff --git a/init/Kconfig b/init/Kconfig
diff --git a/net/Kconfig b/net/Kconfig
index cdba08c..5e2f4db 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -6,6 +6,7 @@ menu "Networking"
config NET
bool "Networking support"
+ maturity _BROKEN
---help---
Unless you really know what you are doing, you should say Y here.
The reason is that some programs need kernel networking support even
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index fb2bb30..1dea08e 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -256,7 +256,7 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h
# The following requires flex/bison/gperf
# By default we use the _shipped versions, uncomment the following line if
# you are modifying the flex/bison src.
-# LKC_GENPARSER := 1
+LKC_GENPARSER := 1
ifdef LKC_GENPARSER
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 1199baf..cc9be0e 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -211,6 +211,22 @@ static int conf_sym(struct menu *menu)
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
+ switch (sym->maturity) {
+ case M_EXPERIMENTAL:
+ printf("(EXPERIMENTAL) ");
+ break;
+ case M_DEPRECATED:
+ printf("(DEPRECATED) ");
+ break;
+ case M_OBSOLETE:
+ printf("(OBSOLETE) ");
+ break;
+ case M_BROKEN:
+ printf("(BROKEN) ");
+ break;
+ default:
+ break;
+ }
if (sym->name)
printf("(%s) ", sym->name);
type = sym_get_type(sym);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 6084525..a22b6c1 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -60,7 +60,11 @@ struct symbol_value {
};
enum symbol_type {
- S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
+ S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_MATURITY,
S_OTHER
+};
+
+enum maturity_level {
+ M_NONE, M_EXPERIMENTAL, M_DEPRECATED, M_OBSOLETE, M_BROKEN
};
enum {
@@ -72,6 +76,7 @@ struct symbol {
struct symbol *next;
char *name;
char *help;
+ enum maturity_level maturity;
enum symbol_type type;
struct symbol_value curr;
struct symbol_value def[4];
diff --git a/scripts/kconfig/lex.zconf.c_shipped
b/scripts/kconfig/lex.zconf.c_shipped
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 8a07ee4..9add1cd 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -79,6 +79,7 @@ void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
void menu_end_entry(void);
void menu_add_dep(struct expr *dep);
+void menu_set_maturity(struct symbol *sym);
struct property *menu_add_prop(enum prop_type type, char *prompt,
struct expr *expr, struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt,
struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr
*dep);
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index d0e4fa5..eaf199b 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -238,6 +238,7 @@ search_help[] = N_(
"Result:\n"
"-----------------------------------------------------------------\n"
"Symbol: FOO [=m]\n"
+ "Maturity: FOO\n"
"Prompt: Foo bus is used to drive the bar HW\n"
"Defined at drivers/pci/Kconfig:47\n"
"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
@@ -359,6 +360,27 @@ static void get_symbol_str(struct gstr *r, struct
symbol *sym)
str_printf(r, "Symbol: %s [=%s]\n", sym->name,
sym_get_string_value(sym));
+
+ if (sym->maturity != M_NONE) {
+ str_append(r, "Maturity: ");
+ switch (sym->maturity) {
+ case M_EXPERIMENTAL:
+ str_append(r, "EXPERIMENTAL\n");
+ break;
+ case M_DEPRECATED:
+ str_append(r, "DEPRECATED\n");
+ break;
+ case M_OBSOLETE:
+ str_append(r, "OBSOLETE\n");
+ break;
+ case M_BROKEN:
+ str_append(r, "BROKEN\n");
+ break;
+ default:
+ break;
+ }
+ }
+
for_all_prompts(sym, prop)
get_prompt_str(r, prop);
hit = false;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index f14aeac..3e37e5b 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -104,6 +104,15 @@ void menu_add_dep(struct expr *dep)
current_entry->dep = expr_alloc_and(current_entry->dep,
menu_check_dep(dep));
}
+void menu_set_maturity(struct symbol *sym)
+{
+ if (sym->type != S_MATURITY) {
+ zconf_error("'%s' is an invalid maturity level", sym->name);
+ } else {
+ current_entry->sym->maturity = sym->maturity;
+ }
+}
+
void menu_set_type(int type)
{
struct symbol *sym = current_entry->sym;
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index c35dcc5..280ee8f 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -72,6 +72,22 @@ void sym_init(void)
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
sym_add_default(sym, uts.release);
+
+ sym = sym_lookup("_EXPERIMENTAL", 0);
+ sym->type = S_MATURITY;
+ sym->maturity = M_EXPERIMENTAL;
+
+ sym = sym_lookup("_DEPRECATED", 0);
+ sym->type = S_MATURITY;
+ sym->maturity = M_DEPRECATED;
+
+ sym = sym_lookup("_OBSOLETE", 0);
+ sym->type = S_MATURITY;
+ sym->maturity = M_OBSOLETE;
+
+ sym = sym_lookup("_BROKEN", 0);
+ sym->type = S_MATURITY;
+ sym->maturity = M_BROKEN;
}
enum symbol_type sym_get_type(struct symbol *sym)
@@ -100,6 +116,8 @@ const char *sym_type_name(enum symbol_type type)
return "hex";
case S_STRING:
return "string";
+ case S_MATURITY:
+ return "maturity";
case S_UNKNOWN:
return "unknown";
case S_OTHER:
@@ -679,6 +697,7 @@ struct symbol *sym_lookup(const char *name, int isconst)
memset(symbol, 0, sizeof(*symbol));
symbol->name = new_name;
symbol->type = S_UNKNOWN;
+ symbol->maturity = M_NONE;
if (isconst)
symbol->flags |= SYMBOL_CONST;
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index 9b44c80..756d559 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -25,6 +25,7 @@ endif, T_ENDIF, TF_COMMAND
depends, T_DEPENDS, TF_COMMAND
requires, T_REQUIRES, TF_COMMAND
optional, T_OPTIONAL, TF_COMMAND
+maturity, T_MATURITY, TF_COMMAND
default, T_DEFAULT, TF_COMMAND, S_UNKNOWN
prompt, T_PROMPT, TF_COMMAND
tristate, T_TYPE, TF_COMMAND, S_TRISTATE
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 92eb02b..1b47966 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -66,6 +66,7 @@ static struct menu *current_menu, *current_entry;
%token <id>T_DEPENDS
%token <id>T_REQUIRES
%token <id>T_OPTIONAL
+%token <id>T_MATURITY
%token <id>T_PROMPT
%token <id>T_TYPE
%token <id>T_DEFAULT
@@ -120,7 +121,7 @@ stmt_list:
;
option_name:
- T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE |
T_DEFAULT
+ T_DEPENDS | T_MATURITY | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL |
T_RANGE | T_DEFAULT
;
common_stmt:
@@ -177,6 +178,7 @@ config_option_list:
| config_option_list config_option
| config_option_list symbol_option
| config_option_list depends
+ | config_option_list maturity
| config_option_list help
| config_option_list option_error
| config_option_list T_EOL
@@ -269,6 +271,7 @@ choice_option_list:
/* empty */
| choice_option_list choice_option
| choice_option_list depends
+ | choice_option_list maturity
| choice_option_list help
| choice_option_list T_EOL
| choice_option_list option_error
@@ -349,7 +352,7 @@ menu: T_MENU prompt T_EOL
printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
};
-menu_entry: menu depends_list
+menu_entry: menu maturity_set_opt depends_list
{
$$ = menu_add_menu();
};
@@ -430,6 +433,19 @@ depends: T_DEPENDS T_ON expr T_EOL
printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
};
+/* maturity setting */
+
+maturity_set_opt:
+ /* empty */
+ | maturity
+;
+
+maturity: T_MATURITY symbol T_EOL
+{
+ menu_set_maturity($2);
+ printd(DEBUG_PARSE, "%s:%d:maturity\n", zconf_curname(), zconf_lineno());
+};
+
/* prompt statement */
prompt_stmt_opt:
@@ -519,6 +535,7 @@ const char *zconf_tokenname(int token)
case T_IF: return "if";
case T_ENDIF: return "endif";
case T_DEPENDS: return "depends";
+ case T_MATURITY: return "maturity";
}
return "<token>";
}
@@ -615,6 +632,9 @@ void print_symbol(FILE *out, struct menu *menu)
case S_HEX:
fputs(" hex\n", out);
break;
+ case S_MATURITY:
+ fputs(" maturity\n", out);
+ break;
default:
fputs(" ???\n", out);
break;
--
Simon Arlott
^ permalink raw reply related
* Re: [PATCH] net/, drivers/net/ , missing EXPERIMENTAL in menus
From: Robert P. J. Day @ 2007-07-19 22:28 UTC (permalink / raw)
To: Simon Arlott
Cc: Linux Kernel Mailing List, Randy Dunlap, Stefan Richter,
Adrian Bunk, Jeff Garzik, Gabriel C, netdev
In-Reply-To: <469FE045.3070403@simon.arlott.org.uk>
On Thu, 19 Jul 2007, Simon Arlott wrote:
> On 19/07/07 17:19, Robert P. J. Day wrote:
> > On Thu, 19 Jul 2007, Randy Dunlap wrote:
> >> I think that Stefan means a patch to the kconfig source code,
> >> not the the Kconfig files. Good luck. I'd still like to see it.
> >
> > yes, i understand what he wanted now. as a first step (that
> > theoretically shouldn't change any behaviour), i'd patch the Kconfig
> > structure to add a new attribute ("maturity") which would be allowed
> > to be set to *exactly one* of a pre-defined set of values (say,
> > OBSOLETE, DEPRECATED, EXPERIMENTAL, and STILLBLEEDING). and that's
> > it, nothing more.
> >
> > don't try to do anything with any of that just yet, just add the
> > infrastructure to support the (optional) association of a maturity
> > level with a config option. that's step one.
>
> What about something like this? I'm not sure if the addition to sym_init
> is desirable... I also had to prefix _ to the name for now otherwise it
> conflicts badly with the current symbols. It probably should stop
> "depends on _BROKEN" etc. too.
>
> ---
> diff --git a/init/Kconfig b/init/Kconfig
> diff --git a/net/Kconfig b/net/Kconfig
> index cdba08c..5e2f4db 100644
> --- a/net/Kconfig
> +++ b/net/Kconfig
> @@ -6,6 +6,7 @@ menu "Networking"
>
> config NET
> bool "Networking support"
> + maturity _BROKEN
just as a bit of a digression, "BROKEN" is not what i would call a
maturity level, and i would explicitly *not* allow that as a possible
maturity because that just makes a mess of the design.
i specifically wanted to define a maturity level so that any feature
could be categorized as belonging to *at most* one maturity level.
that is, you can't be both EXPERIMENTAL and DEPRECATED at the same
time -- that just makes no sense.
once you tag some features with a maturity level, then part of the
build would involve selecting which subset of maturity levels you
wanted to see. by default, you'd get to see those features that
weren't tagged at all, but you might also make a selection like this:
[*] EXPERIMENTAL
[*] DEPRECATED
[ ] OBSOLETE
in other words, you wanted the choice of stuff in the first two
categories, but not the third. (you would, of course, always get to
choose from non-tagged stuff, which would be your *normal* content,
exactly as it is now).
so what about BROKEN? i would invent a whole new attribute for that,
called maybe "status":
config FUBAR
depends on ...
maturity DEPRECATED
status BROKEN
...
"status" is a totally orthogonal attribute to maturity. status might
be one of BROKEN, BROKEN_ON_SMP, FLAKEY_AS HELL, etc. and, once
again, any feature can fall into *at most* one status category. once
you have the infrastructure to support a single attribute like
maturity, you get any additional ones for free. and rather than
defining all those things as simple dependencies, by creating new
objects called "attributes", you can play all sorts of interesting new
games, and the attribute infrastructure can enforce that you're using
it properly.
now i'll go away and read the rest of your post. :-)
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================
^ permalink raw reply
* [PATCH] make xfrm_audit_log more generic
From: Joy Latten @ 2007-07-19 22:42 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-audit, sgrubb
This patch modifies xfrm_audit_log() such that it
can accomodate auditing other ipsec events
besides add/delete of an SA or SPD entry.
This is a small change to accomodate updating
ipsec protocol to RFCs 4301, 4302 and 4303 which
require auditing some ipsec events if auditing
is available. Please let me know if ok.
I tested with selinux/labeled-ipsec/plain-ipsec and plain ipsec
without selinux. Also compiled and tested with auditing disabled.
Regards,
Joy
Signed-off-by: Joy Latten <latten@austin.ibm.com>
diff -urpN linux-2.6.22/include/linux/audit.h linux-2.6.22.patch/include/linux/audit.h
--- linux-2.6.22/include/linux/audit.h 2007-07-19 13:17:22.000000000 -0500
+++ linux-2.6.22.patch/include/linux/audit.h 2007-07-19 13:21:29.000000000 -0500
@@ -108,10 +108,7 @@
#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
-#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */
-#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */
-#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */
-#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */
+#define AUDIT_MAC_IPSEC_EVENT 1411 /* Audit IPSec events */
#define AUDIT_FIRST_KERN_ANOM_MSG 1700
#define AUDIT_LAST_KERN_ANOM_MSG 1799
diff -urpN linux-2.6.22/include/net/xfrm.h linux-2.6.22.patch/include/net/xfrm.h
--- linux-2.6.22/include/net/xfrm.h 2007-07-19 13:17:22.000000000 -0500
+++ linux-2.6.22.patch/include/net/xfrm.h 2007-07-19 13:21:29.000000000 -0500
@@ -427,9 +427,11 @@ struct xfrm_audit
#ifdef CONFIG_AUDITSYSCALL
extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
- struct xfrm_policy *xp, struct xfrm_state *x);
+ u16 family, xfrm_address_t saddr,
+ xfrm_address_t daddr, __be32 spi, __be32 flowid,
+ struct xfrm_sec_ctx *sctx, char *buf);
#else
-#define xfrm_audit_log(a,s,t,r,p,x) do { ; } while (0)
+#define xfrm_audit_log(a,i,t,r,f,s,d,p,l,c,b) do { ; } while (0)
#endif /* CONFIG_AUDITSYSCALL */
static inline void xfrm_pol_hold(struct xfrm_policy *policy)
diff -urpN linux-2.6.22/net/key/af_key.c linux-2.6.22.patch/net/key/af_key.c
--- linux-2.6.22/net/key/af_key.c 2007-07-08 18:32:17.000000000 -0500
+++ linux-2.6.22.patch/net/key/af_key.c 2007-07-19 13:21:30.000000000 -0500
@@ -1459,7 +1459,9 @@ static int pfkey_add(struct sock *sk, st
err = xfrm_state_update(x);
xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_ADDSA, err ? 0 : 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ x->props.family, x->props.saddr, x->id.daddr,
+ x->id.spi, 0, x->security, "SAD add");
if (err < 0) {
x->km.state = XFRM_STATE_DEAD;
@@ -1513,7 +1515,10 @@ static int pfkey_delete(struct sock *sk,
km_state_notify(x, &c);
out:
xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1, x->props.family,
+ x->props.saddr, x->id.daddr, x->id.spi, 0,
+ x->security, "SAD delete");
+
xfrm_state_put(x);
return err;
@@ -2266,7 +2271,9 @@ static int pfkey_spdadd(struct sock *sk,
hdr->sadb_msg_type != SADB_X_SPDUPDATE);
xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_ADDSPD, err ? 0 : 1, xp, NULL);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ xp->selector.family, xp->selector.saddr,
+ xp->selector.daddr, 0, 0, xp->security, "SPD add");
if (err)
goto out;
@@ -2350,7 +2357,9 @@ static int pfkey_spddelete(struct sock *
return -ENOENT;
xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ xp->selector.family, xp->selector.saddr,
+ xp->selector.daddr, 0, 0, xp->security, "SPD delete");
if (err)
goto out;
@@ -2611,7 +2620,10 @@ static int pfkey_spdget(struct sock *sk,
if (delete) {
xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ xp->selector.family, xp->selector.saddr,
+ xp->selector.daddr, 0, 0, xp->security,
+ "SPD delete");
if (err)
goto out;
diff -urpN linux-2.6.22/net/xfrm/xfrm_policy.c linux-2.6.22.patch/net/xfrm/xfrm_policy.c
--- linux-2.6.22/net/xfrm/xfrm_policy.c 2007-07-19 13:17:23.000000000 -0500
+++ linux-2.6.22.patch/net/xfrm/xfrm_policy.c 2007-07-19 13:21:30.000000000 -0500
@@ -853,8 +853,11 @@ xfrm_policy_flush_secctx_check(u8 type,
if (err) {
xfrm_audit_log(audit_info->loginuid,
audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 0,
- pol, NULL);
+ AUDIT_MAC_IPSEC_EVENT, 0,
+ pol->selector.family,
+ pol->selector.saddr,
+ pol->selector.daddr, 0, 0,
+ pol->security, "SPD delete");
return err;
}
}
@@ -868,8 +871,12 @@ xfrm_policy_flush_secctx_check(u8 type,
if (err) {
xfrm_audit_log(audit_info->loginuid,
audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD,
- 0, pol, NULL);
+ AUDIT_MAC_IPSEC_EVENT,
+ 0, pol->selector.family,
+ pol->selector.saddr,
+ pol->selector.daddr,
+ 0, 0, pol->security,
+ "SPD delete");
return err;
}
}
@@ -911,7 +918,11 @@ int xfrm_policy_flush(u8 type, struct xf
write_unlock_bh(&xfrm_policy_lock);
xfrm_audit_log(audit_info->loginuid, audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 1, pol, NULL);
+ AUDIT_MAC_IPSEC_EVENT, 1,
+ pol->selector.family,
+ pol->selector.saddr,
+ pol->selector.daddr, 0, 0,
+ pol->security, "SPD delete");
xfrm_policy_kill(pol);
killed++;
@@ -933,8 +944,11 @@ int xfrm_policy_flush(u8 type, struct xf
xfrm_audit_log(audit_info->loginuid,
audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 1,
- pol, NULL);
+ AUDIT_MAC_IPSEC_EVENT, 1,
+ pol->selector.family,
+ pol->selector.saddr,
+ pol->selector.daddr, 0, 0,
+ pol->security, "SPD delete");
xfrm_policy_kill(pol);
killed++;
@@ -2154,44 +2168,23 @@ EXPORT_SYMBOL(xfrm_bundle_ok);
/* Audit addition and deletion of SAs and ipsec policy */
void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
- struct xfrm_policy *xp, struct xfrm_state *x)
+ u16 family, xfrm_address_t saddr, xfrm_address_t daddr,
+ __be32 spi, __be32 flowlabel, struct xfrm_sec_ctx *sctx,
+ char *buf)
{
-
char *secctx;
u32 secctx_len;
- struct xfrm_sec_ctx *sctx = NULL;
struct audit_buffer *audit_buf;
- int family;
extern int audit_enabled;
if (audit_enabled == 0)
return;
- BUG_ON((type == AUDIT_MAC_IPSEC_ADDSA ||
- type == AUDIT_MAC_IPSEC_DELSA) && !x);
- BUG_ON((type == AUDIT_MAC_IPSEC_ADDSPD ||
- type == AUDIT_MAC_IPSEC_DELSPD) && !xp);
-
audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type);
if (audit_buf == NULL)
return;
- switch(type) {
- case AUDIT_MAC_IPSEC_ADDSA:
- audit_log_format(audit_buf, "SAD add: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_DELSA:
- audit_log_format(audit_buf, "SAD delete: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_ADDSPD:
- audit_log_format(audit_buf, "SPD add: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_DELSPD:
- audit_log_format(audit_buf, "SPD delete: auid=%u", auid);
- break;
- default:
- return;
- }
+ audit_log_format(audit_buf, "%s: auid=%u", buf, auid);
if (sid != 0 &&
security_secid_to_secctx(sid, &secctx, &secctx_len) == 0)
@@ -2199,16 +2192,6 @@ void xfrm_audit_log(uid_t auid, u32 sid,
else
audit_log_task_context(audit_buf);
- if (xp) {
- family = xp->selector.family;
- if (xp->security)
- sctx = xp->security;
- } else {
- family = x->props.family;
- if (x->security)
- sctx = x->security;
- }
-
if (sctx)
audit_log_format(audit_buf,
" sec_alg=%u sec_doi=%u sec_obj=%s",
@@ -2216,48 +2199,24 @@ void xfrm_audit_log(uid_t auid, u32 sid,
switch(family) {
case AF_INET:
- {
- struct in_addr saddr, daddr;
- if (xp) {
- saddr.s_addr = xp->selector.saddr.a4;
- daddr.s_addr = xp->selector.daddr.a4;
- } else {
- saddr.s_addr = x->props.saddr.a4;
- daddr.s_addr = x->id.daddr.a4;
- }
- audit_log_format(audit_buf,
- " src=%u.%u.%u.%u dst=%u.%u.%u.%u",
- NIPQUAD(saddr), NIPQUAD(daddr));
- }
- break;
+ audit_log_format(audit_buf,
+ " src=" NIPQUAD_FMT " dst=" NIPQUAD_FMT,
+ NIPQUAD(saddr.a4), NIPQUAD(daddr.a4));
+ break;
case AF_INET6:
- {
- struct in6_addr saddr6, daddr6;
- if (xp) {
- memcpy(&saddr6, xp->selector.saddr.a6,
- sizeof(struct in6_addr));
- memcpy(&daddr6, xp->selector.daddr.a6,
- sizeof(struct in6_addr));
- } else {
- memcpy(&saddr6, x->props.saddr.a6,
- sizeof(struct in6_addr));
- memcpy(&daddr6, x->id.daddr.a6,
- sizeof(struct in6_addr));
- }
- audit_log_format(audit_buf,
- " src=" NIP6_FMT " dst=" NIP6_FMT,
- NIP6(saddr6), NIP6(daddr6));
- }
+ audit_log_format(audit_buf, " src=" NIP6_FMT " dst=" NIP6_FMT,
+ NIP6(*((struct in6_addr *)&saddr.a6)),
+ NIP6(*((struct in6_addr *)&daddr.a6)));
break;
}
- if (x)
- audit_log_format(audit_buf, " spi=%lu(0x%lx) protocol=%s",
- (unsigned long)ntohl(x->id.spi),
- (unsigned long)ntohl(x->id.spi),
- x->id.proto == IPPROTO_AH ? "AH" :
- (x->id.proto == IPPROTO_ESP ?
- "ESP" : "IPCOMP"));
+ if (flowlabel)
+ audit_log_format(audit_buf, " flowlabel=%u", flowlabel);
+
+ if (spi)
+ audit_log_format(audit_buf, " spi=%lu(0x%lx)",
+ (unsigned long)ntohl(spi),
+ (unsigned long)ntohl(spi));
audit_log_format(audit_buf, " res=%u", result);
audit_log_end(audit_buf);
diff -urpN linux-2.6.22/net/xfrm/xfrm_state.c linux-2.6.22.patch/net/xfrm/xfrm_state.c
--- linux-2.6.22/net/xfrm/xfrm_state.c 2007-07-19 13:17:23.000000000 -0500
+++ linux-2.6.22.patch/net/xfrm/xfrm_state.c 2007-07-19 13:21:30.000000000 -0500
@@ -303,7 +303,9 @@ expired:
km_state_expired(x, 1, 0);
xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ x->props.family, x->props.saddr, x->id.daddr, x->id.spi,
+ 0, x->security, "SAD delete");
out:
spin_unlock(&x->lock);
@@ -406,8 +408,10 @@ xfrm_state_flush_secctx_check(u8 proto,
(err = security_xfrm_state_delete(x)) != 0) {
xfrm_audit_log(audit_info->loginuid,
audit_info->secid,
- AUDIT_MAC_IPSEC_DELSA,
- 0, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, 0,
+ x->props.family, x->props.saddr,
+ x->id.daddr, x->id.spi, 0,
+ x->security, "SAD delete");
return err;
}
@@ -446,8 +450,11 @@ restart:
err = xfrm_state_delete(x);
xfrm_audit_log(audit_info->loginuid,
audit_info->secid,
- AUDIT_MAC_IPSEC_DELSA,
- err ? 0 : 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT,
+ err ? 0 : 1, x->props.family,
+ x->props.saddr, x->id.daddr,
+ x->id.spi, 0, x->security,
+ "SAD delete");
xfrm_state_put(x);
spin_lock_bh(&xfrm_state_lock);
diff -urpN linux-2.6.22/net/xfrm/xfrm_user.c linux-2.6.22.patch/net/xfrm/xfrm_user.c
--- linux-2.6.22/net/xfrm/xfrm_user.c 2007-07-08 18:32:17.000000000 -0500
+++ linux-2.6.22.patch/net/xfrm/xfrm_user.c 2007-07-19 13:21:30.000000000 -0500
@@ -456,7 +456,9 @@ static int xfrm_add_sa(struct sk_buff *s
err = xfrm_state_update(x);
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_ADDSA, err ? 0 : 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ x->props.family, x->props.saddr, x->id.daddr,
+ x->id.spi, 0, x->security, "SAD add");
if (err < 0) {
x->km.state = XFRM_STATE_DEAD;
@@ -539,7 +541,9 @@ static int xfrm_del_sa(struct sk_buff *s
out:
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ x->props.family, x->props.saddr, x->id.daddr,
+ x->id.spi, 0, x->security, "SAD delete");
xfrm_state_put(x);
return err;
}
@@ -1149,7 +1153,9 @@ static int xfrm_add_policy(struct sk_buf
excl = nlh->nlmsg_type == XFRM_MSG_NEWPOLICY;
err = xfrm_policy_insert(p->dir, xp, excl);
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ xp->selector.family, xp->selector.saddr,
+ xp->selector.daddr, 0, 0, xp->security, "SPD delete");
if (err) {
security_xfrm_policy_free(xp);
@@ -1395,7 +1401,10 @@ static int xfrm_get_policy(struct sk_buf
}
} else {
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ AUDIT_MAC_IPSEC_EVENT, err ? 0 : 1,
+ xp->selector.family, xp->selector.saddr,
+ xp->selector.daddr, 0, 0, xp->security,
+ "SPD delete");
if (err != 0)
goto out;
@@ -1644,8 +1653,9 @@ static int xfrm_add_pol_expire(struct sk
if (up->hard) {
xfrm_policy_delete(xp, p->dir);
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, 1, xp, NULL);
-
+ AUDIT_MAC_IPSEC_EVENT, 1, xp->selector.family,
+ xp->selector.saddr, xp->selector.daddr, 0, 0,
+ xp->security, "SPD delete");
} else {
// reset the timers here?
printk("Dont know what to do with soft policy expire\n");
@@ -1680,7 +1690,9 @@ static int xfrm_add_sa_expire(struct sk_
if (ue->hard) {
__xfrm_state_delete(x);
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSA, 1, NULL, x);
+ AUDIT_MAC_IPSEC_EVENT, 1, x->props.family,
+ x->props.saddr, x->id.daddr, x->id.spi, 0,
+ x->security, "SAD delete");
}
err = 0;
out:
^ permalink raw reply
* Re: Linux, tcpdump and vlan
From: Ben Greear @ 2007-07-19 23:38 UTC (permalink / raw)
To: andrei radulescu-banu
Cc: Patrick McHardy, Stephen Hemminger, Krzysztof Halasa,
linux-kernel, Linux Netdev List
In-Reply-To: <930446.33248.qm@web56601.mail.re3.yahoo.com>
andrei radulescu-banu wrote:
> During debugging, I noticed that dev_queue_xmit() is called twice for tx vlan frames. This results in a frame being passed twice to a packet socket bound to 'any' interface. If the packet socket is bound to a specific interface, though, it will get only one copy of the tx frame, which is good.
>
> In more detail: suppose we're tx'ing a frame, and the route table lookup yields a vlan outgoing device eth0.2. dev_queue_xmit() is called, which calls dev_queue_xmit_nit() for dev = eth0.2 then dev->hard_start_xmit() for dev = eth0.2.
>
> The latter call gets into the vlan layer, which attaches the vlan id 2 (accelerated or not... in my e1000 case accelerated) then calls dev_queue_xmit() again. This time around dev_queue_xmit_nit() is called for dev = eth0, and dev->hard_start_xmit() actually calls the ethernet driver.
>
> The net result is that dev_queue_xmit_nit() is called twice, once for dev=eth0.2 then for dev=eth0.
Maybe binding to all isn't such a good idea then.
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH 0/5] atl1: additional patches for 2.6.23
From: Jay Cliburn @ 2007-07-19 23:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, atl1-devel, csnook
Please accept the following patches for the atl1 driver. Thanks.
atl1: use kernel provided ethernet length constants
atl1: fix typo in dma_req_block
atl1: change cmb write threshold
atl1: fix typo in DMA engine setup
atl1: change tpd_avail function name
drivers/net/atl1/atl1_hw.h | 9 ++-------
drivers/net/atl1/atl1_main.c | 26 +++++++++++++++-----------
2 files changed, 17 insertions(+), 18 deletions(-)
^ permalink raw reply
* [PATCH 1/5] atl1: change tpd_avail function name
From: Jay Cliburn @ 2007-07-19 23:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, atl1-devel, csnook, Jay Cliburn
In-Reply-To: <1184888714454-git-send-email-jacliburn@bellsouth.net>
Change tpd_avail() to atl1_tpd_avail().
Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
drivers/net/atl1/atl1_main.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index fd1e156..79d60e1 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1422,7 +1422,7 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
netif_wake_queue(adapter->netdev);
}
-static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring)
+static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring)
{
u16 next_to_clean = atomic_read(&tpd_ring->next_to_clean);
u16 next_to_use = atomic_read(&tpd_ring->next_to_use);
@@ -1708,7 +1708,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_LOCKED;
}
- if (tpd_avail(&adapter->tpd_ring) < count) {
+ if (atl1_tpd_avail(&adapter->tpd_ring) < count) {
/* not enough descriptors */
netif_stop_queue(netdev);
spin_unlock_irqrestore(&adapter->lock, flags);
--
1.5.2.2
^ permalink raw reply related
* [PATCH 2/5] atl1: fix typo in DMA engine setup
From: Jay Cliburn @ 2007-07-19 23:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, atl1-devel, csnook, Jay Cliburn
In-Reply-To: <1184888714454-git-send-email-jacliburn@bellsouth.net>
The DMA engine setup contains a typo that can result in an incorrect
dmaw_block setting.
Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
drivers/net/atl1/atl1_main.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 79d60e1..3b8f633 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -908,8 +908,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
/* config DMA Engine */
value = ((((u32) hw->dmar_block) & DMA_CTRL_DMAR_BURST_LEN_MASK)
<< DMA_CTRL_DMAR_BURST_LEN_SHIFT) |
- ((((u32) hw->dmaw_block) & DMA_CTRL_DMAR_BURST_LEN_MASK)
- << DMA_CTRL_DMAR_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN |
+ ((((u32) hw->dmaw_block) & DMA_CTRL_DMAW_BURST_LEN_MASK)
+ << DMA_CTRL_DMAW_BURST_LEN_SHIFT) | DMA_CTRL_DMAR_EN |
DMA_CTRL_DMAW_EN;
value |= (u32) hw->dma_ord;
if (atl1_rcb_128 == hw->rcb_value)
--
1.5.2.2
^ permalink raw reply related
* [PATCH 3/5] atl1: change cmb write threshold
From: Jay Cliburn @ 2007-07-19 23:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, atl1-devel, csnook, Jay Cliburn
In-Reply-To: <1184888714454-git-send-email-jacliburn@bellsouth.net>
Change the threshold number of descriptors used to trigger CMB writes.
The vendor reports that under certain conditions this will reduce the
number of unnecessary tx interrupts and improve rx performance.
This change is lifted directly from vendor version 1.2.40.2 of the L1
driver.
Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
drivers/net/atl1/atl1_main.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 3b8f633..6aa2dc3 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -917,7 +917,10 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
iowrite32(value, hw->hw_addr + REG_DMA_CTRL);
/* config CMB / SMB */
- value = hw->cmb_rrd | ((u32) hw->cmb_tpd << 16);
+ value = (hw->cmb_tpd > adapter->tpd_ring.count) ?
+ hw->cmb_tpd : adapter->tpd_ring.count;
+ value <<= 16;
+ value |= hw->cmb_rrd;
iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TH);
value = hw->cmb_rx_timer | ((u32) hw->cmb_tx_timer << 16);
iowrite32(value, hw->hw_addr + REG_CMB_WRITE_TIMER);
--
1.5.2.2
^ permalink raw reply related
* [PATCH 4/5] atl1: fix typo in dma_req_block
From: Jay Cliburn @ 2007-07-19 23:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, atl1-devel, csnook, Jay Cliburn
In-Reply-To: <1184888714454-git-send-email-jacliburn@bellsouth.net>
s/dam/dma
Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
drivers/net/atl1/atl1_hw.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index 100c09c..f0d7e82 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -929,8 +929,8 @@ enum atl1_dma_req_block {
atl1_dma_req_128 = 0,
atl1_dma_req_256 = 1,
atl1_dma_req_512 = 2,
- atl1_dam_req_1024 = 3,
- atl1_dam_req_2048 = 4,
+ atl1_dma_req_1024 = 3,
+ atl1_dma_req_2048 = 4,
atl1_dma_req_4096 = 5
};
--
1.5.2.2
^ permalink raw reply related
* [PATCH 5/5] atl1: use kernel provided ethernet length constants
From: Jay Cliburn @ 2007-07-19 23:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, atl1-devel, csnook, Jay Cliburn
In-Reply-To: <1184888714454-git-send-email-jacliburn@bellsouth.net>
Use constants already provided by the kernel for ethernet related lengths.
Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
drivers/net/atl1/atl1_hw.h | 5 -----
drivers/net/atl1/atl1_main.c | 13 +++++++------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/net/atl1/atl1_hw.h b/drivers/net/atl1/atl1_hw.h
index f0d7e82..939aa0f 100644
--- a/drivers/net/atl1/atl1_hw.h
+++ b/drivers/net/atl1/atl1_hw.h
@@ -680,11 +680,6 @@ void atl1_check_options(struct atl1_adapter *adapter);
#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */
#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */
-/* The size (in bytes) of a ethernet packet */
-#define ENET_HEADER_SIZE 14
-#define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* with FCS */
-#define MINIMUM_ETHERNET_FRAME_SIZE 64 /* with FCS */
-#define ETHERNET_FCS_SIZE 4
#define MAX_JUMBO_FRAME_SIZE 0x2800
#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 6aa2dc3..993ed2a 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -59,6 +59,7 @@
#include <linux/skbuff.h>
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
+#include <linux/if_ether.h>
#include <linux/irqreturn.h>
#include <linux/workqueue.h>
#include <linux/timer.h>
@@ -120,8 +121,8 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter)
struct atl1_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev;
- hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
- hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
+ hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
+ hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
adapter->wol = 0;
adapter->rx_buffer_len = (hw->max_frame_size + 7) & ~7;
@@ -688,9 +689,9 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
{
struct atl1_adapter *adapter = netdev_priv(netdev);
int old_mtu = netdev->mtu;
- int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
+ int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
- if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
+ if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
return -EINVAL;
@@ -1337,7 +1338,7 @@ rrd_ok:
skb = buffer_info->skb;
length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size);
- skb_put(skb, length - ETHERNET_FCS_SIZE);
+ skb_put(skb, length - ETH_FCS_LEN);
/* Receive Checksum Offload */
atl1_rx_checksum(adapter, rrd, skb);
@@ -1456,7 +1457,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
iph->daddr, 0, IPPROTO_TCP, 0);
ipofst = skb_network_offset(skb);
- if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */
+ if (ipofst != ETH_HLEN) /* 802.3 frame */
tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
tso->tsopl |= (iph->ihl &
--
1.5.2.2
^ permalink raw reply related
* Re: ANNOUNCE: igb: Intel 82575 Gigabit Ethernet driver (PCI-Express)
From: Kok, Auke @ 2007-07-19 23:52 UTC (permalink / raw)
To: Jeff Garzik; +Cc: NetDev, Arjan van de Ven, Ronciak, John, Mitch Williams
In-Reply-To: <469ED3D7.6040905@garzik.org>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> http://foo-projects.org/~sofar/igb.patch [558K]
>> http://foo-projects.org/~sofar/igb.patch.bz2 [98K]
>
> Just took a look at this.
>
> This has the same problem as in the other thread -- huge internal API --
> except this time, the problem is emphasized by the fact that the
> majority of the API hooks only have a single user, making each hook and
> API entry point demonstrably useless overhead.
>
> Please remove the useless internal API and resubmit.
Why don't you accept it now and allow us the time to work on this in the coming
period? The driver works, performs better than all 8257x hardware and uses less
CPU utilization. That must be good for everyone. Keeping it outside of the linux
tree is just going to postpone testing the non-internal API parts.
> PLEASE take a look at how bnx2 and tg3 are structured.
They don't use PHYlib. Nobody is perfect...
We can and we should be able to _not_ agree on certain things and live together
just fine. While I agree that some designs are better, the current internal API
design has worked really good for us and allowed us to develop this driver and
ixgbe in much faster rate than ever before. It was most useful in silicon
validation and extremely flexible for us. At one point, the 82575 silicon was
even supporter by the e1000 driver, because this internal API made it so easy to
add new hardware support. For obvious reasons (differences in hw) we decided to
split this driver off.
It served a good purpose. We can improve it, and I sure want to do that, but I
think it's better to improve something *upstream*, then going back working at
things offline without having any certainty that you will accept it after I get
back, since you might just reject it on another argument, etc. It will take
quite some effort and convincing to make this happen, and it would help a lot if
we can work with/in the community on that, instead of off-line.
That will also give the non-internal API parts the better testing.
Auke
^ permalink raw reply
* Re: [PATCH] make xfrm_audit_log more generic
From: James Morris @ 2007-07-20 1:45 UTC (permalink / raw)
To: Joy Latten; +Cc: netdev, davem, linux-audit, sgrubb
In-Reply-To: <200707192242.l6JMglVk029578@faith.austin.ibm.com>
On Thu, 19 Jul 2007, Joy Latten wrote:
> --- linux-2.6.22/include/linux/audit.h 2007-07-19 13:17:22.000000000 -0500
> +++ linux-2.6.22.patch/include/linux/audit.h 2007-07-19 13:21:29.000000000 -0500
> @@ -108,10 +108,7 @@
> #define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
> #define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
> #define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
> -#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */
> -#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */
> -#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */
> -#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */
> +#define AUDIT_MAC_IPSEC_EVENT 1411 /* Audit IPSec events */
Will this cause existing applications to break?
- James
--
James Morris
<jmorris@namei.org>
^ permalink raw reply
* Re: [PATCH 2/2] nbd: change a parameter's type to remove a memcpy call
From: rae l @ 2007-07-20 1:46 UTC (permalink / raw)
To: Paul Clements
Cc: netdev, linux-kernel, Pavel Machek, Steven Whitehouse,
Andrew Morton, debra
In-Reply-To: <469FA0F9.9090001@steeleye.com>
On 7/20/07, Paul Clements <paul.clements@steeleye.com> wrote:
> Denis Cheng wrote:
> > this memcpy looks so strange, in fact it's merely a pointer dereference,
> > so I change the parameter's type to refer it more directly,
> > this could make the memcpy not needed anymore.
> >
> > in the function nbd_read_stat where nbd_find_request is only once called,
> > the parameter served should be transformed accordingly.
>
> This is really a matter of preference. The generated code ends up being
> about the same, I think, while your patch makes the call to
> nbd_find_request kind of obtuse. Also, the memcpy's are balanced between
> send_req and find_request, so you can quickly see how the data is being
> transferred (from req into handle, and then back again). Your patch
> makes this less clear, at least to me.
With one explicit memcpy stripped out, I think it's more clear to
nbd_find_request.
In nbd_read_stat, the cast to (struct request **) is not apparent, I
must admit; but I think the best solution is declaring other few
structs to make it clear, it's due to the lack of description of nbd
client and server communication protocol.
BTW, I think the nbd driver needs a clear documentation (its main site
http://nbd.sourceforge.net/ does not give it):
1. When nbd_find_request is needed to call, the 8 byte memory of char
handle[8] field in struct nbd_reply actually stores a pointer (struct
request *), that pointer is received from the network. Since a pointer
is only meaningful to the host, transfering it over the network will
be unreliable, I don't think it's a good design,
--
Denis Cheng
Linux Application Developer
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
^ permalink raw reply
* Re: [PATCH 1/2] net/core: merge the content of dev_mcast.c into dev.c
From: rae l @ 2007-07-20 1:51 UTC (permalink / raw)
To: David Miller
Cc: netdev, kuznet, Patrick McHardy, pekkas, jmorris, linux-kernel,
Denis Cheng
In-Reply-To: <1184758229305-git-send-email-crquan@gmail.com>
On 7/18/07, Denis Cheng <crquan@gmail.com> wrote:
> - removed three function declarations from header file to mark them static,
> - reduced one file
>
> Signed-off-by: Denis Cheng <crquan@gmail.com>
> ---
>
> this one is just merging by concatenating, and I'll try to adjust some
> function definitions' order to make it more readable.
>
> include/linux/netdevice.h | 3 -
> net/core/Makefile | 2 +-
> net/core/dev.c | 239 +++++++++++++++++++++++++++++++++++++++++-
> net/core/dev_mcast.c | 255 ---------------------------------------------
> 4 files changed, 237 insertions(+), 262 deletions(-)
> delete mode 100644 net/core/dev_mcast.c
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 9820ca1..ca68c58 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1091,15 +1091,12 @@ extern int register_netdev(struct net_device *dev);
> extern void unregister_netdev(struct net_device *dev);
> /* Functions used for secondary unicast and multicast support */
> extern void dev_set_rx_mode(struct net_device *dev);
> -extern void __dev_set_rx_mode(struct net_device *dev);
> extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen);
> extern int dev_unicast_add(struct net_device *dev, void *addr, int alen);
> extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
> extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
> extern int dev_mc_sync(struct net_device *to, struct net_device *from);
> extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
> -extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
> -extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
> extern void dev_set_promiscuity(struct net_device *dev, int inc);
> extern void dev_set_allmulti(struct net_device *dev, int inc);
> extern void netdev_state_change(struct net_device *dev);
> diff --git a/net/core/Makefile b/net/core/Makefile
> index 4751613..54d28dd 100644
> --- a/net/core/Makefile
> +++ b/net/core/Makefile
> @@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
>
> obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
>
> -obj-y += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
> +obj-y += dev.o ethtool.o dst.o netevent.o \
> neighbour.o rtnetlink.o utils.o link_watch.o filter.o
>
> obj-$(CONFIG_XFRM) += flow.o
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 6357f54..16842af 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -18,6 +18,7 @@
> * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> * Adam Sulmicki <adam@cfar.umd.edu>
> * Pekka Riikonen <priikone@poesidon.pspt.fi>
> + * Denis Cheng <crquan@gmail.com>
> *
> * Changes:
> * D.J. Barrow : Fixed bug where dev->refcnt gets set
> @@ -70,6 +71,32 @@
> * indefinitely on dev->refcnt
> * J Hadi Salim : - Backlog queue sampling
> * - netif_rx() feedback
> + * Denis Cheng : Merge dev_mcast.c into it
> + */
> +
> +/*
> + * The original information in dev_mcast.c:
> + *
> + * Linux NET3: Multicast List maintenance.
> + *
> + * Authors:
> + * Tim Kordas <tjk@nostromo.eeap.cwru.edu>
> + * Richard Underwood <richard@wuzz.demon.co.uk>
> + *
> + * Stir fried together from the IP multicast and CAP patches above
> + * Alan Cox <Alan.Cox@linux.org>
> + *
> + * Fixes:
> + * Alan Cox : Update the device on a real delete
> + * rather than any time but...
> + * Alan Cox : IFF_ALLMULTI support.
> + * Alan Cox : New format set_multicast_list() calls.
> + * Gleb Natapov : Remove dev_mc_lock.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> */
>
> #include <asm/uaccess.h>
> @@ -2622,7 +2649,7 @@ void dev_set_allmulti(struct net_device *dev, int inc)
> * filtering it is put in promiscous mode while unicast addresses
> * are present.
> */
> -void __dev_set_rx_mode(struct net_device *dev)
> +static void __dev_set_rx_mode(struct net_device *dev)
> {
> /* dev_open will call this function so the list will stay sane. */
> if (!(dev->flags&IFF_UP))
> @@ -2657,7 +2684,7 @@ void dev_set_rx_mode(struct net_device *dev)
> netif_tx_unlock_bh(dev);
> }
>
> -int __dev_addr_delete(struct dev_addr_list **list, int *count,
> +static int __dev_addr_delete(struct dev_addr_list **list, int *count,
> void *addr, int alen, int glbl)
> {
> struct dev_addr_list *da;
> @@ -2683,7 +2710,7 @@ int __dev_addr_delete(struct dev_addr_list **list, int *count,
> return -ENOENT;
> }
>
> -int __dev_addr_add(struct dev_addr_list **list, int *count,
> +static int __dev_addr_add(struct dev_addr_list **list, int *count,
> void *addr, int alen, int glbl)
> {
> struct dev_addr_list *da;
> @@ -4049,3 +4076,209 @@ EXPORT_SYMBOL(dev_load);
> #endif
>
> EXPORT_PER_CPU_SYMBOL(softnet_data);
> +
> +/*
> + * Device multicast list maintenance.
> + *
> + * This is used both by IP and by the user level maintenance functions.
> + * Unlike BSD we maintain a usage count on a given multicast address so
> + * that a casual user application can add/delete multicasts used by
> + * protocols without doing damage to the protocols when it deletes the
> + * entries. It also helps IP as it tracks overlapping maps.
> + *
> + * Device mc lists are changed by bh at least if IPv6 is enabled,
> + * so that it must be bh protected.
> + *
> + * We block accesses to device mc filters with netif_tx_lock.
> + */
> +
> +/*
> + * Delete a device level multicast
> + */
> +
> +int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
> +{
> + int err;
> +
> + netif_tx_lock_bh(dev);
> + err = __dev_addr_delete(&dev->mc_list, &dev->mc_count,
> + addr, alen, glbl);
> + if (!err) {
> + /*
> + * We have altered the list, so the card
> + * loaded filter is now wrong. Fix it
> + */
> +
> + __dev_set_rx_mode(dev);
> + }
> + netif_tx_unlock_bh(dev);
> + return err;
> +}
> +
> +/*
> + * Add a device level multicast
> + */
> +
> +int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
> +{
> + int err;
> +
> + netif_tx_lock_bh(dev);
> + err = __dev_addr_add(&dev->mc_list, &dev->mc_count, addr, alen, glbl);
> + if (!err)
> + __dev_set_rx_mode(dev);
> + netif_tx_unlock_bh(dev);
> + return err;
> +}
> +
> +/**
> + * dev_mc_sync - Synchronize device's multicast list to another device
> + * @to: destination device
> + * @from: source device
> + *
> + * Add newly added addresses to the destination device and release
> + * addresses that have no users left. The source device must be
> + * locked by netif_tx_lock_bh.
> + *
> + * This function is intended to be called from the dev->set_multicast_list
> + * function of layered software devices.
> + */
> +int dev_mc_sync(struct net_device *to, struct net_device *from)
> +{
> + struct dev_addr_list *da;
> + int err = 0;
> +
> + netif_tx_lock_bh(to);
> + for (da = from->mc_list; da != NULL; da = da->next) {
> + if (!da->da_synced) {
> + err = __dev_addr_add(&to->mc_list, &to->mc_count,
> + da->da_addr, da->da_addrlen, 0);
> + if (err < 0)
> + break;
> + da->da_synced = 1;
> + da->da_users++;
> + } else if (da->da_users == 1) {
> + __dev_addr_delete(&to->mc_list, &to->mc_count,
> + da->da_addr, da->da_addrlen, 0);
> + __dev_addr_delete(&from->mc_list, &from->mc_count,
> + da->da_addr, da->da_addrlen, 0);
> + }
> + }
> + if (!err)
> + __dev_set_rx_mode(to);
> + netif_tx_unlock_bh(to);
> +
> + return err;
> +}
> +EXPORT_SYMBOL(dev_mc_sync);
> +
> +
> +/**
> + * dev_mc_unsync - Remove synchronized addresses from the destination
> + * device
> + * @to: destination device
> + * @from: source device
> + *
> + * Remove all addresses that were added to the destination device by
> + * dev_mc_sync(). This function is intended to be called from the
> + * dev->stop function of layered software devices.
> + */
> +void dev_mc_unsync(struct net_device *to, struct net_device *from)
> +{
> + struct dev_addr_list *da;
> +
> + netif_tx_lock_bh(from);
> + netif_tx_lock_bh(to);
> +
> + for (da = from->mc_list; da != NULL; da = da->next) {
> + if (!da->da_synced)
> + continue;
> + __dev_addr_delete(&to->mc_list, &to->mc_count,
> + da->da_addr, da->da_addrlen, 0);
> + da->da_synced = 0;
> + __dev_addr_delete(&from->mc_list, &from->mc_count,
> + da->da_addr, da->da_addrlen, 0);
> + }
> + __dev_set_rx_mode(to);
> +
> + netif_tx_unlock_bh(to);
> + netif_tx_unlock_bh(from);
> +}
> +EXPORT_SYMBOL(dev_mc_unsync);
> +
> +#ifdef CONFIG_PROC_FS
> +static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
> +{
> + struct net_device *dev;
> + loff_t off = 0;
> +
> + read_lock(&dev_base_lock);
> + for_each_netdev(dev) {
> + if (off++ == *pos)
> + return dev;
> + }
> + return NULL;
> +}
> +
> +static void *dev_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> +{
> + ++*pos;
> + return next_net_device((struct net_device *)v);
> +}
> +
> +static void dev_mc_seq_stop(struct seq_file *seq, void *v)
> +{
> + read_unlock(&dev_base_lock);
> +}
> +
> +
> +static int dev_mc_seq_show(struct seq_file *seq, void *v)
> +{
> + struct dev_addr_list *m;
> + struct net_device *dev = v;
> +
> + netif_tx_lock_bh(dev);
> + for (m = dev->mc_list; m; m = m->next) {
> + int i;
> +
> + seq_printf(seq, "%-4d %-15s %-5d %-5d ", dev->ifindex,
> + dev->name, m->dmi_users, m->dmi_gusers);
> +
> + for (i = 0; i < m->dmi_addrlen; i++)
> + seq_printf(seq, "%02x", m->dmi_addr[i]);
> +
> + seq_putc(seq, '\n');
> + }
> + netif_tx_unlock_bh(dev);
> + return 0;
> +}
> +
> +static const struct seq_operations dev_mc_seq_ops = {
> + .start = dev_mc_seq_start,
> + .next = dev_mc_seq_next,
> + .stop = dev_mc_seq_stop,
> + .show = dev_mc_seq_show,
> +};
> +
> +static int dev_mc_seq_open(struct inode *inode, struct file *file)
> +{
> + return seq_open(file, &dev_mc_seq_ops);
> +}
> +
> +static const struct file_operations dev_mc_seq_fops = {
> + .owner = THIS_MODULE,
> + .open = dev_mc_seq_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = seq_release,
> +};
> +
> +#endif
> +
> +void __init dev_mcast_init(void)
> +{
> + proc_net_fops_create("dev_mcast", 0, &dev_mc_seq_fops);
> +}
> +
> +EXPORT_SYMBOL(dev_mc_add);
> +EXPORT_SYMBOL(dev_mc_delete);
> diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
> deleted file mode 100644
> index 99aece1..0000000
> --- a/net/core/dev_mcast.c
> +++ /dev/null
> @@ -1,255 +0,0 @@
> -/*
> - * Linux NET3: Multicast List maintenance.
> - *
> - * Authors:
> - * Tim Kordas <tjk@nostromo.eeap.cwru.edu>
> - * Richard Underwood <richard@wuzz.demon.co.uk>
> - *
> - * Stir fried together from the IP multicast and CAP patches above
> - * Alan Cox <Alan.Cox@linux.org>
> - *
> - * Fixes:
> - * Alan Cox : Update the device on a real delete
> - * rather than any time but...
> - * Alan Cox : IFF_ALLMULTI support.
> - * Alan Cox : New format set_multicast_list() calls.
> - * Gleb Natapov : Remove dev_mc_lock.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version
> - * 2 of the License, or (at your option) any later version.
> - */
> -
> -#include <linux/module.h>
> -#include <asm/uaccess.h>
> -#include <asm/system.h>
> -#include <linux/bitops.h>
> -#include <linux/types.h>
> -#include <linux/kernel.h>
> -#include <linux/string.h>
> -#include <linux/mm.h>
> -#include <linux/socket.h>
> -#include <linux/sockios.h>
> -#include <linux/in.h>
> -#include <linux/errno.h>
> -#include <linux/interrupt.h>
> -#include <linux/if_ether.h>
> -#include <linux/inet.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/proc_fs.h>
> -#include <linux/seq_file.h>
> -#include <linux/init.h>
> -#include <net/ip.h>
> -#include <net/route.h>
> -#include <linux/skbuff.h>
> -#include <net/sock.h>
> -#include <net/arp.h>
> -
> -
> -/*
> - * Device multicast list maintenance.
> - *
> - * This is used both by IP and by the user level maintenance functions.
> - * Unlike BSD we maintain a usage count on a given multicast address so
> - * that a casual user application can add/delete multicasts used by
> - * protocols without doing damage to the protocols when it deletes the
> - * entries. It also helps IP as it tracks overlapping maps.
> - *
> - * Device mc lists are changed by bh at least if IPv6 is enabled,
> - * so that it must be bh protected.
> - *
> - * We block accesses to device mc filters with netif_tx_lock.
> - */
> -
> -/*
> - * Delete a device level multicast
> - */
> -
> -int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
> -{
> - int err;
> -
> - netif_tx_lock_bh(dev);
> - err = __dev_addr_delete(&dev->mc_list, &dev->mc_count,
> - addr, alen, glbl);
> - if (!err) {
> - /*
> - * We have altered the list, so the card
> - * loaded filter is now wrong. Fix it
> - */
> -
> - __dev_set_rx_mode(dev);
> - }
> - netif_tx_unlock_bh(dev);
> - return err;
> -}
> -
> -/*
> - * Add a device level multicast
> - */
> -
> -int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
> -{
> - int err;
> -
> - netif_tx_lock_bh(dev);
> - err = __dev_addr_add(&dev->mc_list, &dev->mc_count, addr, alen, glbl);
> - if (!err)
> - __dev_set_rx_mode(dev);
> - netif_tx_unlock_bh(dev);
> - return err;
> -}
> -
> -/**
> - * dev_mc_sync - Synchronize device's multicast list to another device
> - * @to: destination device
> - * @from: source device
> - *
> - * Add newly added addresses to the destination device and release
> - * addresses that have no users left. The source device must be
> - * locked by netif_tx_lock_bh.
> - *
> - * This function is intended to be called from the dev->set_multicast_list
> - * function of layered software devices.
> - */
> -int dev_mc_sync(struct net_device *to, struct net_device *from)
> -{
> - struct dev_addr_list *da;
> - int err = 0;
> -
> - netif_tx_lock_bh(to);
> - for (da = from->mc_list; da != NULL; da = da->next) {
> - if (!da->da_synced) {
> - err = __dev_addr_add(&to->mc_list, &to->mc_count,
> - da->da_addr, da->da_addrlen, 0);
> - if (err < 0)
> - break;
> - da->da_synced = 1;
> - da->da_users++;
> - } else if (da->da_users == 1) {
> - __dev_addr_delete(&to->mc_list, &to->mc_count,
> - da->da_addr, da->da_addrlen, 0);
> - __dev_addr_delete(&from->mc_list, &from->mc_count,
> - da->da_addr, da->da_addrlen, 0);
> - }
> - }
> - if (!err)
> - __dev_set_rx_mode(to);
> - netif_tx_unlock_bh(to);
> -
> - return err;
> -}
> -EXPORT_SYMBOL(dev_mc_sync);
> -
> -
> -/**
> - * dev_mc_unsync - Remove synchronized addresses from the destination
> - * device
> - * @to: destination device
> - * @from: source device
> - *
> - * Remove all addresses that were added to the destination device by
> - * dev_mc_sync(). This function is intended to be called from the
> - * dev->stop function of layered software devices.
> - */
> -void dev_mc_unsync(struct net_device *to, struct net_device *from)
> -{
> - struct dev_addr_list *da;
> -
> - netif_tx_lock_bh(from);
> - netif_tx_lock_bh(to);
> -
> - for (da = from->mc_list; da != NULL; da = da->next) {
> - if (!da->da_synced)
> - continue;
> - __dev_addr_delete(&to->mc_list, &to->mc_count,
> - da->da_addr, da->da_addrlen, 0);
> - da->da_synced = 0;
> - __dev_addr_delete(&from->mc_list, &from->mc_count,
> - da->da_addr, da->da_addrlen, 0);
> - }
> - __dev_set_rx_mode(to);
> -
> - netif_tx_unlock_bh(to);
> - netif_tx_unlock_bh(from);
> -}
> -EXPORT_SYMBOL(dev_mc_unsync);
> -
> -#ifdef CONFIG_PROC_FS
> -static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
> -{
> - struct net_device *dev;
> - loff_t off = 0;
> -
> - read_lock(&dev_base_lock);
> - for_each_netdev(dev) {
> - if (off++ == *pos)
> - return dev;
> - }
> - return NULL;
> -}
> -
> -static void *dev_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> -{
> - ++*pos;
> - return next_net_device((struct net_device *)v);
> -}
> -
> -static void dev_mc_seq_stop(struct seq_file *seq, void *v)
> -{
> - read_unlock(&dev_base_lock);
> -}
> -
> -
> -static int dev_mc_seq_show(struct seq_file *seq, void *v)
> -{
> - struct dev_addr_list *m;
> - struct net_device *dev = v;
> -
> - netif_tx_lock_bh(dev);
> - for (m = dev->mc_list; m; m = m->next) {
> - int i;
> -
> - seq_printf(seq, "%-4d %-15s %-5d %-5d ", dev->ifindex,
> - dev->name, m->dmi_users, m->dmi_gusers);
> -
> - for (i = 0; i < m->dmi_addrlen; i++)
> - seq_printf(seq, "%02x", m->dmi_addr[i]);
> -
> - seq_putc(seq, '\n');
> - }
> - netif_tx_unlock_bh(dev);
> - return 0;
> -}
> -
> -static const struct seq_operations dev_mc_seq_ops = {
> - .start = dev_mc_seq_start,
> - .next = dev_mc_seq_next,
> - .stop = dev_mc_seq_stop,
> - .show = dev_mc_seq_show,
> -};
> -
> -static int dev_mc_seq_open(struct inode *inode, struct file *file)
> -{
> - return seq_open(file, &dev_mc_seq_ops);
> -}
> -
> -static const struct file_operations dev_mc_seq_fops = {
> - .owner = THIS_MODULE,
> - .open = dev_mc_seq_open,
> - .read = seq_read,
> - .llseek = seq_lseek,
> - .release = seq_release,
> -};
> -
> -#endif
> -
> -void __init dev_mcast_init(void)
> -{
> - proc_net_fops_create("dev_mcast", 0, &dev_mc_seq_fops);
> -}
> -
> -EXPORT_SYMBOL(dev_mc_add);
> -EXPORT_SYMBOL(dev_mc_delete);
> --
> 1.5.2.2
Is there any more comments on this?
>
>
--
Denis Cheng
Linux Application Developer
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
^ permalink raw reply
* Re: [PATCH] Merge GT/MV642xx Support into MV643xx Driver [7/8]
From: Steven J. Hill @ 2007-07-20 2:10 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: netdev
In-Reply-To: <20070719142159.GF12892@xyzzy.farnsworth.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dale Farnsworth wrote:
>
> You have replaced the use of the global PHY spinlock with a per-port spinlock.
> However, the SMI register is shared by all ports. The global lock is
> needed to prevent simultaneous updates of the register by drivers for
> multiple ports.
>
> NAK
>
Are you sure? Notice that a majority of the spinlocks were changed to disable
IRQs. Secondly, the lowest level mv_read/mv_write functions have to acquire
the big mv64x60_lock before they can read or write registers. I see the PHY
spinlock as being an additional and unnecessary lock to contend with. Am I
make an improper assumption?
- -Steve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGoBmSgyK5H2Ic36cRAj8JAKCfmg/T2FgOdYZ5YfnXJsiyn3RkaQCfadSk
GS8ICyW0+qNRHr5QqnY0PUQ=
=nvSB
-----END PGP SIGNATURE-----
^ 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