This is part of mission skb diet.
Against git/davem/2.6.14 that was on vger 30 minutes back: It changes
input_dev to be an ifindex so we dont bother holding devices.
Would only cut a 4 byte fat on 64 bit machines.
Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>
cheers,
jamal
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -163,7 +163,7 @@ struct skb_shared_info {
* @sk: Socket we are owned by
* @stamp: Time we arrived
* @dev: Device we arrived on/are leaving by
- * @input_dev: Device we arrived on
+ * @input_dev: index of device we arrived on
* @real_dev: The real device we are using
* @h: Transport layer header
* @nh: Network layer header
@@ -205,7 +205,6 @@ struct sk_buff {
struct sock *sk;
struct timeval stamp;
struct net_device *dev;
- struct net_device *input_dev;
struct net_device *real_dev;
union {
@@ -231,7 +230,7 @@ struct sk_buff {
struct dst_entry *dst;
struct sec_path *sp;
-
+ int input_dev;
/*
* This is the control buffer. It is free to use for every
* layer. Please put your private variables there. If you
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -352,10 +352,13 @@ tcf_change_indev(struct tcf_proto *tp, c
static inline int
tcf_match_indev(struct sk_buff *skb, char *indev)
{
+
+ struct net_device *dev = __dev_get_by_index(skb->input_dev);
+
if (0 != indev[0]) {
- if (NULL == skb->input_dev)
+ if (NULL == dev)
return 0;
- else if (0 != strcmp(indev, skb->input_dev->name))
+ else if (0 != strcmp(indev, dev->name))
return 0;
}
diff --git a/include/net/x25device.h b/include/net/x25device.h
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -8,7 +8,8 @@
static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
{
skb->mac.raw = skb->data;
- skb->input_dev = skb->dev = dev;
+ skb->input_dev = skb->dev;
+ skb->input_dev = skb->dev->ifindex;
skb->pkt_type = PACKET_HOST;
return htons(ETH_P_X25);
diff --git a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1534,17 +1534,17 @@ static int ing_filter(struct sk_buff *sk
if (dev->qdisc_ingress) {
__u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
if (MAX_RED_LOOP < ttl++) {
- printk("Redir loop detected Dropping packet (%s->%s)\n",
- skb->input_dev?skb->input_dev->name:"??",skb->dev->name);
+ printk("Redir loop detected Dropping packet (%d->%s)\n",
+ skb->input_dev,skb->dev->name);
return TC_ACT_SHOT;
}
skb->tc_verd = SET_TC_RTTL(skb->tc_verd,ttl);
skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS);
- if (NULL == skb->input_dev) {
- skb->input_dev = skb->dev;
- printk("ing_filter: fixed %s out %s\n",skb->input_dev->name,skb->dev->name);
+ if (!skb->input_dev) {
+ skb->input_dev = skb->dev->ifindex;
+ printk("ing_filter: Repaired input to %s \n",skb->dev->name);
}
spin_lock(&dev->ingress_lock);
if ((q = dev->qdisc_ingress) != NULL)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -163,7 +163,7 @@ __be16 eth_type_trans(struct sk_buff *sk
skb->mac.raw=skb->data;
skb_pull(skb,ETH_HLEN);
eth = eth_hdr(skb);
- skb->input_dev = dev;
+ skb->input_dev = dev->ifindex;
if(*eth->h_dest&1)
{
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -156,9 +156,8 @@ int tcf_action_exec(struct sk_buff *skb,
if (skb->tc_verd & TC_NCLS) {
skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
- D2PRINTK("(%p)tcf_action_exec: cleared TC_NCLS in %s out %s\n",
- skb, skb->input_dev ? skb->input_dev->name : "xxx",
- skb->dev->name);
+ D2PRINTK("(%p)tcf_action_exec: cleared TC_NCLS in %d out %s\n",
+ skb, skb->input_dev, skb->dev->name);
ret = TC_ACT_OK;
goto exec_done;
}
diff --git a/net/sched/mirred.c b/net/sched/mirred.c
--- a/net/sched/mirred.c
+++ b/net/sched/mirred.c
@@ -208,7 +208,7 @@ bad_mirred:
skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
skb2->dev = dev;
- skb2->input_dev = skb->dev;
+ skb2->input_dev = skb->dev->ifindex;
dev_queue_xmit(skb2);
spin_unlock(&p->lock);
return p->action;