Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130490
b: refs/heads/master
c: ae9e47e
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jan 29, 2009
1 parent e08258a commit 4055126
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be0093705c3ce98d73cac0ca8f93ea105cdf4e9c
refs/heads/master: ae9e47e9e864bc5f0a7a7e71dc3f287196b3626b
4 changes: 2 additions & 2 deletions trunk/drivers/net/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

char e1000_driver_name[] = "e1000";
static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
#define DRV_VERSION "7.3.20-k3-NAPI"
#define DRV_VERSION "7.3.21-k3-NAPI"
const char e1000_driver_version[] = DRV_VERSION;
static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";

Expand Down Expand Up @@ -3712,7 +3712,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
struct e1000_hw *hw = &adapter->hw;
u32 rctl, icr = er32(ICR);

if (unlikely(!icr))
if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags)))
return IRQ_NONE; /* Not our interrupt */

/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/r6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ static void r6040_down(struct net_device *dev)
{
struct r6040_private *lp = netdev_priv(dev);
void __iomem *ioaddr = lp->base;
struct pci_dev *pdev = lp->pdev;
int limit = 2048;
u16 *adrp;
u16 cmd;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
skb_put(skb, MAX_PACKET_LEN);

hdr = skb_vnet_hdr(skb);
sg_init_one(sg, hdr, sizeof(*hdr));
sg_set_buf(sg, hdr, sizeof(*hdr));

if (vi->big_packets) {
for (i = 0; i < MAX_SKB_FRAGS; i++) {
Expand Down Expand Up @@ -488,9 +488,9 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)

/* Encode metadata header at front. */
if (vi->mergeable_rx_bufs)
sg_init_one(sg, mhdr, sizeof(*mhdr));
sg_set_buf(sg, mhdr, sizeof(*mhdr));
else
sg_init_one(sg, hdr, sizeof(*hdr));
sg_set_buf(sg, hdr, sizeof(*hdr));

num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/net/inet_hashtables.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
size = 2048;
if (nr_pcpus >= 32)
size = 4096;
if (sizeof(rwlock_t) != 0) {
if (sizeof(spinlock_t) != 0) {
#ifdef CONFIG_NUMA
if (size * sizeof(spinlock_t) > PAGE_SIZE)
hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ static int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
struct tcp_splice_state *tss = rd_desc->arg.data;
int ret;

ret = skb_splice_bits(skb, offset, tss->pipe, rd_desc->count, tss->flags);
ret = skb_splice_bits(skb, offset, tss->pipe, min(rd_desc->count, len),
tss->flags);
if (ret > 0)
rd_desc->count -= ret;
return ret;
Expand Down
55 changes: 39 additions & 16 deletions trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ EXPORT_SYMBOL(sysctl_udp_wmem_min);
atomic_t udp_memory_allocated;
EXPORT_SYMBOL(udp_memory_allocated);

#define PORTS_PER_CHAIN (65536 / UDP_HTABLE_SIZE)

static int udp_lib_lport_inuse(struct net *net, __u16 num,
const struct udp_hslot *hslot,
unsigned long *bitmap,
struct sock *sk,
int (*saddr_comp)(const struct sock *sk1,
const struct sock *sk2))
Expand All @@ -132,12 +135,17 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
sk_nulls_for_each(sk2, node, &hslot->head)
if (net_eq(sock_net(sk2), net) &&
sk2 != sk &&
sk2->sk_hash == num &&
(bitmap || sk2->sk_hash == num) &&
(!sk2->sk_reuse || !sk->sk_reuse) &&
(!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
|| sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
(*saddr_comp)(sk, sk2))
return 1;
(*saddr_comp)(sk, sk2)) {
if (bitmap)
__set_bit(sk2->sk_hash / UDP_HTABLE_SIZE,
bitmap);
else
return 1;
}
return 0;
}

Expand All @@ -160,32 +168,47 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
if (!snum) {
int low, high, remaining;
unsigned rand;
unsigned short first;
unsigned short first, last;
DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN);

inet_get_local_port_range(&low, &high);
remaining = (high - low) + 1;

rand = net_random();
snum = first = rand % remaining + low;
rand |= 1;
for (;;) {
hslot = &udptable->hash[udp_hashfn(net, snum)];
first = (((u64)rand * remaining) >> 32) + low;
/*
* force rand to be an odd multiple of UDP_HTABLE_SIZE
*/
rand = (rand | 1) * UDP_HTABLE_SIZE;
for (last = first + UDP_HTABLE_SIZE; first != last; first++) {
hslot = &udptable->hash[udp_hashfn(net, first)];
bitmap_zero(bitmap, PORTS_PER_CHAIN);
spin_lock_bh(&hslot->lock);
if (!udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
break;
spin_unlock_bh(&hslot->lock);
udp_lib_lport_inuse(net, snum, hslot, bitmap, sk,
saddr_comp);

snum = first;
/*
* Iterate on all possible values of snum for this hash.
* Using steps of an odd multiple of UDP_HTABLE_SIZE
* give us randomization and full range coverage.
*/
do {
snum = snum + rand;
} while (snum < low || snum > high);
if (snum == first)
goto fail;
if (low <= snum && snum <= high &&
!test_bit(snum / UDP_HTABLE_SIZE, bitmap))
goto found;
snum += rand;
} while (snum != first);
spin_unlock_bh(&hslot->lock);
}
goto fail;
} else {
hslot = &udptable->hash[udp_hashfn(net, snum)];
spin_lock_bh(&hslot->lock);
if (udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
if (udp_lib_lport_inuse(net, snum, hslot, NULL, sk, saddr_comp))
goto fail_unlock;
}
found:
inet_sk(sk)->num = snum;
sk->sk_hash = snum;
if (sk_unhashed(sk)) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4250,7 +4250,7 @@ static struct addrconf_sysctl_table
.procname = "mc_forwarding",
.data = &ipv6_devconf.mc_forwarding,
.maxlen = sizeof(int),
.mode = 0644,
.mode = 0444,
.proc_handler = proc_dointvec,
},
#endif
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
goto relookup_failed;

if (ip6_dst_lookup(sk, &dst2, &fl))
if (ip6_dst_lookup(sk, &dst2, &fl2))
goto relookup_failed;

err = xfrm_lookup(net, &dst2, &fl, sk, XFRM_LOOKUP_ICMP);
err = xfrm_lookup(net, &dst2, &fl2, sk, XFRM_LOOKUP_ICMP);
switch (err) {
case 0:
dst_release(dst);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/ip6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ int ip6_mc_input(struct sk_buff *skb)
* IPv6 multicast router mode is now supported ;)
*/
if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
!(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) &&
likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
/*
* Okay, we try to forward - split and duplicate
Expand Down Expand Up @@ -316,7 +317,6 @@ int ip6_mc_input(struct sk_buff *skb)
}

if (skb2) {
skb2->dev = skb2->dst->dev;
ip6_mr_input(skb2);
}
}
Expand Down
23 changes: 18 additions & 5 deletions trunk/net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ static int pim6_rcv(struct sk_buff *skb)
pim = (struct pimreghdr *)skb_transport_header(skb);
if (pim->type != ((PIM_VERSION << 4) | PIM_REGISTER) ||
(pim->flags & PIM_NULL_REGISTER) ||
(ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
sizeof(*pim), IPPROTO_PIM,
csum_partial((void *)pim, sizeof(*pim), 0)) &&
csum_fold(skb_checksum(skb, 0, skb->len, 0))))
goto drop;

Expand All @@ -392,7 +394,7 @@ static int pim6_rcv(struct sk_buff *skb)
skb_pull(skb, (u8 *)encap - skb->data);
skb_reset_network_header(skb);
skb->dev = reg_dev;
skb->protocol = htons(ETH_P_IP);
skb->protocol = htons(ETH_P_IPV6);
skb->ip_summed = 0;
skb->pkt_type = PACKET_HOST;
dst_release(skb->dst);
Expand Down Expand Up @@ -481,6 +483,7 @@ static int mif6_delete(struct net *net, int vifi)
{
struct mif_device *v;
struct net_device *dev;
struct inet6_dev *in6_dev;
if (vifi < 0 || vifi >= net->ipv6.maxvif)
return -EADDRNOTAVAIL;

Expand Down Expand Up @@ -513,6 +516,10 @@ static int mif6_delete(struct net *net, int vifi)

dev_set_allmulti(dev, -1);

in6_dev = __in6_dev_get(dev);
if (in6_dev)
in6_dev->cnf.mc_forwarding--;

if (v->flags & MIFF_REGISTER)
unregister_netdevice(dev);

Expand Down Expand Up @@ -622,6 +629,7 @@ static int mif6_add(struct net *net, struct mif6ctl *vifc, int mrtsock)
int vifi = vifc->mif6c_mifi;
struct mif_device *v = &net->ipv6.vif6_table[vifi];
struct net_device *dev;
struct inet6_dev *in6_dev;
int err;

/* Is vif busy ? */
Expand Down Expand Up @@ -662,6 +670,10 @@ static int mif6_add(struct net *net, struct mif6ctl *vifc, int mrtsock)
return -EINVAL;
}

in6_dev = __in6_dev_get(dev);
if (in6_dev)
in6_dev->cnf.mc_forwarding++;

/*
* Fill in the VIF structures
*/
Expand Down Expand Up @@ -838,8 +850,6 @@ static int ip6mr_cache_report(struct net *net, struct sk_buff *pkt, mifi_t mifi,

skb->dst = dst_clone(pkt->dst);
skb->ip_summed = CHECKSUM_UNNECESSARY;

skb_pull(skb, sizeof(struct ipv6hdr));
}

if (net->ipv6.mroute6_sk == NULL) {
Expand Down Expand Up @@ -1222,8 +1232,10 @@ static int ip6mr_sk_init(struct sock *sk)

rtnl_lock();
write_lock_bh(&mrt_lock);
if (likely(net->ipv6.mroute6_sk == NULL))
if (likely(net->ipv6.mroute6_sk == NULL)) {
net->ipv6.mroute6_sk = sk;
net->ipv6.devconf_all->mc_forwarding++;
}
else
err = -EADDRINUSE;
write_unlock_bh(&mrt_lock);
Expand All @@ -1242,6 +1254,7 @@ int ip6mr_sk_done(struct sock *sk)
if (sk == net->ipv6.mroute6_sk) {
write_lock_bh(&mrt_lock);
net->ipv6.mroute6_sk = NULL;
net->ipv6.devconf_all->mc_forwarding--;
write_unlock_bh(&mrt_lock);

mroute_clean_tables(net);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ void ip6_route_input(struct sk_buff *skb)
.proto = iph->nexthdr,
};

if (rt6_need_strict(&iph->daddr))
if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
flags |= RT6_LOOKUP_F_IFACE;

skb->dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input);
Expand Down

0 comments on commit 4055126

Please sign in to comment.