* [PATCH 1/4] mcast: net_device dev not used
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
ip6_mc_source(), ip6_mc_msfilter() as well as ip6_mc_msfget() declare
and assign dev but do not use the variable afterwards.
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/ipv6/mcast.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 7b27d08..f2c9b69 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -319,7 +319,6 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
{
struct in6_addr *source, *group;
struct ipv6_mc_socklist *pmc;
- struct net_device *dev;
struct inet6_dev *idev;
struct ipv6_pinfo *inet6 = inet6_sk(sk);
struct ip6_sf_socklist *psl;
@@ -341,7 +340,6 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
rcu_read_unlock();
return -ENODEV;
}
- dev = idev->dev;
err = -EADDRNOTAVAIL;
@@ -455,7 +453,6 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
{
struct in6_addr *group;
struct ipv6_mc_socklist *pmc;
- struct net_device *dev;
struct inet6_dev *idev;
struct ipv6_pinfo *inet6 = inet6_sk(sk);
struct ip6_sf_socklist *newpsl, *psl;
@@ -478,7 +475,6 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
rcu_read_unlock();
return -ENODEV;
}
- dev = idev->dev;
err = 0;
@@ -549,7 +545,6 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
struct in6_addr *group;
struct ipv6_mc_socklist *pmc;
struct inet6_dev *idev;
- struct net_device *dev;
struct ipv6_pinfo *inet6 = inet6_sk(sk);
struct ip6_sf_socklist *psl;
struct net *net = sock_net(sk);
@@ -566,7 +561,6 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
rcu_read_unlock();
return -ENODEV;
}
- dev = idev->dev;
err = -EADDRNOTAVAIL;
/*
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* [PATCH 2/4] af_packet: struct socket declared/assigned but unused
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
In-Reply-To: <1299275106-11513-1-git-send-email-hagen@jauu.net>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/packet/af_packet.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 5efef5b..b5362e9 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -966,7 +966,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
{
- struct socket *sock;
struct sk_buff *skb;
struct net_device *dev;
__be16 proto;
@@ -978,8 +977,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
int len_sum = 0;
int status = 0;
- sock = po->sk.sk_socket;
-
mutex_lock(&po->pg_vec_lock);
err = -EBUSY;
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* [PATCH 4/4] af_unix: remove unused struct sockaddr_un cruft
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
In-Reply-To: <1299275106-11513-1-git-send-email-hagen@jauu.net>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/unix/af_unix.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 217fb7f..df5997d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1567,7 +1567,6 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
struct sock *sk = sock->sk;
struct sock *other = NULL;
- struct sockaddr_un *sunaddr = msg->msg_name;
int err, size;
struct sk_buff *skb;
int sent = 0;
@@ -1590,7 +1589,6 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
goto out_err;
} else {
- sunaddr = NULL;
err = -ENOTCONN;
other = unix_peer(sk);
if (!other)
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* [PATCH 3/4] sctp: several declared/set but unused fixes
From: Hagen Paul Pfeifer @ 2011-03-04 21:45 UTC (permalink / raw)
To: netdev; +Cc: Hagen Paul Pfeifer
In-Reply-To: <1299275106-11513-1-git-send-email-hagen@jauu.net>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/sctp/associola.c | 2 --
net/sctp/input.c | 3 ---
net/sctp/outqueue.c | 2 --
net/sctp/sm_make_chunk.c | 3 ---
net/sctp/socket.c | 2 --
net/sctp/ulpqueue.c | 7 +------
6 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 5f1fb8b..6b04287 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1089,7 +1089,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
base.inqueue.immediate);
struct sctp_endpoint *ep;
struct sctp_chunk *chunk;
- struct sock *sk;
struct sctp_inq *inqueue;
int state;
sctp_subtype_t subtype;
@@ -1097,7 +1096,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
/* The association should be held so we should be safe. */
ep = asoc->ep;
- sk = asoc->base.sk;
inqueue = &asoc->base.inqueue;
sctp_association_hold(asoc);
diff --git a/net/sctp/input.c b/net/sctp/input.c
index ea21924..826661b 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -948,14 +948,11 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb,
union sctp_addr addr;
union sctp_addr *paddr = &addr;
struct sctphdr *sh = sctp_hdr(skb);
- sctp_chunkhdr_t *ch;
union sctp_params params;
sctp_init_chunk_t *init;
struct sctp_transport *transport;
struct sctp_af *af;
- ch = (sctp_chunkhdr_t *) skb->data;
-
/*
* This code will NOT touch anything inside the chunk--it is
* strictly READ-ONLY.
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 8c6d379..26dc005 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -545,13 +545,11 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
struct sctp_transport *transport = pkt->transport;
sctp_xmit_t status;
struct sctp_chunk *chunk, *chunk1;
- struct sctp_association *asoc;
int fast_rtx;
int error = 0;
int timer = 0;
int done = 0;
- asoc = q->asoc;
lqueue = &q->retransmit;
fast_rtx = q->fast_rtx;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index b23428f..de98665 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3375,7 +3375,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
struct sctp_fwdtsn_skip *skiplist)
{
struct sctp_chunk *retval = NULL;
- struct sctp_fwdtsn_chunk *ftsn_chunk;
struct sctp_fwdtsn_hdr ftsn_hdr;
struct sctp_fwdtsn_skip skip;
size_t hint;
@@ -3388,8 +3387,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
if (!retval)
return NULL;
- ftsn_chunk = (struct sctp_fwdtsn_chunk *)retval->subh.fwdtsn_hdr;
-
ftsn_hdr.new_cum_tsn = htonl(new_cum_tsn);
retval->subh.fwdtsn_hdr =
sctp_addto_chunk(retval, sizeof(ftsn_hdr), &ftsn_hdr);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b53b2eb..3951a10 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2928,7 +2928,6 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
unsigned int optlen)
{
struct sctp_sock *sp;
- struct sctp_endpoint *ep;
struct sctp_association *asoc = NULL;
struct sctp_setpeerprim prim;
struct sctp_chunk *chunk;
@@ -2936,7 +2935,6 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
int err;
sp = sctp_sk(sk);
- ep = sp->ep;
if (!sctp_addip_enable)
return -EPERM;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index c7f7e49..1767818 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -105,11 +105,8 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
gfp_t gfp)
{
struct sk_buff_head temp;
- sctp_data_chunk_t *hdr;
struct sctp_ulpevent *event;
- hdr = (sctp_data_chunk_t *) chunk->chunk_hdr;
-
/* Create an event from the incoming chunk. */
event = sctp_ulpevent_make_rcvmsg(chunk->asoc, chunk, gfp);
if (!event)
@@ -743,11 +740,9 @@ static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq,
struct sk_buff *pos, *tmp;
struct sctp_ulpevent *cevent;
struct sctp_stream *in;
- __u16 sid, csid;
- __u16 ssn, cssn;
+ __u16 sid, csid, cssn;
sid = event->stream;
- ssn = event->ssn;
in = &ulpq->asoc->ssnmap->in;
event_list = (struct sk_buff_head *) sctp_event2skb(event)->prev;
--
1.7.4.1.57.g0466.dirty
^ permalink raw reply related
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: Eric Dumazet @ 2011-03-04 22:13 UTC (permalink / raw)
To: David Miller; +Cc: xiaosuo, netdev
In-Reply-To: <20110304.124534.71142427.davem@davemloft.net>
Le vendredi 04 mars 2011 à 12:45 -0800, David Miller a écrit :
> From: David Miller <davem@davemloft.net>
> Date: Fri, 04 Mar 2011 11:17:05 -0800 (PST)
>
> > From: Eric Dumazet <eric.dumazet@gmail.com>
> > Date: Fri, 04 Mar 2011 16:09:08 +0100
> >
> >> Here is a patch to implement this idea.
> >
> > Applied, thanks Eric!
>
> Unfortunately, I have to revert, the lockdep annotations needs to
> be updated:
>
> net/ipv4/inetpeer.c: In function ‘peer_avl_rebalance’:
> net/ipv4/inetpeer.c:274:10: error: ‘seqlock_t’ has no member named ‘dep_map’
Oops thats right, here is an updated version.
Thanks
[PATCH net-next-2.6] inetpeer: seqlock optimization
David noticed :
------------------
Eric, I was profiling the non-routing-cache case and something that
stuck out is the case of calling inet_getpeer() with create==0.
If an entry is not found, we have to redo the lookup under a spinlock
to make certain that a concurrent writer rebalancing the tree does
not "hide" an existing entry from us.
This makes the case of a create==0 lookup for a not-present entry
really expensive. It is on the order of 600 cpu cycles on my
Niagara2.
I added a hack to not do the relookup under the lock when create==0
and it now costs less than 300 cycles.
This is now a pretty common operation with the way we handle COW'd
metrics, so I think it's definitely worth optimizing.
-----------------
One solution is to use a seqlock instead of a spinlock to protect struct
inet_peer_base.
After a failed avl tree lookup, we can easily detect if a writer did
some changes during our lookup. Taking the lock and redo the lookup is
only necessary in this case.
Note: Add one private rcu_deref_locked() macro to place in one spot the
access to spinlock included in seqlock.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
V2: updated lockdep annotations
net/ipv4/inetpeer.c | 75 +++++++++++++++++++-----------------------
1 files changed, 35 insertions(+), 40 deletions(-)
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 48f8d45..f604ffd 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -81,19 +81,19 @@ static const struct inet_peer peer_fake_node = {
struct inet_peer_base {
struct inet_peer __rcu *root;
- spinlock_t lock;
+ seqlock_t lock;
int total;
};
static struct inet_peer_base v4_peers = {
.root = peer_avl_empty_rcu,
- .lock = __SPIN_LOCK_UNLOCKED(v4_peers.lock),
+ .lock = __SEQLOCK_UNLOCKED(v4_peers.lock),
.total = 0,
};
static struct inet_peer_base v6_peers = {
.root = peer_avl_empty_rcu,
- .lock = __SPIN_LOCK_UNLOCKED(v6_peers.lock),
+ .lock = __SEQLOCK_UNLOCKED(v6_peers.lock),
.total = 0,
};
@@ -177,6 +177,9 @@ static int addr_compare(const struct inetpeer_addr *a,
return 0;
}
+#define rcu_deref_locked(X, BASE) \
+ rcu_dereference_protected(X, lockdep_is_held(&(BASE)->lock.lock))
+
/*
* Called with local BH disabled and the pool lock held.
*/
@@ -187,8 +190,7 @@ static int addr_compare(const struct inetpeer_addr *a,
\
stackptr = _stack; \
*stackptr++ = &_base->root; \
- for (u = rcu_dereference_protected(_base->root, \
- lockdep_is_held(&_base->lock)); \
+ for (u = rcu_deref_locked(_base->root, _base); \
u != peer_avl_empty; ) { \
int cmp = addr_compare(_daddr, &u->daddr); \
if (cmp == 0) \
@@ -198,8 +200,7 @@ static int addr_compare(const struct inetpeer_addr *a,
else \
v = &u->avl_right; \
*stackptr++ = v; \
- u = rcu_dereference_protected(*v, \
- lockdep_is_held(&_base->lock)); \
+ u = rcu_deref_locked(*v, _base); \
} \
u; \
})
@@ -246,13 +247,11 @@ static struct inet_peer *lookup_rcu_bh(const struct inetpeer_addr *daddr,
struct inet_peer __rcu **v; \
*stackptr++ = &start->avl_left; \
v = &start->avl_left; \
- for (u = rcu_dereference_protected(*v, \
- lockdep_is_held(&base->lock)); \
+ for (u = rcu_deref_locked(*v, base); \
u->avl_right != peer_avl_empty_rcu; ) { \
v = &u->avl_right; \
*stackptr++ = v; \
- u = rcu_dereference_protected(*v, \
- lockdep_is_held(&base->lock)); \
+ u = rcu_deref_locked(*v, base); \
} \
u; \
})
@@ -271,21 +270,16 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
while (stackend > stack) {
nodep = *--stackend;
- node = rcu_dereference_protected(*nodep,
- lockdep_is_held(&base->lock));
- l = rcu_dereference_protected(node->avl_left,
- lockdep_is_held(&base->lock));
- r = rcu_dereference_protected(node->avl_right,
- lockdep_is_held(&base->lock));
+ node = rcu_deref_locked(*nodep, base);
+ l = rcu_deref_locked(node->avl_left, base);
+ r = rcu_deref_locked(node->avl_right, base);
lh = node_height(l);
rh = node_height(r);
if (lh > rh + 1) { /* l: RH+2 */
struct inet_peer *ll, *lr, *lrl, *lrr;
int lrh;
- ll = rcu_dereference_protected(l->avl_left,
- lockdep_is_held(&base->lock));
- lr = rcu_dereference_protected(l->avl_right,
- lockdep_is_held(&base->lock));
+ ll = rcu_deref_locked(l->avl_left, base);
+ lr = rcu_deref_locked(l->avl_right, base);
lrh = node_height(lr);
if (lrh <= node_height(ll)) { /* ll: RH+1 */
RCU_INIT_POINTER(node->avl_left, lr); /* lr: RH or RH+1 */
@@ -296,10 +290,8 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
l->avl_height = node->avl_height + 1;
RCU_INIT_POINTER(*nodep, l);
} else { /* ll: RH, lr: RH+1 */
- lrl = rcu_dereference_protected(lr->avl_left,
- lockdep_is_held(&base->lock)); /* lrl: RH or RH-1 */
- lrr = rcu_dereference_protected(lr->avl_right,
- lockdep_is_held(&base->lock)); /* lrr: RH or RH-1 */
+ lrl = rcu_deref_locked(lr->avl_left, base);/* lrl: RH or RH-1 */
+ lrr = rcu_deref_locked(lr->avl_right, base);/* lrr: RH or RH-1 */
RCU_INIT_POINTER(node->avl_left, lrr); /* lrr: RH or RH-1 */
RCU_INIT_POINTER(node->avl_right, r); /* r: RH */
node->avl_height = rh + 1; /* node: RH+1 */
@@ -314,10 +306,8 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
} else if (rh > lh + 1) { /* r: LH+2 */
struct inet_peer *rr, *rl, *rlr, *rll;
int rlh;
- rr = rcu_dereference_protected(r->avl_right,
- lockdep_is_held(&base->lock));
- rl = rcu_dereference_protected(r->avl_left,
- lockdep_is_held(&base->lock));
+ rr = rcu_deref_locked(r->avl_right, base);
+ rl = rcu_deref_locked(r->avl_left, base);
rlh = node_height(rl);
if (rlh <= node_height(rr)) { /* rr: LH+1 */
RCU_INIT_POINTER(node->avl_right, rl); /* rl: LH or LH+1 */
@@ -328,10 +318,8 @@ static void peer_avl_rebalance(struct inet_peer __rcu **stack[],
r->avl_height = node->avl_height + 1;
RCU_INIT_POINTER(*nodep, r);
} else { /* rr: RH, rl: RH+1 */
- rlr = rcu_dereference_protected(rl->avl_right,
- lockdep_is_held(&base->lock)); /* rlr: LH or LH-1 */
- rll = rcu_dereference_protected(rl->avl_left,
- lockdep_is_held(&base->lock)); /* rll: LH or LH-1 */
+ rlr = rcu_deref_locked(rl->avl_right, base);/* rlr: LH or LH-1 */
+ rll = rcu_deref_locked(rl->avl_left, base);/* rll: LH or LH-1 */
RCU_INIT_POINTER(node->avl_right, rll); /* rll: LH or LH-1 */
RCU_INIT_POINTER(node->avl_left, l); /* l: LH */
node->avl_height = lh + 1; /* node: LH+1 */
@@ -372,7 +360,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
do_free = 0;
- spin_lock_bh(&base->lock);
+ write_seqlock_bh(&base->lock);
/* Check the reference counter. It was artificially incremented by 1
* in cleanup() function to prevent sudden disappearing. If we can
* atomically (because of lockless readers) take this last reference,
@@ -392,8 +380,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
/* look for a node to insert instead of p */
struct inet_peer *t;
t = lookup_rightempty(p, base);
- BUG_ON(rcu_dereference_protected(*stackptr[-1],
- lockdep_is_held(&base->lock)) != t);
+ BUG_ON(rcu_deref_locked(*stackptr[-1], base) != t);
**--stackptr = t->avl_left;
/* t is removed, t->daddr > x->daddr for any
* x in p->avl_left subtree.
@@ -409,7 +396,7 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base)
base->total--;
do_free = 1;
}
- spin_unlock_bh(&base->lock);
+ write_sequnlock_bh(&base->lock);
if (do_free)
call_rcu_bh(&p->rcu, inetpeer_free_rcu);
@@ -477,12 +464,16 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr;
struct inet_peer_base *base = family_to_base(daddr->family);
struct inet_peer *p;
+ unsigned int sequence;
+ int invalidated;
/* Look up for the address quickly, lockless.
* Because of a concurrent writer, we might not find an existing entry.
*/
rcu_read_lock_bh();
+ sequence = read_seqbegin(&base->lock);
p = lookup_rcu_bh(daddr, base);
+ invalidated = read_seqretry(&base->lock, sequence);
rcu_read_unlock_bh();
if (p) {
@@ -493,14 +484,18 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
return p;
}
+ /* If no writer did a change during our lookup, we can return early. */
+ if (!create && !invalidated)
+ return NULL;
+
/* retry an exact lookup, taking the lock before.
* At least, nodes should be hot in our cache.
*/
- spin_lock_bh(&base->lock);
+ write_seqlock_bh(&base->lock);
p = lookup(daddr, stack, base);
if (p != peer_avl_empty) {
atomic_inc(&p->refcnt);
- spin_unlock_bh(&base->lock);
+ write_sequnlock_bh(&base->lock);
/* Remove the entry from unused list if it was there. */
unlink_from_unused(p);
return p;
@@ -524,7 +519,7 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
link_to_pool(p, base);
base->total++;
}
- spin_unlock_bh(&base->lock);
+ write_sequnlock_bh(&base->lock);
if (base->total >= inet_peer_threshold)
/* Remove one less-recently-used entry. */
^ permalink raw reply related
* Re: Jetway JAD3RTLANG, Daughter Board, 3x GigaBit LAN does not work correctly
From: Francois Romieu @ 2011-03-04 22:25 UTC (permalink / raw)
To: Markus Feldmann; +Cc: netdev
In-Reply-To: <ikovkn$bn8$1@dough.gmane.org>
Markus Feldmann <feldmann_markus@gmx.de> :
> Hi All,
>
> i have a mini-ITX server with the mainboard "Jetway JNF92-270-LF"
> with the daughterboard "Jetway JAD3RTLANG, 3x GigaBit LAN".
>
> My current kernel is 2.6.36.4 and i can only connect over one of the
> network interfaces of my daughterboard at the time.
?
Are you worried that eth1 keeps going up/down or do you mean
something else ?
--
Ueimor
^ permalink raw reply
* Re: [PATCH] e1000: power off PHY after reset when interface is down
From: Prasanna Panchamukhi @ 2011-03-04 22:41 UTC (permalink / raw)
To: Jeff Kirsher
Cc: Allan, Bruce W, Pieper, Jeffrey E,
e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
In-Reply-To: <4D71298F.6090009@riverbed.com>
On 03/04/2011 10:03 AM, Prasanna Panchamukhi wrote:
> On 03/04/2011 12:19 AM, Jeff Kirsher wrote:
>> On Wed, Feb 23, 2011 at 16:02, Jeff Kirsher<jeffrey.t.kirsher@intel.com> wrote:
>>> On Tue, 2011-02-22 at 17:25 -0800, prasanna.panchamukhi@riverbed.com
>>> wrote:
>>>> From: Prasanna S. Panchamukhi<prasanna.panchamukhi@riverbed.com>
>>>>
>>>> Some Phys supported by the e1000 driver do not remain powered off
>>>> across
>>>> a reset of the device when the interface is down, e.g. on 82546.
>>>> This patch powers down (only when WoL is disabled) the PHY after reset
>>>> if
>>>> the interface is down and ethtool diagnostics are not currently
>>>> running.
>>>>
>>>> Similar problem was see on 82571 controller and was fixed in e1000e
>>>> driver
>>>> by Bruce Allan.
>>>> Please refer commit 31dbe5b4ac6fca72dec946e4d0fa7f0913f1d9b1 for
>>>> details.
>>>>
>>>> Signed-off-by: Prasanna S. Panchamukhi
>>>> <prasanna.panchamukhi@riverbed.com>
>>>> ---
>>>> drivers/net/e1000/e1000_ethtool.c | 27 +++++++++++++++++++--------
>>>> drivers/net/e1000/e1000_main.c | 7 +++++++
>>>> 2 files changed, 26 insertions(+), 8 deletions(-)
>>> Thanks Prasanna! I have added the patch to my queue of e1000 patches.
>>>
>> Prasanna-
>> Here is what we found during validating your patch:
>>
>> The behavior of 82546 device(s) seems to be identical with/without this patch
>> applied. 82546GB (LOM), dev_id 1079 powers down (with wol disabled) after
>> ifdown, but powers back up after approx. 10 seconds. 82546EB (NIC), dev_id
>> 1010 powers down (with wol disabled) after ifdown. Both of the above
>> behaviors are the same with and without the patch applied. Also, if this patch
>> DID work as expected, it should print a message after a reset, such as "Cannot
>> restart autonegotiation: Resource temporarily unavailable", which would mirror
>> the behavior of e1000e.
>>
> Hi Jeff,
>
> Below is the test case we run verify this fix:
>
> $ ethtool -s eth0 wol d
> $ ifconfig eth0 up
> $ mii-tool eth0
> eth0: negotiated 100baseTx-FD, link ok
> $ ifconfig eth0 down
> $ mii-tool eth0
> eth0: no link
> $ ethtool -s eth0 autoneg on (doesn't really matter what we do here)
> $ mii-tool eth0
> eth0: negotiated 100baseTx-FD, link ok (this should be: eth0: no link)
>
> I will re-run the test& check if does not fix this.
Hi Jeff,
I re-verified it & confirm that, this patch fixes the problem.
Please let me know if you have any issues.
Thanks
Prasanna
> Thanks
> Prasanna
>
>
>
^ permalink raw reply
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: David Miller @ 2011-03-04 22:44 UTC (permalink / raw)
To: eric.dumazet; +Cc: xiaosuo, netdev
In-Reply-To: <1299276839.2758.50.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 04 Mar 2011 23:13:59 +0100
> Le vendredi 04 mars 2011 à 12:45 -0800, David Miller a écrit :
>> From: David Miller <davem@davemloft.net>
>> Date: Fri, 04 Mar 2011 11:17:05 -0800 (PST)
>>
>> > From: Eric Dumazet <eric.dumazet@gmail.com>
>> > Date: Fri, 04 Mar 2011 16:09:08 +0100
>> >
>> >> Here is a patch to implement this idea.
>> >
>> > Applied, thanks Eric!
>>
>> Unfortunately, I have to revert, the lockdep annotations needs to
>> be updated:
>>
>> net/ipv4/inetpeer.c: In function ‘peer_avl_rebalance’:
>> net/ipv4/inetpeer.c:274:10: error: ‘seqlock_t’ has no member named ‘dep_map’
>
> Oops thats right, here is an updated version.
Applied, thanks Eric!
With this and the following patch applied to my no-routing-cache tree,
output route lookup on my Niagara2 is down to 2966 cycles! For reference
with just the plain routing cache removal, it was as much as 3832 cycles.
udpflood is a lot faster too, with plain routing cache removal it ran as:
bash$ time ./bin/udpflood -l 10000000 10.2.2.11
real 3m9.921s
user 0m9.520s
sys 3m0.440s
But now it's:
bash$ time ./bin/udpflood -l 10000000 10.2.2.11
real 2m45.903s
user 0m8.640s
sys 2m37.280s
:-)
--------------------
ipv4: Optimize flow initialization in output route lookup.
We burn a lot of useless cycles, cpu store buffer traffic, and
memory operations memset()'ing the on-stack flow used to perform
output route lookups in __ip_route_output_key().
Only the first half of the flow object members even matter for
output route lookups in this context, specifically:
FIB rules matching cares about:
dst, src, tos, iif, oif, mark
FIB trie lookup cares about:
dst
FIB semantic match cares about:
tos, scope, oif
Therefore only initialize these specific members and elide the
memset entirely.
On Niagara2 this kills about ~300 cycles from the output route
lookup path.
Likely, we can take things further, since all callers of output
route lookups essentially throw away the on-stack flow they use.
So they don't care if we use it as a scratch-pad to compute the
final flow key.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv4/route.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 04b8954..e3a5a89 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1670,14 +1670,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp)
{
u32 tos = RT_FL_TOS(oldflp);
- struct flowi fl = { .fl4_dst = oldflp->fl4_dst,
- .fl4_src = oldflp->fl4_src,
- .fl4_tos = tos & IPTOS_RT_MASK,
- .fl4_scope = ((tos & RTO_ONLINK) ?
- RT_SCOPE_LINK : RT_SCOPE_UNIVERSE),
- .mark = oldflp->mark,
- .iif = net->loopback_dev->ifindex,
- .oif = oldflp->oif };
+ struct flowi fl;
struct fib_result res;
unsigned int flags = 0;
struct net_device *dev_out = NULL;
@@ -1688,6 +1681,15 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp
res.r = NULL;
#endif
+ fl.oif = oldflp->oif;
+ fl.iif = net->loopback_dev->ifindex;
+ fl.mark = oldflp->mark;
+ fl.fl4_dst = oldflp->fl4_dst;
+ fl.fl4_src = oldflp->fl4_src;
+ fl.fl4_tos = tos & IPTOS_RT_MASK;
+ fl.fl4_scope = ((tos & RTO_ONLINK) ?
+ RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
+
rcu_read_lock();
if (oldflp->fl4_src) {
rth = ERR_PTR(-EINVAL);
--
1.7.4.1
^ permalink raw reply related
* Re: 2.6.37 regression: adding main interface to a bridge breaks vlan interface RX
From: Francois Romieu @ 2011-03-04 22:41 UTC (permalink / raw)
To: chriss; +Cc: netdev
In-Reply-To: <loom.20110304T202925-568@post.gmane.org>
chriss <mail_to_chriss@gmx.net> :
[...]
> I hope i'm doing it right. i checked out the
> 'git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git'
>
> and will try to apply the patch you provided. please correct me if i'm wrong.
> I will report back.
I have tested it against davem's -next somewhere along -rc5 but it should be
fine as well.
--
Ueimor
^ permalink raw reply
* Re: [PATCH net-next-2.6] inetpeer: seqlock optimization
From: Eric Dumazet @ 2011-03-04 23:02 UTC (permalink / raw)
To: David Miller; +Cc: xiaosuo, netdev
In-Reply-To: <20110304.144448.115945732.davem@davemloft.net>
Le vendredi 04 mars 2011 à 14:44 -0800, David Miller a écrit :
> Applied, thanks Eric!
>
> With this and the following patch applied to my no-routing-cache tree,
> output route lookup on my Niagara2 is down to 2966 cycles! For reference
> with just the plain routing cache removal, it was as much as 3832 cycles.
>
> udpflood is a lot faster too, with plain routing cache removal it ran as:
>
> bash$ time ./bin/udpflood -l 10000000 10.2.2.11
> real 3m9.921s
> user 0m9.520s
> sys 3m0.440s
>
> But now it's:
>
> bash$ time ./bin/udpflood -l 10000000 10.2.2.11
> real 2m45.903s
> user 0m8.640s
> sys 2m37.280s
>
> :-)
>
Nice indeed :)
> --------------------
> ipv4: Optimize flow initialization in output route lookup.
>
> We burn a lot of useless cycles, cpu store buffer traffic, and
> memory operations memset()'ing the on-stack flow used to perform
> output route lookups in __ip_route_output_key().
>
> Only the first half of the flow object members even matter for
> output route lookups in this context, specifically:
>
> FIB rules matching cares about:
>
> dst, src, tos, iif, oif, mark
>
> FIB trie lookup cares about:
>
> dst
>
> FIB semantic match cares about:
>
> tos, scope, oif
>
> Therefore only initialize these specific members and elide the
> memset entirely.
>
> On Niagara2 this kills about ~300 cycles from the output route
> lookup path.
>
> Likely, we can take things further, since all callers of output
> route lookups essentially throw away the on-stack flow they use.
> So they don't care if we use it as a scratch-pad to compute the
> final flow key.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> net/ipv4/route.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 04b8954..e3a5a89 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1670,14 +1670,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
> struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp)
> {
> u32 tos = RT_FL_TOS(oldflp);
> - struct flowi fl = { .fl4_dst = oldflp->fl4_dst,
> - .fl4_src = oldflp->fl4_src,
> - .fl4_tos = tos & IPTOS_RT_MASK,
> - .fl4_scope = ((tos & RTO_ONLINK) ?
> - RT_SCOPE_LINK : RT_SCOPE_UNIVERSE),
> - .mark = oldflp->mark,
> - .iif = net->loopback_dev->ifindex,
> - .oif = oldflp->oif };
> + struct flowi fl;
> struct fib_result res;
> unsigned int flags = 0;
> struct net_device *dev_out = NULL;
> @@ -1688,6 +1681,15 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *oldflp
> res.r = NULL;
> #endif
>
> + fl.oif = oldflp->oif;
> + fl.iif = net->loopback_dev->ifindex;
> + fl.mark = oldflp->mark;
> + fl.fl4_dst = oldflp->fl4_dst;
> + fl.fl4_src = oldflp->fl4_src;
> + fl.fl4_tos = tos & IPTOS_RT_MASK;
> + fl.fl4_scope = ((tos & RTO_ONLINK) ?
> + RT_SCOPE_LINK : RT_SCOPE_UNIVERSE);
> +
> rcu_read_lock();
> if (oldflp->fl4_src) {
> rth = ERR_PTR(-EINVAL);
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
^ permalink raw reply
* Re: Jetway JAD3RTLANG, Daughter Board, 3x GigaBit LAN does not work correctly
From: Markus Feldmann @ 2011-03-04 23:41 UTC (permalink / raw)
To: netdev
In-Reply-To: <20110304222534.GA13681@electric-eye.fr.zoreil.com>
Am 04.03.2011 23:25, schrieb Francois Romieu:
> Are you worried that eth1 keeps going up/down or do you mean
> something else ?
I mean when two computers try to connect to my router, then not both can
establish a connection. Sometimes only one computer can connect.
regards markus
^ permalink raw reply
* Re: bonding can't change to another slave if you ifdown the active slave
From: Jay Vosburgh @ 2011-03-05 0:38 UTC (permalink / raw)
To: Weiping Pan; +Cc: netdev, bonding-devel, Linda Wang
In-Reply-To: <4D704B35.20700@gmail.com>
Weiping Pan <panweiping3@gmail.com> wrote:
>I'm doing some Linux bonding driver test, and I find a problem in
>balance-rr mode.
>That's it can't change to another slave if you ifdown the active slave.
>Any comments are warmly welcomed!
I followed your recipe on a somewhat more recent kernel (2.6.37)
and using real hardware, and I don't see the problem you describe.
I do have a couple of questions, further down.
[...]
>My host is Fedora 14, and I install VirtualBox (4.0.2), and enable 4
I've not ever tried virtualbox, but it may be that its virtual
switch is misbehaving. One possibility that comes to mind is that the
virtual switch is confused by seeing the same MAC address on multiple
ports (which is a problem with a hardware virtual switch I'm familiar
with).
>nics for the guest system.
>My guest is Fedora 14 too.
>First on my host, I run:
>[pwp@localhost linux-2.6.35-comment]$ uname -a
>Linux localhost.localdomain 2.6.35.11-83.fc14.i686 #1 SMP Mon Feb 7
>07:04:18 UTC 2011 i686 i686 i386 GNU/Linux
>
>[pwp@localhost linux-2.6.35-comment]$ sudo ifconfig eth0:0 192.168.1.100
>netmask 255.255.255.0 up
>[pwp@localhost linux-2.6.35-comment]$ sudo ifconfig
>eth0 Link encap:Ethernet HWaddr 64:31:50:3A:B0:B5
> inet addr:10.66.65.228 Bcast:10.66.65.255 Mask:255.255.254.0
> inet6 addr: fe80::6631:50ff:fe3a:b0b5/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:811505 errors:0 dropped:0 overruns:0 frame:0
> TX packets:777018 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:709681583 (676.8 MiB) TX bytes:71520005 (68.2 MiB)
> Interrupt:17
>
>eth0:0 Link encap:Ethernet HWaddr 64:31:50:3A:B0:B5
> inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> Interrupt:17
>
>Then I enable bonding on my guest, I run:
>[root@localhost ~]# uname -a
>Linux localhost.localdomain 2.6.35.11-83.fc14.i686 #1 SMP Mon Feb 7
>07:04:18 UTC 2011 i686 i686 i386 GNU/Linux
>
>[root@localhost ~]# ifconfig
>eth6 Link encap:Ethernet HWaddr 08:00:27:3A:4D:BD
> inet addr:10.66.65.167 Bcast:10.66.65.255 Mask:255.255.254.0
> inet6 addr: fe80::a00:27ff:fe3a:4dbd/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:65 errors:0 dropped:0 overruns:0 frame:0
> TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:9916 (9.6 KiB) TX bytes:3090 (3.0 KiB)
>
>eth7 Link encap:Ethernet HWaddr 08:00:27:26:1B:DB
> inet addr:10.66.65.154 Bcast:10.66.65.255 Mask:255.255.254.0
> inet6 addr: fe80::a00:27ff:fe26:1bdb/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:57 errors:0 dropped:0 overruns:0 frame:0
> TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:7358 (7.1 KiB) TX bytes:1152 (1.1 KiB)
>
>eth8 Link encap:Ethernet HWaddr 08:00:27:B5:FC:D1
> inet addr:10.66.65.169 Bcast:10.66.65.255 Mask:255.255.254.0
> inet6 addr: fe80::a00:27ff:feb5:fcd1/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:57 errors:0 dropped:0 overruns:0 frame:0
> TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:7358 (7.1 KiB) TX bytes:1152 (1.1 KiB)
>
>eth9 Link encap:Ethernet HWaddr 08:00:27:C7:7B:FC
> inet addr:10.66.65.216 Bcast:10.66.65.255 Mask:255.255.254.0
> inet6 addr: fe80::a00:27ff:fec7:7bfc/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:57 errors:0 dropped:0 overruns:0 frame:0
> TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:7358 (7.1 KiB) TX bytes:1152 (1.1 KiB)
>
>lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> inet6 addr: ::1/128 Scope:Host
> UP LOOPBACK RUNNING MTU:16436 Metric:1
> RX packets:123 errors:0 dropped:0 overruns:0 frame:0
> TX packets:123 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:13036 (12.7 KiB) TX bytes:13036 (12.7 KiB)
>
>[root@localhost ~]# ifconfig eth7 down
>[root@localhost ~]# ifconfig eth8 down
>[root@localhost ~]# dmesg -c
>[root@localhost ~]# modprobe bonding mode=0 miimon=100
>[root@localhost ~]# ifconfig bond0 192.168.1.5 netmask 255.255.255.0 up
>[root@localhost ~]# ifenslave bond0 eth7
>
>[root@localhost ~]# dmesg
>[ 304.496463] bonding: Ethernet Channel Bonding Driver: v3.6.0
>(September 26, 2009)
>[ 304.496468] bonding: MII link monitoring set to 100 ms
>[ 353.527680] ADDRCONF(NETDEV_UP): bond0: link is not ready
>[ 355.321626] e1000: eth7 NIC Link is Up 1000 Mbps Full Duplex, Flow
>Control: RX
>[ 355.322250] bonding: bond0: enslaving eth7 as an active interface
>with an up link.
>[ 355.323503] ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
>[ 365.394052] bond0: no IPv6 routers present
>
>[pwp@localhost ~]$ ping 192.168.1.100 -c 10
At this point, what is in the routing table ("ip route show")
and the ARP table ("ip neigh show")?
>PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
>64 bytes from 192.168.1.100: icmp_req=1 ttl=64 time=0.196 ms
>64 bytes from 192.168.1.100: icmp_req=2 ttl=64 time=0.365 ms
>64 bytes from 192.168.1.100: icmp_req=3 ttl=64 time=0.259 ms
>64 bytes from 192.168.1.100: icmp_req=4 ttl=64 time=0.135 ms
>64 bytes from 192.168.1.100: icmp_req=5 ttl=64 time=0.194 ms
>64 bytes from 192.168.1.100: icmp_req=6 ttl=64 time=0.225 ms
>64 bytes from 192.168.1.100: icmp_req=7 ttl=64 time=0.189 ms
>64 bytes from 192.168.1.100: icmp_req=8 ttl=64 time=0.274 ms
>64 bytes from 192.168.1.100: icmp_req=9 ttl=64 time=1.07 ms
>64 bytes from 192.168.1.100: icmp_req=10 ttl=64 time=0.274 ms
>
>--- 192.168.1.100 ping statistics ---
>10 packets transmitted, 10 received, 0% packet loss, time 9002ms
>rtt min/avg/max/mdev = 0.135/0.319/1.079/0.260 ms
>
>[root@localhost ~]# ifenslave bond0 eth8
>[root@localhost ~]# dmesg
>[ 304.496463] bonding: Ethernet Channel Bonding Driver: v3.6.0
>(September 26, 2009)
>[ 304.496468] bonding: MII link monitoring set to 100 ms
>[ 353.527680] ADDRCONF(NETDEV_UP): bond0: link is not ready
>[ 355.321626] e1000: eth7 NIC Link is Up 1000 Mbps Full Duplex, Flow
>Control: RX
>[ 355.322250] bonding: bond0: enslaving eth7 as an active interface
>with an up link.
>[ 355.323503] ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
>[ 365.394052] bond0: no IPv6 routers present
>[ 510.913797] e1000: eth8 NIC Link is Up 1000 Mbps Full Duplex, Flow
>Control: RX
>[ 510.917312] bonding: bond0: enslaving eth8 as an active interface
>with an up link.
>
>[pwp@localhost ~]$ ping 192.168.1.100 -c 10
>PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
>64 bytes from 192.168.1.100: icmp_req=1 ttl=64 time=0.182 ms
>64 bytes from 192.168.1.100: icmp_req=2 ttl=64 time=0.211 ms
>64 bytes from 192.168.1.100: icmp_req=3 ttl=64 time=0.270 ms
>64 bytes from 192.168.1.100: icmp_req=4 ttl=64 time=0.248 ms
>64 bytes from 192.168.1.100: icmp_req=5 ttl=64 time=0.132 ms
>64 bytes from 192.168.1.100: icmp_req=6 ttl=64 time=0.291 ms
>64 bytes from 192.168.1.100: icmp_req=7 ttl=64 time=0.246 ms
>64 bytes from 192.168.1.100: icmp_req=8 ttl=64 time=0.272 ms
>64 bytes from 192.168.1.100: icmp_req=9 ttl=64 time=0.293 ms
>64 bytes from 192.168.1.100: icmp_req=10 ttl=64 time=0.133 ms
>
>--- 192.168.1.100 ping statistics ---
>10 packets transmitted, 10 received, 0% packet loss, time 9000ms
>rtt min/avg/max/mdev = 0.132/0.227/0.293/0.060 ms
>
>[root@localhost ~]# ifconfig
>bond0 Link encap:Ethernet HWaddr 08:00:27:26:1B:DB
> inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
> inet6 addr: fe80::a00:27ff:fe26:1bdb/64 Scope:Link
> UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
> RX packets:311 errors:0 dropped:0 overruns:0 frame:0
> TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:38075 (37.1 KiB) TX bytes:8698 (8.4 KiB)
>
>eth7 Link encap:Ethernet HWaddr 08:00:27:26:1B:DB
> inet addr:10.66.65.154 Bcast:10.66.65.255 Mask:255.255.254.0
> UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
> RX packets:181 errors:0 dropped:0 overruns:0 frame:0
> TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:22297 (21.7 KiB) TX bytes:4578 (4.4 KiB)
>
>eth8 Link encap:Ethernet HWaddr 08:00:27:26:1B:DB
> inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0
> UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
> RX packets:130 errors:0 dropped:0 overruns:0 frame:0
> TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:15778 (15.4 KiB) TX bytes:4120 (4.0 KiB)
>
>[root@localhost ~]# ifconfig eth7 down
Next question: just after setting eth7 down, what do the routing
and ARP tables look like?
>[root@localhost ~]# dmesg
>[ 304.496463] bonding: Ethernet Channel Bonding Driver: v3.6.0
>(September 26, 2009)
>[ 304.496468] bonding: MII link monitoring set to 100 ms
>[ 353.527680] ADDRCONF(NETDEV_UP): bond0: link is not ready
>[ 355.321626] e1000: eth7 NIC Link is Up 1000 Mbps Full Duplex, Flow
>Control: RX
>[ 355.322250] bonding: bond0: enslaving eth7 as an active interface
>with an up link.
>[ 355.323503] ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
>[ 365.394052] bond0: no IPv6 routers present
>[ 510.913797] e1000: eth8 NIC Link is Up 1000 Mbps Full Duplex, Flow
>Control: RX
>[ 510.917312] bonding: bond0: enslaving eth8 as an active interface
>with an up link.
>[ 592.208534] bonding: bond0: link status definitely down for interface
>eth7, disabling it
>
>Now, if bonding driver works well, eth8 will be the active slave, and
>the network connection is ok.
>__But__ ...
>
>[pwp@localhost ~]$ ping 192.168.1.100 -c 10
>PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
>From 192.168.1.5 icmp_seq=10 Destination Host Unreachable
>
>--- 192.168.1.100 ping statistics ---
>10 packets transmitted, 0 received, +1 errors, 100% packet loss, time 8999ms
>
>How strange!
>
>[root@localhost ~]# ifconfig
>bond0 Link encap:Ethernet HWaddr 08:00:27:26:1B:DB
> inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
> inet6 addr: fe80::a00:27ff:fe26:1bdb/64 Scope:Link
> UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
> RX packets:357 errors:0 dropped:0 overruns:0 frame:0
> TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:42971 (41.9 KiB) TX bytes:9832 (9.6 KiB)
>
>eth8 Link encap:Ethernet HWaddr 08:00:27:26:1B:DB
> inet addr:192.168.1.15 Bcast:192.168.1.255 Mask:255.255.255.0
> UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
> RX packets:163 errors:0 dropped:0 overruns:0 frame:0
> TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:19073 (18.6 KiB) TX bytes:5254 (5.1 KiB)
>
>[root@localhost ~]# arp
>Address HWtype HWaddress Flags
>Mask Iface
>corerouter.nay.redhat.c ether 00:1d:45:20:d5:ff
>C eth6
>192.168.1.100
>(incomplete) bond0
>
>I think maybe there is something wrong about arp.
>So I run ping and tcpdump synchronously.
>
>[pwp@localhost ~]$ ping 192.168.1.100 -c 10
>PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
>From 192.168.1.5 icmp_seq=2 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=3 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=4 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=6 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=7 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=8 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=9 Destination Host Unreachable
>From 192.168.1.5 icmp_seq=10 Destination Host Unreachable
>
>--- 192.168.1.100 ping statistics ---
>10 packets transmitted, 0 received, +8 errors, 100% packet loss, time 9002ms
>pipe 3
>
>And meanwhile,
>[root@localhost ~]# tcpdump -i bond0 -p arp
>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
>listening on bond0, link-type EN10MB (Ethernet), capture size 65535 bytes
>02:46:56.983092 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
>length 28
[...]
At this point, does tcpdump on the host system see the incoming
ARP requests?
>But I'm sure eth8 works well.
>
>[root@localhost ~]# modprobe -r bonding
>[root@localhost ~]# modprobe bonding mode=0 miimon=100
>[root@localhost ~]# ifconfig bond0 192.168.1.5 netmask 255.255.255.0 up
>[root@localhost ~]# ifenslave bond0 eth8
>
>[pwp@localhost ~]$ ping 192.168.1.100 -c 10
>PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.
>64 bytes from 192.168.1.100: icmp_req=1 ttl=64 time=0.683 ms
>64 bytes from 192.168.1.100: icmp_req=2 ttl=64 time=0.222 ms
>64 bytes from 192.168.1.100: icmp_req=3 ttl=64 time=0.265 ms
>64 bytes from 192.168.1.100: icmp_req=4 ttl=64 time=0.237 ms
>64 bytes from 192.168.1.100: icmp_req=5 ttl=64 time=0.214 ms
>64 bytes from 192.168.1.100: icmp_req=6 ttl=64 time=0.214 ms
>64 bytes from 192.168.1.100: icmp_req=7 ttl=64 time=0.238 ms
>64 bytes from 192.168.1.100: icmp_req=8 ttl=64 time=0.152 ms
>64 bytes from 192.168.1.100: icmp_req=9 ttl=64 time=0.234 ms
>64 bytes from 192.168.1.100: icmp_req=10 ttl=64 time=0.221 ms
>
>--- 192.168.1.100 ping statistics ---
>10 packets transmitted, 10 received, 0% packet loss, time 9004ms
>rtt min/avg/max/mdev = 0.152/0.268/0.683/0.141 ms
>
>[root@localhost ~]# ifconfig
>bond0 Link encap:Ethernet HWaddr 08:00:27:B5:FC:D1
> inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
> inet6 addr: fe80::a00:27ff:feb5:fcd1/64 Scope:Link
> UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
> RX packets:263 errors:0 dropped:0 overruns:0 frame:0
> TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:28246 (27.5 KiB) TX bytes:9810 (9.5 KiB)
>
>eth8 Link encap:Ethernet HWaddr 08:00:27:B5:FC:D1
> UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
> RX packets:263 errors:0 dropped:0 overruns:0 frame:0
> TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:28246 (27.5 KiB) TX bytes:9810 (9.5 KiB)
>
>[root@localhost ~]# arp
>Address HWtype HWaddress Flags
>Mask Iface
>corerouter.nay.redhat.c ether 00:1d:45:20:d5:ff
>C eth6
>192.168.1.100 ether 64:31:50:3a:b0:b5
>C bond0
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* FYI: tftp-hpa breaks when used on secondary ip addresses
From: Eric W. Biederman @ 2011-03-05 0:58 UTC (permalink / raw)
To: H. Peter Anvin, netdev; +Cc: Joel Sing, David Miller
tftp-hpa has code to test to see if the address it received a connection
on is a local address. I don't have a clue why tftp-hpa doesn't trust
the kernel but the code looks like:
static int address_is_local(const struct sockaddr_in *addr)
{
struct sokcaddr sa;
int sockfd = -1;
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
connect(sockfd, (struct sockaddr *)&addr, sizeof(*addr));
getsockname(sockfd, (struct sockaddr *)&sa, sizeof(sa));
return sa.sin_addr.s_addr == addr->sin_addr.s_addr;
}
Which if fails now if you happen to be running tftp-hpa on a secondary
ip address on the same subnet as your first ip. Because pref_source
in the routing table points at the first ip.
The change in kernel behavior appears to be from the commit below to
honor the preferred source address in local connections.
This all seems very fuzzy to me and mostly this appears to be a bug in
tftp-hpa but since I tracked it down I figured I would let everyone
know what happened.
Eric
commit 9fc3bbb4a752f108cf096d96640f3b548bbbce6c
Author: Joel Sing <jsing@google.com>
Date: Mon Jan 3 20:24:20 2011 +0000
ipv4/route.c: respect prefsrc for local routes
The preferred source address is currently ignored for local routes,
which results in all local connections having a src address that is the
same as the local dst address. Fix this by respecting the preferred source
address when it is provided for local routes.
This bug can be demonstrated as follows:
# ifconfig dummy0 192.168.0.1
# ip route show table local | grep local.*dummy0
local 192.168.0.1 dev dummy0 proto kernel scope host src
# 192.168.0.1
# ip route change table local local 192.168.0.1 dev dummy0 \
proto kernel scope host src 127.0.0.1
# ip route show table local | grep local.*dummy0
local 192.168.0.1 dev dummy0 proto kernel scope host src
# 127.0.0.1
We now establish a local connection and verify the source IP
address selection:
# nc -l 192.168.0.1 3128 &
# nc 192.168.0.1 3128 &
# netstat -ant | grep 192.168.0.1:3128.*EST
tcp 0 0 192.168.0.1:3128 192.168.0.1:33228
# ESTABLISHED
tcp 0 0 192.168.0.1:33228 192.168.0.1:3128
# ESTABLISHED
Signed-off-by: Joel Sing <jsing@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index df948b0..93bfd95 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net,
struct rtable **rp,
}
if (res.type == RTN_LOCAL) {
- if (!fl.fl4_src)
- fl.fl4_src = fl.fl4_dst;
+ if (!fl.fl4_src) {
+ if (res.fi->fib_prefsrc)
+ fl.fl4_src = res.fi->fib_prefsrc;
+ else
+ fl.fl4_src = fl.fl4_dst;
+ }
dev_out = net->loopback_dev;
fl.oif = dev_out->ifindex;
res.fi = NULL;
^ permalink raw reply related
* [PATCH] drivers/net/macvtap: fix error check
From: Nicolas Kaiser @ 2011-03-04 23:49 UTC (permalink / raw)
To: David S. Miller; +Cc: Arnd Bergmann, Eric Dumazet, netdev, linux-kernel
'len' is unsigned of type size_t and can't be negative.
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
drivers/net/macvtap.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 5933621..fc27a99 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -528,8 +528,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
vnet_hdr_len = q->vnet_hdr_sz;
err = -EINVAL;
- if ((len -= vnet_hdr_len) < 0)
+ if (len < vnet_hdr_len)
goto err;
+ len -= vnet_hdr_len;
err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0,
sizeof(vnet_hdr));
--
1.7.3.4
^ permalink raw reply related
* Re: [Bugme-new] [Bug 30462] New: High cpu usage when someone sends many ipv6 udp packages
From: Andrew Morton @ 2011-03-05 1:15 UTC (permalink / raw)
To: netdev; +Cc: bugzilla-daemon, bugme-daemon, ernstp
In-Reply-To: <bug-30462-10286@https.bugzilla.kernel.org/>
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Sat, 5 Mar 2011 01:10:53 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=30462
>
> Summary: High cpu usage when someone sends many ipv6 udp
> packages
> Product: Networking
> Version: 2.5
> Kernel Version: 2.6.38-rc3
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: high
> Priority: P1
> Component: IPV6
> AssignedTo: yoshfuji@linux-ipv6.org
> ReportedBy: ernstp@gmail.com
> Regression: Yes
>
>
> Hi,
>
> while testing ipv6 performance on my local network I found the following
> problem.
> When sending lots of UDP packages over ipv6 to a machine running kernel
> 2.6.38-rc3 or later that machines become heavily loaded and X may stop
> responding for long periods of time for example, sound skips etc.
> A ksoftirqd and kworker thread each run 100% on my machine.
>
> I'm using this command to trigger this:
> iperf -c fe80::21f:d0ff:fe54:1ad4%eth0 -b 1000M -u -V
> You _don't_ have to setup an iperf server on the reciever.
>
> I have a gigabit network with a WNDR3700 with the new V1.0.7.98 firmware that's
> "IPv6 ready".
>
> I've used the kernels from http://kernel.ubuntu.com/~kernel-ppa/mainline/ to
> narrow down that this happens with 2.6.38-rc3 and later but not with 2.6.38-rc2
> and earlier like 2.6.37 and 2.6.35.
>
> The following ipv6 related changes were introduced between -rc2 and -rc3 that I
> can see. The "Revert 'administrative down' address handling changes." looked
> big...
> ipv6: Always clone offlink routes.
> ipv6: Revert 'administrative down' address handling changes.
>
^ permalink raw reply
* Re: [Bugme-new] [Bug 30462] New: High cpu usage when someone sends many ipv6 udp packages
From: David Miller @ 2011-03-05 1:21 UTC (permalink / raw)
To: akpm; +Cc: netdev, bugzilla-daemon, bugme-daemon, ernstp
In-Reply-To: <20110304171506.0e27cde1.akpm@linux-foundation.org>
From: Andrew Morton <akpm@linux-foundation.org>
Date: Fri, 4 Mar 2011 17:15:06 -0800
>> The following ipv6 related changes were introduced between -rc2 and -rc3 that I
>> can see. The "Revert 'administrative down' address handling changes." looked
>> big...
>> ipv6: Always clone offlink routes.
>> ipv6: Revert 'administrative down' address handling changes.
Can we narrow it down to which of those two changes introduced the
regression?
We have another issue, still open, which is caused by the first
change, so maybe try reverting that one first.
Thanks.
^ permalink raw reply
* Re: FYI: tftp-hpa breaks when used on secondary ip addresses
From: H. Peter Anvin @ 2011-03-05 1:31 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: netdev, Joel Sing, David Miller
In-Reply-To: <m1sjv2qt68.fsf@fess.ebiederm.org>
On 03/04/2011 04:58 PM, Eric W. Biederman wrote:
>
> Which if fails now if you happen to be running tftp-hpa on a secondary
> ip address on the same subnet as your first ip. Because pref_source
> in the routing table points at the first ip.
>
> The change in kernel behavior appears to be from the commit below to
> honor the preferred source address in local connections.
>
If this is done for all local connections (as opposed to the ones that
have been configured explicitly by the administrator to behave that
way), that's a massive lossage. Not only does a large number of
applications use this trick to determine if an address is local (e.g.
allowing bypass) -- it is pretty much the only portable way to do it --
but it would cause applications which expect to get a reply back from
the same address they sent a request to to completely fall on their face.
tftp-hpa needs this information in order to handle clients that send
their initial request to a broadcast (or multicast) address.
> This all seems very fuzzy to me and mostly this appears to be a bug in
> tftp-hpa but since I tracked it down I figured I would let everyone
> know what happened.
This seems like a broken change to me, or at the very least having
seriously unintended consequences.
-hpa
^ permalink raw reply
* Re: bonding can't change to another slave if you ifdown the active slave
From: Andy Gospodarek @ 2011-03-05 2:53 UTC (permalink / raw)
To: Weiping Pan; +Cc: netdev, bonding-devel, Linda Wang
In-Reply-To: <4D704B35.20700@gmail.com>
On Fri, Mar 04, 2011 at 10:15:17AM +0800, Weiping Pan wrote:
> Hi,
>
> I'm doing some Linux bonding driver test, and I find a problem in
> balance-rr mode.
> That's it can't change to another slave if you ifdown the active slave.
> Any comments are warmly welcomed!
>
> regards
> Weiping Pan
>
> My host is Fedora 14, and I install VirtualBox (4.0.2), and enable 4
> nics for the guest system.
Does this mean you are passing 4 NICs from your host to your guest
(maybe via direct pci-device assignment to the guest) or are you
creating 4 virtual devices on the host that are in a bridge group on the
host?
[...]
> [root@localhost ~]# ifconfig eth7 down
This is not a great way to test link failure with bonding. The best way
is to actually pull the cable so the interface is truly down.
> [root@localhost ~]# dmesg
> [ 304.496463] bonding: Ethernet Channel Bonding Driver: v3.6.0
> (September 26, 2009)
> [ 304.496468] bonding: MII link monitoring set to 100 ms
> [ 353.527680] ADDRCONF(NETDEV_UP): bond0: link is not ready
> [ 355.321626] e1000: eth7 NIC Link is Up 1000 Mbps Full Duplex, Flow
> Control: RX
> [ 355.322250] bonding: bond0: enslaving eth7 as an active interface
> with an up link.
> [ 355.323503] ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
> [ 365.394052] bond0: no IPv6 routers present
> [ 510.913797] e1000: eth8 NIC Link is Up 1000 Mbps Full Duplex, Flow
> Control: RX
> [ 510.917312] bonding: bond0: enslaving eth8 as an active interface
> with an up link.
> [ 592.208534] bonding: bond0: link status definitely down for interface
> eth7, disabling it
I suspect I know, but what does /proc/net/bonding/bond0 look like?
[...]
> And meanwhile,
> [root@localhost ~]# tcpdump -i bond0 -p arp
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on bond0, link-type EN10MB (Ethernet), capture size 65535 bytes
> 02:46:56.983092 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:46:57.984040 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:46:58.988442 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:00.987340 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:01.988136 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:02.990033 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:04.985086 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:05.992368 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:06.996727 ARP, Request who-has 192.168.1.100 tell 192.168.1.5,
> length 28
> 02:47:17.231106 ARP, Request who-has dhcp-65-32.nay.redhat.com tell
> dhcp-65-180.nay.redhat.com, length 46
> ^C
> 10 packets captured
> 10 packets received by filter
> 0 packets dropped by kernel
>
>
What does a tcpdump on eth0 look like? I'm curious if these arp
requests make it there or if the responses are the frames being dropped
(possibly by the connected bridge/switch).
^ permalink raw reply
* Lacking to initialize "IP6CB(skb)->nhoff" for ipv6 transmission ?
From: Eduardo Panisset @ 2011-03-05 3:59 UTC (permalink / raw)
To: netdev
Hi,
Im using iptables for marking outgoing packets and then divert them to
specific routing tables.
Whenever a flow matches a rule into mangle table it is marked properly
and reaches over the function ip6_route_me_harder.
That function ends up calling xfrm_decode_session and in particular
_decode_session6 for v6 flows.
The latter uses "IP6CB(skb)->nhoff" for locating nextheader value but
on my debugs it was presenting a weird value (96) instead of the
expected (6), since it was a TCP flow.
So I made the decision of initializing "IP6CB(skb)->nhoff" (with the
value offset(struct ipv6hdr, nexthdr) ) in "ip6_xmit" function and
then the (6) started to be shown and the (96) value did not appeared
anymore.
Is this proceeding correct ? (and then that would be a kernel bug ?)
Rgds,
Eduardo Panisset.
^ permalink raw reply
* Re: FYI: tftp-hpa breaks when used on secondary ip addresses
From: David Miller @ 2011-03-05 4:58 UTC (permalink / raw)
To: hpa; +Cc: ebiederm, netdev, jsing
In-Reply-To: <4D719254.8000903@zytor.com>
From: "H. Peter Anvin" <hpa@zytor.com>
Date: Fri, 04 Mar 2011 17:31:00 -0800
> If this is done for all local connections (as opposed to the ones that
> have been configured explicitly by the administrator to behave that
> way), that's a massive lossage. Not only does a large number of
> applications use this trick to determine if an address is local (e.g.
> allowing bypass) -- it is pretty much the only portable way to do it --
> but it would cause applications which expect to get a reply back from
> the same address they sent a request to to completely fall on their face.
Actually this is what SOL_IP, IP_PKTINFO, was created for. Even glibc
uses it.
^ permalink raw reply
* [PATCH] ipv4: Get peer more cheaply in rt_init_metrics().
From: David Miller @ 2011-03-05 5:26 UTC (permalink / raw)
To: netdev
We know this is a new route object, so doing atomics and
stuff makes no sense at all.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv4/route.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6c87403..9794a2c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1759,9 +1759,9 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
create = 1;
- rt_bind_peer(rt, create);
- peer = rt->peer;
+ rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
if (peer) {
+ rt->rt_peer_genid = rt_peer_genid();
if (inet_metrics_new(peer))
memcpy(peer->metrics, fi->fib_metrics,
sizeof(u32) * RTAX_MAX);
--
1.7.4.1
^ permalink raw reply related
* [PATCH] ipv4: Use passed-in protocol in ip_route_newports().
From: David Miller @ 2011-03-05 5:35 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 60daf74..8905d90 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -217,7 +217,7 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
.fl4_dst = rt->fl.fl4_dst,
.fl4_src = rt->fl.fl4_src,
.fl4_tos = rt->fl.fl4_tos,
- .proto = rt->fl.proto,
+ .proto = protocol,
.fl_ip_sport = sport,
.fl_ip_dport = dport };
--
1.7.4.1
^ permalink raw reply related
* [PATCH] ipv4: Set rt->rt_iif more sanely on output routes.
From: David Miller @ 2011-03-05 5:36 UTC (permalink / raw)
To: netdev
rt->rt_iif is only ever inspected on input routes, for example DCCP
uses this to populate a route lookup flow key when generating replies
to another packet.
Therefore, setting it to anything other than zero on output routes
makes no sense.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv4/route.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 9794a2c..602473c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2381,7 +2381,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->fl.mark = oldflp->mark;
rth->rt_dst = fl->fl4_dst;
rth->rt_src = fl->fl4_src;
- rth->rt_iif = oldflp->oif ? : dev_out->ifindex;
+ rth->rt_iif = 0;
/* get references to the devices that are to be hold by the routing
cache entry */
rth->dst.dev = dev_out;
--
1.7.4.1
^ permalink raw reply related
* [PATCH] ipv4: Remove flowi from struct rtable.
From: David Miller @ 2011-03-05 6:12 UTC (permalink / raw)
To: netdev
The only necessary parts are the src/dst addresses, the
interface indexes, the TOS, and the mark.
The rest is unnecessary bloat, which amounts to nearly
50 bytes on 64-bit.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 22 ++++---
net/ipv4/icmp.c | 2 +-
net/ipv4/ipmr.c | 52 +++++++++++++----
net/ipv4/route.c | 153 +++++++++++++++++++++++++---------------------
net/ipv4/xfrm4_policy.c | 7 ++-
net/sched/cls_route.c | 2 +-
net/sched/em_meta.c | 2 +-
7 files changed, 146 insertions(+), 94 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 8905d90..9257f5f 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -53,16 +53,20 @@ struct fib_info;
struct rtable {
struct dst_entry dst;
- /* Cache lookup keys */
- struct flowi fl;
+ /* Lookup key. */
+ __be32 rt_key_dst;
+ __be32 rt_key_src;
int rt_genid;
unsigned rt_flags;
__u16 rt_type;
+ __u8 rt_tos;
__be32 rt_dst; /* Path destination */
__be32 rt_src; /* Path source */
int rt_iif;
+ int rt_oif;
+ __u32 rt_mark;
/* Info on neighbour */
__be32 rt_gateway;
@@ -76,12 +80,12 @@ struct rtable {
static inline bool rt_is_input_route(struct rtable *rt)
{
- return rt->fl.iif != 0;
+ return rt->rt_iif != 0;
}
static inline bool rt_is_output_route(struct rtable *rt)
{
- return rt->fl.iif == 0;
+ return rt->rt_iif == 0;
}
struct ip_rt_acct {
@@ -212,11 +216,11 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
__be16 dport, struct sock *sk)
{
if (sport != orig_sport || dport != orig_dport) {
- struct flowi fl = { .oif = rt->fl.oif,
- .mark = rt->fl.mark,
- .fl4_dst = rt->fl.fl4_dst,
- .fl4_src = rt->fl.fl4_src,
- .fl4_tos = rt->fl.fl4_tos,
+ struct flowi fl = { .oif = rt->rt_oif,
+ .mark = rt->rt_mark,
+ .fl4_dst = rt->rt_key_dst,
+ .fl4_src = rt->rt_key_src,
+ .fl4_tos = rt->rt_tos,
.proto = protocol,
.fl_ip_sport = sport,
.fl_ip_dport = dport };
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 994a785..1771ce6 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -563,7 +563,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
rcu_read_lock();
if (rt_is_input_route(rt) &&
net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)
- dev = dev_get_by_index_rcu(net, rt->fl.iif);
+ dev = dev_get_by_index_rcu(net, rt->rt_iif);
if (dev)
saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 26ca2f2..9d5f634 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1813,12 +1813,22 @@ int ip_mr_input(struct sk_buff *skb)
if (IPCB(skb)->flags & IPSKB_FORWARDED)
goto dont_forward;
- err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt);
- if (err < 0) {
- kfree_skb(skb);
- return err;
+ {
+ struct rtable *rt = skb_rtable(skb);
+ struct flowi fl = {
+ .fl4_dst = rt->rt_key_dst,
+ .fl4_src = rt->rt_key_src,
+ .fl4_tos = rt->rt_tos,
+ .oif = rt->rt_oif,
+ .iif = rt->rt_iif,
+ .mark = rt->rt_mark,
+ };
+ err = ipmr_fib_lookup(net, &fl, &mrt);
+ if (err < 0) {
+ kfree_skb(skb);
+ return err;
+ }
}
-
if (!local) {
if (IPCB(skb)->opt.router_alert) {
if (ip_call_ra_chain(skb))
@@ -1946,9 +1956,19 @@ int pim_rcv_v1(struct sk_buff *skb)
pim = igmp_hdr(skb);
- if (ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt) < 0)
- goto drop;
-
+ {
+ struct rtable *rt = skb_rtable(skb);
+ struct flowi fl = {
+ .fl4_dst = rt->rt_key_dst,
+ .fl4_src = rt->rt_key_src,
+ .fl4_tos = rt->rt_tos,
+ .oif = rt->rt_oif,
+ .iif = rt->rt_iif,
+ .mark = rt->rt_mark,
+ };
+ if (ipmr_fib_lookup(net, &fl, &mrt) < 0)
+ goto drop;
+ }
if (!mrt->mroute_do_pim ||
pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
goto drop;
@@ -1978,9 +1998,19 @@ static int pim_rcv(struct sk_buff *skb)
csum_fold(skb_checksum(skb, 0, skb->len, 0))))
goto drop;
- if (ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt) < 0)
- goto drop;
-
+ {
+ struct rtable *rt = skb_rtable(skb);
+ struct flowi fl = {
+ .fl4_dst = rt->rt_key_dst,
+ .fl4_src = rt->rt_key_src,
+ .fl4_tos = rt->rt_tos,
+ .oif = rt->rt_oif,
+ .iif = rt->rt_iif,
+ .mark = rt->rt_mark,
+ };
+ if (ipmr_fib_lookup(net, &fl, &mrt) < 0)
+ goto drop;
+ }
if (__pim_rcv(mrt, skb, sizeof(*pim))) {
drop:
kfree_skb(skb);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 602473c..92a24ea 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -424,7 +424,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
dst_metric(&r->dst, RTAX_WINDOW),
(int)((dst_metric(&r->dst, RTAX_RTT) >> 3) +
dst_metric(&r->dst, RTAX_RTTVAR)),
- r->fl.fl4_tos,
+ r->rt_tos,
r->dst.hh ? atomic_read(&r->dst.hh->hh_refcnt) : -1,
r->dst.hh ? (r->dst.hh->hh_output ==
dev_queue_xmit) : 0,
@@ -711,22 +711,22 @@ static inline bool rt_caching(const struct net *net)
net->ipv4.sysctl_rt_cache_rebuild_count;
}
-static inline bool compare_hash_inputs(const struct flowi *fl1,
- const struct flowi *fl2)
+static inline bool compare_hash_inputs(const struct rtable *rt1,
+ const struct rtable *rt2)
{
- return ((((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) |
- ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) |
- (fl1->iif ^ fl2->iif)) == 0);
+ return ((((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
+ ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
+ (rt1->rt_iif ^ rt2->rt_iif)) == 0);
}
-static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
+static inline int compare_keys(struct rtable *rt1, struct rtable *rt2)
{
- return (((__force u32)fl1->fl4_dst ^ (__force u32)fl2->fl4_dst) |
- ((__force u32)fl1->fl4_src ^ (__force u32)fl2->fl4_src) |
- (fl1->mark ^ fl2->mark) |
- (*(u16 *)&fl1->fl4_tos ^ *(u16 *)&fl2->fl4_tos) |
- (fl1->oif ^ fl2->oif) |
- (fl1->iif ^ fl2->iif)) == 0;
+ return (((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
+ ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
+ (rt1->rt_mark ^ rt2->rt_mark) |
+ (rt1->rt_tos ^ rt2->rt_tos) |
+ (rt1->rt_oif ^ rt2->rt_oif) |
+ (rt1->rt_iif ^ rt2->rt_iif)) == 0;
}
static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
@@ -813,7 +813,7 @@ static int has_noalias(const struct rtable *head, const struct rtable *rth)
const struct rtable *aux = head;
while (aux != rth) {
- if (compare_hash_inputs(&aux->fl, &rth->fl))
+ if (compare_hash_inputs(aux, rth))
return 0;
aux = rcu_dereference_protected(aux->dst.rt_next, 1);
}
@@ -1073,7 +1073,7 @@ restart:
rt_free(rth);
continue;
}
- if (compare_keys(&rth->fl, &rt->fl) && compare_netns(rth, rt)) {
+ if (compare_keys(rth, rt) && compare_netns(rth, rt)) {
/* Put it first */
*rthp = rth->dst.rt_next;
/*
@@ -1136,7 +1136,7 @@ restart:
rt_emergency_hash_rebuild(net);
spin_unlock_bh(rt_hash_lock_addr(hash));
- hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
+ hash = rt_hash(rt->rt_key_dst, rt->rt_key_src,
ifindex, rt_genid(net));
goto restart;
}
@@ -1344,12 +1344,12 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
ip_rt_put(rt);
ret = NULL;
} else if (rt->rt_flags & RTCF_REDIRECTED) {
- unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
- rt->fl.oif,
+ unsigned hash = rt_hash(rt->rt_key_dst, rt->rt_key_src,
+ rt->rt_oif,
rt_genid(dev_net(dst->dev)));
#if RT_CACHE_DEBUG >= 1
printk(KERN_DEBUG "ipv4_negative_advice: redirect to %pI4/%02x dropped\n",
- &rt->rt_dst, rt->fl.fl4_tos);
+ &rt->rt_dst, rt->rt_tos);
#endif
rt_del(hash, rt);
ret = NULL;
@@ -1697,8 +1697,17 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt)
if (rt_is_output_route(rt))
src = rt->rt_src;
else {
+ struct flowi fl = {
+ .fl4_dst = rt->rt_key_dst,
+ .fl4_src = rt->rt_key_src,
+ .fl4_tos = rt->rt_tos,
+ .oif = rt->rt_oif,
+ .iif = rt->rt_iif,
+ .mark = rt->rt_mark,
+ };
+
rcu_read_lock();
- if (fib_lookup(dev_net(rt->dst.dev), &rt->fl, &res) == 0)
+ if (fib_lookup(dev_net(rt->dst.dev), &fl, &res) == 0)
src = FIB_RES_PREFSRC(res);
else
src = inet_select_addr(rt->dst.dev, rt->rt_gateway,
@@ -1748,7 +1757,8 @@ static unsigned int ipv4_default_mtu(const struct dst_entry *dst)
return mtu;
}
-static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
+static void rt_init_metrics(struct rtable *rt, const struct flowi *oldflp,
+ struct fib_info *fi)
{
struct inet_peer *peer;
int create = 0;
@@ -1756,7 +1766,7 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
/* If a peer entry exists for this destination, we must hook
* it up in order to get at cached metrics.
*/
- if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
+ if (oldflp && (oldflp->flags & FLOWI_FLAG_PRECOW_METRICS))
create = 1;
rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
@@ -1783,7 +1793,8 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
}
}
-static void rt_set_nexthop(struct rtable *rt, const struct fib_result *res,
+static void rt_set_nexthop(struct rtable *rt, const struct flowi *oldflp,
+ const struct fib_result *res,
struct fib_info *fi, u16 type, u32 itag)
{
struct dst_entry *dst = &rt->dst;
@@ -1792,7 +1803,7 @@ static void rt_set_nexthop(struct rtable *rt, const struct fib_result *res,
if (FIB_RES_GW(*res) &&
FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
rt->rt_gateway = FIB_RES_GW(*res);
- rt_init_metrics(rt, fi);
+ rt_init_metrics(rt, oldflp, fi);
#ifdef CONFIG_IP_ROUTE_CLASSID
dst->tclassid = FIB_RES_NH(*res).nh_tclassid;
#endif
@@ -1861,20 +1872,19 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->dst.output = ip_rt_bug;
- rth->fl.fl4_dst = daddr;
+ rth->rt_key_dst = daddr;
rth->rt_dst = daddr;
- rth->fl.fl4_tos = tos;
- rth->fl.mark = skb->mark;
- rth->fl.fl4_src = saddr;
+ rth->rt_tos = tos;
+ rth->rt_mark = skb->mark;
+ rth->rt_key_src = saddr;
rth->rt_src = saddr;
#ifdef CONFIG_IP_ROUTE_CLASSID
rth->dst.tclassid = itag;
#endif
- rth->rt_iif =
- rth->fl.iif = dev->ifindex;
+ rth->rt_iif = dev->ifindex;
rth->dst.dev = init_net.loopback_dev;
dev_hold(rth->dst.dev);
- rth->fl.oif = 0;
+ rth->rt_oif = 0;
rth->rt_gateway = daddr;
rth->rt_spec_dst= spec_dst;
rth->rt_genid = rt_genid(dev_net(dev));
@@ -1999,25 +2009,24 @@ static int __mkroute_input(struct sk_buff *skb,
goto cleanup;
}
- rth->fl.fl4_dst = daddr;
+ rth->rt_key_dst = daddr;
rth->rt_dst = daddr;
- rth->fl.fl4_tos = tos;
- rth->fl.mark = skb->mark;
- rth->fl.fl4_src = saddr;
+ rth->rt_tos = tos;
+ rth->rt_mark = skb->mark;
+ rth->rt_key_src = saddr;
rth->rt_src = saddr;
rth->rt_gateway = daddr;
- rth->rt_iif =
- rth->fl.iif = in_dev->dev->ifindex;
+ rth->rt_iif = in_dev->dev->ifindex;
rth->dst.dev = (out_dev)->dev;
dev_hold(rth->dst.dev);
- rth->fl.oif = 0;
+ rth->rt_oif = 0;
rth->rt_spec_dst= spec_dst;
rth->dst.input = ip_forward;
rth->dst.output = ip_output;
rth->rt_genid = rt_genid(dev_net(rth->dst.dev));
- rt_set_nexthop(rth, res, res->fi, res->type, itag);
+ rt_set_nexthop(rth, NULL, res, res->fi, res->type, itag);
rth->rt_flags = flags;
@@ -2172,17 +2181,16 @@ local_input:
rth->dst.output= ip_rt_bug;
rth->rt_genid = rt_genid(net);
- rth->fl.fl4_dst = daddr;
+ rth->rt_key_dst = daddr;
rth->rt_dst = daddr;
- rth->fl.fl4_tos = tos;
- rth->fl.mark = skb->mark;
- rth->fl.fl4_src = saddr;
+ rth->rt_tos = tos;
+ rth->rt_mark = skb->mark;
+ rth->rt_key_src = saddr;
rth->rt_src = saddr;
#ifdef CONFIG_IP_ROUTE_CLASSID
rth->dst.tclassid = itag;
#endif
- rth->rt_iif =
- rth->fl.iif = dev->ifindex;
+ rth->rt_iif = dev->ifindex;
rth->dst.dev = net->loopback_dev;
dev_hold(rth->dst.dev);
rth->rt_gateway = daddr;
@@ -2261,12 +2269,12 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
rth = rcu_dereference(rth->dst.rt_next)) {
- if ((((__force u32)rth->fl.fl4_dst ^ (__force u32)daddr) |
- ((__force u32)rth->fl.fl4_src ^ (__force u32)saddr) |
- (rth->fl.iif ^ iif) |
- rth->fl.oif |
- (rth->fl.fl4_tos ^ tos)) == 0 &&
- rth->fl.mark == skb->mark &&
+ if ((((__force u32)rth->rt_key_dst ^ (__force u32)daddr) |
+ ((__force u32)rth->rt_key_src ^ (__force u32)saddr) |
+ (rth->rt_iif ^ iif) |
+ rth->rt_oif |
+ (rth->rt_tos ^ tos)) == 0 &&
+ rth->rt_mark == skb->mark &&
net_eq(dev_net(rth->dst.dev), net) &&
!rt_is_expired(rth)) {
if (noref) {
@@ -2374,11 +2382,11 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
if (!rth)
return ERR_PTR(-ENOBUFS);
- rth->fl.fl4_dst = oldflp->fl4_dst;
- rth->fl.fl4_tos = tos;
- rth->fl.fl4_src = oldflp->fl4_src;
- rth->fl.oif = oldflp->oif;
- rth->fl.mark = oldflp->mark;
+ rth->rt_key_dst = oldflp->fl4_dst;
+ rth->rt_tos = tos;
+ rth->rt_key_src = oldflp->fl4_src;
+ rth->rt_oif = oldflp->oif;
+ rth->rt_mark = oldflp->mark;
rth->rt_dst = fl->fl4_dst;
rth->rt_src = fl->fl4_src;
rth->rt_iif = 0;
@@ -2416,7 +2424,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
#endif
}
- rt_set_nexthop(rth, res, fi, type, 0);
+ rt_set_nexthop(rth, oldflp, res, fi, type, 0);
rth->rt_flags = flags;
return rth;
@@ -2629,12 +2637,12 @@ struct rtable *__ip_route_output_key(struct net *net, const struct flowi *flp)
rcu_read_lock_bh();
for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth;
rth = rcu_dereference_bh(rth->dst.rt_next)) {
- if (rth->fl.fl4_dst == flp->fl4_dst &&
- rth->fl.fl4_src == flp->fl4_src &&
+ if (rth->rt_key_dst == flp->fl4_dst &&
+ rth->rt_key_src == flp->fl4_src &&
rt_is_output_route(rth) &&
- rth->fl.oif == flp->oif &&
- rth->fl.mark == flp->mark &&
- !((rth->fl.fl4_tos ^ flp->fl4_tos) &
+ rth->rt_oif == flp->oif &&
+ rth->rt_mark == flp->mark &&
+ !((rth->rt_tos ^ flp->fl4_tos) &
(IPTOS_RT_MASK | RTO_ONLINK)) &&
net_eq(dev_net(rth->dst.dev), net) &&
!rt_is_expired(rth)) {
@@ -2693,7 +2701,12 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
if (new->dev)
dev_hold(new->dev);
- rt->fl = ort->fl;
+ rt->rt_key_dst = ort->rt_key_dst;
+ rt->rt_key_src = ort->rt_key_src;
+ rt->rt_tos = ort->rt_tos;
+ rt->rt_iif = ort->rt_iif;
+ rt->rt_oif = ort->rt_oif;
+ rt->rt_mark = ort->rt_mark;
rt->rt_genid = rt_genid(net);
rt->rt_flags = ort->rt_flags;
@@ -2756,7 +2769,7 @@ static int rt_fill_info(struct net *net,
r->rtm_family = AF_INET;
r->rtm_dst_len = 32;
r->rtm_src_len = 0;
- r->rtm_tos = rt->fl.fl4_tos;
+ r->rtm_tos = rt->rt_tos;
r->rtm_table = RT_TABLE_MAIN;
NLA_PUT_U32(skb, RTA_TABLE, RT_TABLE_MAIN);
r->rtm_type = rt->rt_type;
@@ -2768,9 +2781,9 @@ static int rt_fill_info(struct net *net,
NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst);
- if (rt->fl.fl4_src) {
+ if (rt->rt_key_src) {
r->rtm_src_len = 32;
- NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src);
+ NLA_PUT_BE32(skb, RTA_SRC, rt->rt_key_src);
}
if (rt->dst.dev)
NLA_PUT_U32(skb, RTA_OIF, rt->dst.dev->ifindex);
@@ -2780,7 +2793,7 @@ static int rt_fill_info(struct net *net,
#endif
if (rt_is_input_route(rt))
NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst);
- else if (rt->rt_src != rt->fl.fl4_src)
+ else if (rt->rt_src != rt->rt_key_src)
NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src);
if (rt->rt_dst != rt->rt_gateway)
@@ -2789,8 +2802,8 @@ static int rt_fill_info(struct net *net,
if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
goto nla_put_failure;
- if (rt->fl.mark)
- NLA_PUT_BE32(skb, RTA_MARK, rt->fl.mark);
+ if (rt->rt_mark)
+ NLA_PUT_BE32(skb, RTA_MARK, rt->rt_mark);
error = rt->dst.error;
expires = (rt->peer && rt->peer->pmtu_expires) ?
@@ -2824,7 +2837,7 @@ static int rt_fill_info(struct net *net,
}
} else
#endif
- NLA_PUT_U32(skb, RTA_IIF, rt->fl.iif);
+ NLA_PUT_U32(skb, RTA_IIF, rt->rt_iif);
}
if (rtnl_put_cacheinfo(skb, &rt->dst, id, ts, tsage,
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 45b8214..c70c42e 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -70,7 +70,12 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
{
struct rtable *rt = (struct rtable *)xdst->route;
- xdst->u.rt.fl = *fl;
+ rt->rt_key_dst = fl->fl4_dst;
+ rt->rt_key_src = fl->fl4_src;
+ rt->rt_tos = fl->fl4_tos;
+ rt->rt_iif = fl->iif;
+ rt->rt_oif = fl->oif;
+ rt->rt_mark = fl->mark;
xdst->u.dst.dev = dev;
dev_hold(dev);
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index d580cdf..a9079053 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -143,7 +143,7 @@ static int route4_classify(struct sk_buff *skb, struct tcf_proto *tp,
if (head == NULL)
goto old_method;
- iif = ((struct rtable *)dst)->fl.iif;
+ iif = ((struct rtable *)dst)->rt_iif;
h = route4_fastmap_hash(id, iif);
if (id == head->fastmap[h].id &&
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index e5e1747..a4de67e 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -264,7 +264,7 @@ META_COLLECTOR(int_rtiif)
if (unlikely(skb_rtable(skb) == NULL))
*err = -1;
else
- dst->value = skb_rtable(skb)->fl.iif;
+ dst->value = skb_rtable(skb)->rt_iif;
}
/**************************************************************************
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH] ipv4: Get peer more cheaply in rt_init_metrics().
From: Eric Dumazet @ 2011-03-05 6:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110304.212636.226786422.davem@davemloft.net>
Le vendredi 04 mars 2011 à 21:26 -0800, David Miller écrit :
> We know this is a new route object, so doing atomics and
> stuff makes no sense at all.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> net/ipv4/route.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 6c87403..9794a2c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1759,9 +1759,9 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
> if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
> create = 1;
>
> - rt_bind_peer(rt, create);
> - peer = rt->peer;
> + rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
> if (peer) {
> + rt->rt_peer_genid = rt_peer_genid();
> if (inet_metrics_new(peer))
> memcpy(peer->metrics, fi->fib_metrics,
> sizeof(u32) * RTAX_MAX);
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
^ 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