From: jamal <hadi@cyberus.ca>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
netdev@oss.sgi.com, "David S. Miller" <davem@davemloft.net>
Subject: Re: patch2: del/get byid
Date: Thu, 28 Apr 2005 10:20:33 -0400 [thread overview]
Message-ID: <1114698033.7663.197.camel@localhost.localdomain> (raw)
In-Reply-To: <1114658657.7663.110.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
On Wed, 2005-27-04 at 23:24 -0400, jamal wrote:
> On Thu, 2005-28-04 at 13:03 +1000, Herbert Xu wrote:
>
> > Or we can simply put it in a field called dir and start using it
> > instead of passing it around :)
> >
>
> that would be the best option.
Well, heres some minimalist patch i havent tested. i.e doesnt change any
of the functions; but at least it doesnt break the timers.
This includes both patches i posted earlier and introduces dir in
xfrm_policy.
cheers,
jamal
[-- Attachment #2: polid_p4 --]
[-- Type: text/plain, Size: 2027 bytes --]
--- a/include/net/xfrm.h 2005/04/28 14:05:00 1.1
+++ b/include/net/xfrm.h 2005/04/28 14:05:48
@@ -302,6 +302,7 @@
struct dst_entry *bundles;
__u16 family;
__u8 action;
+ __u8 dir;
__u8 flags;
__u8 dead;
__u8 xfrm_nr;
--- a/net/xfrm/xfrm_user.c 2005/04/28 13:59:27 1.1
+++ b/net/xfrm/xfrm_user.c 2005/04/28 14:01:58
@@ -653,6 +653,7 @@
memcpy(&xp->selector, &p->sel, sizeof(xp->selector));
memcpy(&xp->lft, &p->lft, sizeof(xp->lft));
xp->action = p->action;
+ xp->dir = p->dir;
xp->flags = p->flags;
xp->family = p->sel.family;
/* XXX xp->share = p->share; */
--- a/net/xfrm/xfrm_policy.c 2005/04/27 11:32:13 1.1
+++ b/net/xfrm/xfrm_policy.c 2005/04/28 14:02:18
@@ -163,7 +163,7 @@
if (xp->dead)
goto out;
- dir = xp->index & 7;
+ dir = xp->dir;
if (xp->lft.hard_add_expires_seconds) {
long tmo = xp->lft.hard_add_expires_seconds +
@@ -345,7 +345,10 @@
write_lock_bh(&xfrm_policy_lock);
for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL;) {
- if (!delpol && memcmp(&policy->selector, &pol->selector, sizeof(pol->selector)) == 0) {
+ if (!delpol &&
+ ((!excl && policy->index &&
+ (policy->index == pol->index)) ||
+ (memcmp(&policy->selector, &pol->selector, sizeof(pol->selector)) == 0))) {
if (excl) {
write_unlock_bh(&xfrm_policy_lock);
return -EEXIST;
@@ -370,7 +373,9 @@
policy->next = *p;
*p = policy;
atomic_inc(&flow_cache_genid);
- policy->index = delpol ? delpol->index : xfrm_gen_index(dir);
+ if (!policy->index)
+ policy->index = delpol ? delpol->index : xfrm_gen_index(dir);
+
policy->curlft.add_time = (unsigned long)xtime.tv_sec;
policy->curlft.use_time = 0;
if (!mod_timer(&policy->timer, jiffies + HZ))
@@ -413,7 +418,7 @@
struct xfrm_policy *pol, **p;
write_lock_bh(&xfrm_policy_lock);
- for (p = &xfrm_policy_list[id & 7]; (pol=*p)!=NULL; p = &pol->next) {
+ for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL; p = &pol->next) {
if (pol->index == id) {
xfrm_pol_hold(pol);
if (delete)
next prev parent reply other threads:[~2005-04-28 14:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-28 2:11 patch2: del/get byid jamal
2005-04-28 2:14 ` Herbert Xu
2005-04-28 2:23 ` jamal
2005-04-28 2:25 ` Herbert Xu
2005-04-28 2:39 ` jamal
2005-04-28 2:42 ` Herbert Xu
2005-04-28 2:55 ` jamal
2005-04-28 3:03 ` Herbert Xu
2005-04-28 3:24 ` jamal
2005-04-28 14:20 ` jamal [this message]
2005-04-28 23:11 ` Herbert Xu
2005-04-29 12:51 ` jamal
2005-04-29 23:20 ` jamal
2005-04-29 23:49 ` Herbert Xu
2005-04-30 0:01 ` jamal
2005-04-30 0:12 ` Herbert Xu
2005-04-30 0:35 ` jamal
2005-04-30 0:47 ` Herbert Xu
2005-04-30 1:08 ` jamal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1114698033.7663.197.camel@localhost.localdomain \
--to=hadi@cyberus.ca \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.