Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107764
b: refs/heads/master
c: 33e3349
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Aug 5, 2008
1 parent 1450011 commit bd2de47
Show file tree
Hide file tree
Showing 25 changed files with 136 additions and 114 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: 3e2236c108792c3afbbfbe3f373ee7fdd68eda8e
refs/heads/master: 33e334950abda8e42c3b6e6f280fad0d4ab92141
20 changes: 4 additions & 16 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -7687,21 +7687,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
*/
static int tg3_init_hw(struct tg3 *tp, int reset_phy)
{
int err;

/* Force the chip into D0. */
err = tg3_set_power_state(tp, PCI_D0);
if (err)
goto out;

tg3_switch_clocks(tp);

tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);

err = tg3_reset_hw(tp, reset_phy);

out:
return err;
return tg3_reset_hw(tp, reset_phy);
}

#define TG3_STAT_ADD32(PSTAT, REG) \
Expand Down Expand Up @@ -8016,13 +8006,11 @@ static int tg3_open(struct net_device *dev)

netif_carrier_off(tp->dev);

tg3_full_lock(tp, 0);

err = tg3_set_power_state(tp, PCI_D0);
if (err) {
tg3_full_unlock(tp);
if (err)
return err;
}

tg3_full_lock(tp, 0);

tg3_disable_ints(tp);
tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
Expand Down
4 changes: 1 addition & 3 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ struct wireless_dev;
#define NET_XMIT_DROP 1 /* skb dropped */
#define NET_XMIT_CN 2 /* congestion notification */
#define NET_XMIT_POLICED 3 /* skb is shot by police */
#define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue;
(TC use only - dev_queue_xmit
returns this as NET_XMIT_SUCCESS) */
#define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */

/* Backlog congestion levels */
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
Expand Down
12 changes: 1 addition & 11 deletions trunk/include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,7 @@ static inline int dst_output(struct sk_buff *skb)
/* Input packet from network to transport. */
static inline int dst_input(struct sk_buff *skb)
{
int err;

for (;;) {
err = skb->dst->input(skb);

if (likely(err == 0))
return err;
/* Oh, Jamal... Seems, I will not forgive you this mess. :-) */
if (unlikely(err != NET_XMIT_BYPASS))
return err;
}
return skb->dst->input(skb);
}

static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
Expand Down
1 change: 0 additions & 1 deletion trunk/include/net/flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ struct flowi {
#define fl4_scope nl_u.ip4_u.scope

__u8 proto;
__u8 flags;
union {
struct {
__be16 sport;
Expand Down
14 changes: 13 additions & 1 deletion trunk/include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
return qdisc_skb_cb(skb)->pkt_len;
}

/* additional qdisc xmit flags (NET_XMIT_MASK in linux/netdevice.h) */
enum net_xmit_qdisc_t {
__NET_XMIT_STOLEN = 0x00010000,
__NET_XMIT_BYPASS = 0x00020000,
};

#ifdef CONFIG_NET_CLS_ACT
#define net_xmit_drop_count(e) ((e) & __NET_XMIT_STOLEN ? 0 : 1)
#else
#define net_xmit_drop_count(e) (1)
#endif

static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
#ifdef CONFIG_NET_SCHED
Expand All @@ -355,7 +367,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
{
qdisc_skb_cb(skb)->pkt_len = skb->len;
return qdisc_enqueue(skb, sch);
return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
}

static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,7 @@ static inline void sctp_ssn_skip(struct sctp_stream *stream, __u16 id,
*/
struct sctp_af {
int (*sctp_xmit) (struct sk_buff *skb,
struct sctp_transport *,
int ipfragok);
struct sctp_transport *);
int (*setsockopt) (struct sock *sk,
int level,
int optname,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bridge/br_netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void br_netfilter_rtable_init(struct net_bridge *br)
struct rtable *rt = &br->fake_rtable;

atomic_set(&rt->u.dst.__refcnt, 1);
rt->u.dst.dev = &br->dev;
rt->u.dst.dev = br->dev;
rt->u.dst.path = &rt->u.dst;
rt->u.dst.metrics[RTAX_MTU - 1] = 1500;
rt->u.dst.flags = DST_NOXFRM;
Expand Down
24 changes: 16 additions & 8 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,6 @@ int dev_queue_xmit(struct sk_buff *skb)

spin_unlock(root_lock);

rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
goto out;
}

Expand Down Expand Up @@ -1909,7 +1908,6 @@ int netif_rx(struct sk_buff *skb)
if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {
if (queue->input_pkt_queue.qlen) {
enqueue:
dev_hold(skb->dev);
__skb_queue_tail(&queue->input_pkt_queue, skb);
local_irq_restore(flags);
return NET_RX_SUCCESS;
Expand Down Expand Up @@ -2270,6 +2268,20 @@ int netif_receive_skb(struct sk_buff *skb)
return ret;
}

/* Network device is going away, flush any packets still pending */
static void flush_backlog(void *arg)
{
struct net_device *dev = arg;
struct softnet_data *queue = &__get_cpu_var(softnet_data);
struct sk_buff *skb, *tmp;

skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp)
if (skb->dev == dev) {
__skb_unlink(skb, &queue->input_pkt_queue);
kfree_skb(skb);
}
}

static int process_backlog(struct napi_struct *napi, int quota)
{
int work = 0;
Expand All @@ -2279,7 +2291,6 @@ static int process_backlog(struct napi_struct *napi, int quota)
napi->weight = weight_p;
do {
struct sk_buff *skb;
struct net_device *dev;

local_irq_disable();
skb = __skb_dequeue(&queue->input_pkt_queue);
Expand All @@ -2288,14 +2299,9 @@ static int process_backlog(struct napi_struct *napi, int quota)
local_irq_enable();
break;
}

local_irq_enable();

dev = skb->dev;

netif_receive_skb(skb);

dev_put(dev);
} while (++work < quota && jiffies == start_time);

return work;
Expand Down Expand Up @@ -4169,6 +4175,8 @@ void netdev_run_todo(void)

dev->reg_state = NETREG_UNREGISTERED;

on_each_cpu(flush_backlog, dev, 1);

netdev_wait_allrefs(dev);

/* paranoia */
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/ip6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
skb->mark = sk->sk_mark;

mtu = dst_mtu(dst);
if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) {
if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) {
IP6_INC_STATS(ip6_dst_idev(skb->dst),
IPSTATS_MIB_OUTREQUESTS);
return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
Expand Down
2 changes: 2 additions & 0 deletions trunk/net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
*/
if (optlen == 0)
optval = NULL;
else if (optval == NULL)
goto e_inval;
else if (optlen < sizeof(struct ipv6_opt_hdr) ||
optlen & 0x7 || optlen > 8 * 255)
goto e_inval;
Expand Down
22 changes: 11 additions & 11 deletions trunk/net/ipv6/syncookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq6 = inet6_rsk(req);
treq = tcp_rsk(req);

if (security_inet_conn_request(sk, skb, req)) {
reqsk_free(req);
goto out;
}
if (security_inet_conn_request(sk, skb, req))
goto out_free;

req->mss = mss;
ireq->rmt_port = th->source;
Expand Down Expand Up @@ -255,14 +253,13 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
fl.fl_ip_sport = inet_sk(sk)->sport;
security_req_classify_flow(req, &fl);
if (ip6_dst_lookup(sk, &dst, &fl)) {
reqsk_free(req);
goto out;
}
if (ip6_dst_lookup(sk, &dst, &fl))
goto out_free;

if (final_p)
ipv6_addr_copy(&fl.fl6_dst, final_p);
if ((xfrm_lookup(&dst, &fl, sk, 0)) < 0)
goto out;
goto out_free;
}

req->window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);
Expand All @@ -273,7 +270,10 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq->rcv_wscale = rcv_wscale;

ret = get_cookie_sock(sk, skb, req, dst);

out: return ret;
out:
return ret;
out_free:
reqsk_free(req);
return NULL;
}

14 changes: 8 additions & 6 deletions trunk/net/sched/sch_atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
kfree_skb(skb);
return NET_XMIT_SUCCESS;
return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
kfree_skb(skb);
goto drop;
Expand All @@ -432,9 +432,11 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
ret = qdisc_enqueue(skb, flow->q);
if (ret != 0) {
drop: __maybe_unused
sch->qstats.drops++;
if (flow)
flow->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
if (flow)
flow->qstats.drops++;
}
return ret;
}
sch->bstats.bytes += qdisc_pkt_len(skb);
Expand All @@ -455,7 +457,7 @@ drop: __maybe_unused
return 0;
}
tasklet_schedule(&p->task);
return NET_XMIT_BYPASS;
return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
}

/*
Expand Down Expand Up @@ -530,7 +532,7 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch)
if (!ret) {
sch->q.qlen++;
sch->qstats.requeues++;
} else {
} else if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
p->link.qstats.drops++;
}
Expand Down
27 changes: 17 additions & 10 deletions trunk/net/sched/sch_cbq.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
(cl = cbq_class_lookup(q, prio)) != NULL)
return cl;

*qerr = NET_XMIT_BYPASS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
for (;;) {
int result = 0;
defmap = head->defaults;
Expand All @@ -256,7 +256,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
switch (result) {
case TC_ACT_QUEUED:
case TC_ACT_STOLEN:
*qerr = NET_XMIT_SUCCESS;
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
case TC_ACT_SHOT:
return NULL;
case TC_ACT_RECLASSIFY:
Expand Down Expand Up @@ -377,7 +377,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
q->rx_class = cl;
#endif
if (cl == NULL) {
if (ret == NET_XMIT_BYPASS)
if (ret & __NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
Expand All @@ -397,9 +397,11 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
return ret;
}

sch->qstats.drops++;
cbq_mark_toplevel(q, cl);
cl->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
cbq_mark_toplevel(q, cl);
cl->qstats.drops++;
}
return ret;
}

Expand Down Expand Up @@ -430,8 +432,10 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
cbq_activate_class(cl);
return 0;
}
sch->qstats.drops++;
cl->qstats.drops++;
if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
cl->qstats.drops++;
}
return ret;
}

Expand Down Expand Up @@ -664,21 +668,24 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
q->rx_class = NULL;

if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) {
int ret;

cbq_mark_toplevel(q, cl);

q->rx_class = cl;
cl->q->__parent = sch;

if (qdisc_enqueue(skb, cl->q) == 0) {
ret = qdisc_enqueue(skb, cl->q);
if (ret == NET_XMIT_SUCCESS) {
sch->q.qlen++;
sch->bstats.packets++;
sch->bstats.bytes += qdisc_pkt_len(skb);
if (!cl->next_alive)
cbq_activate_class(cl);
return 0;
}
sch->qstats.drops++;
if (net_xmit_drop_count(ret))
sch->qstats.drops++;
return 0;
}

Expand Down
Loading

0 comments on commit bd2de47

Please sign in to comment.