Skip to content

Commit

Permalink
[NET]: Kill skb->real_dev
Browse files Browse the repository at this point in the history
Bonding just wants the device before the skb_bond()
decapsulation occurs, so simply pass that original
device into packet_type->func() as an argument.

It remains to be seen whether we can use this same
exact thing to get rid of skb->input_dev as well.

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 authored and David S. Miller committed Aug 29, 2005
1 parent b6b99eb commit f2ccd8f
Show file tree
Hide file tree
Showing 45 changed files with 96 additions and 91 deletions.
2 changes: 1 addition & 1 deletion drivers/block/aoe/aoenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ aoenet_xmit(struct sk_buff *sl)
* (1) len doesn't include the header by default. I want this.
*/
static int
aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt)
aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, struct net_device *orig_dev)
{
struct aoe_hdr *h;
u32 n;
Expand Down
11 changes: 4 additions & 7 deletions drivers/net/bonding/bond_3ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -2419,22 +2419,19 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
return 0;
}

int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype)
int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev)
{
struct bonding *bond = dev->priv;
struct slave *slave = NULL;
int ret = NET_RX_DROP;

if (!(dev->flags & IFF_MASTER)) {
if (!(dev->flags & IFF_MASTER))
goto out;
}

read_lock(&bond->lock);
slave = bond_get_slave_by_dev((struct bonding *)dev->priv,
skb->real_dev);
if (slave == NULL) {
slave = bond_get_slave_by_dev((struct bonding *)dev->priv, orig_dev);
if (!slave)
goto out_unlock;
}

bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_3ad.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,6 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave);
void bond_3ad_handle_link_change(struct slave *slave, char link);
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype);
int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type* ptype, struct net_device *orig_dev);
#endif //__BOND_3AD_H__

5 changes: 2 additions & 3 deletions drivers/net/bonding/bond_alb.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,14 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
_unlock_rx_hashtbl(bond);
}

static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct packet_type *ptype)
static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct packet_type *ptype, struct net_device *orig_dev)
{
struct bonding *bond = bond_dev->priv;
struct arp_pkt *arp = (struct arp_pkt *)skb->data;
int res = NET_RX_DROP;

if (!(bond_dev->flags & IFF_MASTER)) {
if (!(bond_dev->flags & IFF_MASTER))
goto out;
}

if (!arp) {
dprintk("Packet has no ARP data\n");
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/hamradio/bpqether.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};

static char bpq_eth_addr[6];

static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *);
static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
static int bpq_device_event(struct notifier_block *, unsigned long, void *);
static const char *bpq_print_ethaddr(const unsigned char *);

Expand Down Expand Up @@ -165,7 +165,7 @@ static inline int dev_is_ethdev(struct net_device *dev)
/*
* Receive an AX.25 frame via an ethernet interface.
*/
static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev)
{
int len;
char * ptr;
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
***********************************************************************/
static int pppoe_rcv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt)
struct packet_type *pt,
struct net_device *orig_dev)

{
struct pppoe_hdr *ph;
Expand Down Expand Up @@ -426,7 +427,8 @@ static int pppoe_rcv(struct sk_buff *skb,
***********************************************************************/
static int pppoe_disc_rcv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt)
struct packet_type *pt,
struct net_device *orig_dev)

{
struct pppoe_hdr *ph;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wan/hdlc_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static struct net_device_stats *hdlc_get_stats(struct net_device *dev)


static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *p)
struct packet_type *p, struct net_device *orig_dev)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
if (hdlc->proto.netif_rx)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wan/lapbether.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static __inline__ int dev_is_ethdev(struct net_device *dev)
/*
* Receive a LAPB frame via an ethernet interface.
*/
static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev)
{
int len, err;
struct lapbethdev *lapbeth;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wan/syncppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ static void sppp_print_bytes (u_char *p, u16 len)
* after interrupt servicing to process frames queued via netif_rx.
*/

static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p)
static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev)
{
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
return NET_RX_DROP;
Expand Down
1 change: 0 additions & 1 deletion include/linux/if_vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
{
struct net_device_stats *stats;

skb->real_dev = skb->dev;
skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
if (skb->dev == NULL) {
dev_kfree_skb_any(skb);
Expand Down
10 changes: 6 additions & 4 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,12 @@ static inline void *netdev_priv(struct net_device *dev)
#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev))

struct packet_type {
__be16 type; /* This is really htons(ether_type). */
struct net_device *dev; /* NULL is wildcarded here */
int (*func) (struct sk_buff *, struct net_device *,
struct packet_type *);
__be16 type; /* This is really htons(ether_type). */
struct net_device *dev; /* NULL is wildcarded here */
int (*func) (struct sk_buff *,
struct net_device *,
struct packet_type *,
struct net_device *);
void *af_packet_priv;
struct list_head list;
};
Expand Down
2 changes: 0 additions & 2 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ struct skb_shared_info {
* @stamp: Time we arrived
* @dev: Device we arrived on/are leaving by
* @input_dev: Device we arrived on
* @real_dev: The real device we are using
* @h: Transport layer header
* @nh: Network layer header
* @mac: Link layer header
Expand Down Expand Up @@ -206,7 +205,6 @@ struct sk_buff {
struct timeval stamp;
struct net_device *dev;
struct net_device *input_dev;
struct net_device *real_dev;

union {
struct tcphdr *th;
Expand Down
2 changes: 1 addition & 1 deletion include/net/arp.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern struct neigh_table arp_tbl;

extern void arp_init(void);
extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
struct packet_type *pt, struct net_device *orig_dev);
extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
extern int arp_ioctl(unsigned int cmd, void __user *arg);
extern void arp_send(int type, int ptype, u32 dest_ip,
Expand Down
2 changes: 1 addition & 1 deletion include/net/ax25.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ extern int ax25_protocol_is_registered(unsigned int);

/* ax25_in.c */
extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *);
extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);

/* ax25_ip.c */
extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int);
Expand Down
2 changes: 1 addition & 1 deletion include/net/datalink.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct datalink_proto {
unsigned short header_length;

int (*rcvfunc)(struct sk_buff *, struct net_device *,
struct packet_type *);
struct packet_type *, struct net_device *);
int (*request)(struct datalink_proto *, struct sk_buff *,
unsigned char *);
struct list_head node;
Expand Down
2 changes: 1 addition & 1 deletion include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
u32 saddr, u32 daddr,
struct ip_options *opt);
extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
struct packet_type *pt, struct net_device *orig_dev);
extern int ip_local_deliver(struct sk_buff *skb);
extern int ip_mr_input(struct sk_buff *skb);
extern int ip_output(struct sk_buff *skb);
Expand Down
3 changes: 2 additions & 1 deletion include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ static inline int ipv6_addr_any(const struct in6_addr *a)

extern int ipv6_rcv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt);
struct packet_type *pt,
struct net_device *orig_dev);

/*
* upper-layer output functions
Expand Down
8 changes: 5 additions & 3 deletions include/net/llc.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ struct llc_sap {
unsigned char f_bit;
int (*rcv_func)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt);
struct packet_type *pt,
struct net_device *orig_dev);
struct llc_addr laddr;
struct list_head node;
struct {
Expand All @@ -64,7 +65,7 @@ extern rwlock_t llc_sap_list_lock;
extern unsigned char llc_station_mac_sa[ETH_ALEN];

extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
struct packet_type *pt, struct net_device *orig_dev);

extern int llc_mac_hdr_init(struct sk_buff *skb,
unsigned char *sa, unsigned char *da);
Expand All @@ -78,7 +79,8 @@ extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
extern struct llc_sap *llc_sap_open(unsigned char lsap,
int (*rcv)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt));
struct packet_type *pt,
struct net_device *orig_dev));
extern void llc_sap_close(struct llc_sap *sap);

extern struct llc_sap *llc_sap_find(unsigned char sap_value);
Expand Down
3 changes: 2 additions & 1 deletion include/net/p8022.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ extern struct datalink_proto *
register_8022_client(unsigned char type,
int (*func)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt));
struct packet_type *pt,
struct net_device *orig_dev));
extern void unregister_8022_client(struct datalink_proto *proto);

#endif
2 changes: 1 addition & 1 deletion include/net/psnap.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _NET_PSNAP_H
#define _NET_PSNAP_H

extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *));
extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *orig_dev));
extern void unregister_snap_client(struct datalink_proto *proto);

#endif
2 changes: 1 addition & 1 deletion include/net/x25.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ extern void x25_kill_by_neigh(struct x25_neigh *);

/* x25_dev.c */
extern void x25_send_frame(struct sk_buff *, struct x25_neigh *);
extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *);
extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
extern void x25_establish_link(struct x25_neigh *);
extern void x25_terminate_link(struct x25_neigh *);

Expand Down
3 changes: 2 additions & 1 deletion net/802/p8022.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
struct datalink_proto *register_8022_client(unsigned char type,
int (*func)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt))
struct packet_type *pt,
struct net_device *orig_dev))
{
struct datalink_proto *proto;

Expand Down
7 changes: 4 additions & 3 deletions net/802/psnap.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static struct datalink_proto *find_snap_client(unsigned char *desc)
* A SNAP packet has arrived
*/
static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt)
struct packet_type *pt, struct net_device *orig_dev)
{
int rc = 1;
struct datalink_proto *proto;
Expand All @@ -61,7 +61,7 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
/* Pass the frame on. */
skb->h.raw += 5;
skb_pull(skb, 5);
rc = proto->rcvfunc(skb, dev, &snap_packet_type);
rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
} else {
skb->sk = NULL;
kfree_skb(skb);
Expand Down Expand Up @@ -118,7 +118,8 @@ module_exit(snap_exit);
struct datalink_proto *register_snap_client(unsigned char *desc,
int (*rcvfunc)(struct sk_buff *,
struct net_device *,
struct packet_type *))
struct packet_type *,
struct net_device *))
{
struct datalink_proto *proto = NULL;

Expand Down
2 changes: 1 addition & 1 deletion net/8021q/vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct net_device *__find_vlan_dev(struct net_device* real_dev,
/* found in vlan_dev.c */
int vlan_dev_rebuild_header(struct sk_buff *skb);
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
struct packet_type* ptype);
struct packet_type *ptype, struct net_device *orig_dev);
int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr, void *saddr,
unsigned len);
Expand Down
2 changes: 1 addition & 1 deletion net/8021q/vlan_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
*
*/
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
struct packet_type* ptype)
struct packet_type* ptype, struct net_device *orig_dev)
{
unsigned char *rawp = NULL;
struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data);
Expand Down
2 changes: 1 addition & 1 deletion net/appletalk/aarp.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a,
* frame. We currently only support Ethernet.
*/
static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt)
struct packet_type *pt, struct net_device *orig_dev)
{
struct elapaarp *ea = aarp_hdr(skb);
int hash, ret = 0;
Expand Down
6 changes: 3 additions & 3 deletions net/appletalk/ddp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
* [ie ARPHRD_ETHERTALK]
*/
static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt)
struct packet_type *pt, struct net_device *orig_dev)
{
struct ddpehdr *ddp;
struct sock *sock;
Expand Down Expand Up @@ -1482,7 +1482,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
* header and append a long one.
*/
static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt)
struct packet_type *pt, struct net_device *orig_dev)
{
/* Expand any short form frames */
if (skb->mac.raw[2] == 1) {
Expand Down Expand Up @@ -1528,7 +1528,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
}
skb->h.raw = skb->data;

return atalk_rcv(skb, dev, pt);
return atalk_rcv(skb, dev, pt, orig_dev);
freeit:
kfree_skb(skb);
return 0;
Expand Down
8 changes: 4 additions & 4 deletions net/ax25/ax25_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
skb->dev = ax25->ax25_dev->dev;
skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_IP);
ip_rcv(skb, skb->dev, NULL); /* Wrong ptype */
ip_rcv(skb, skb->dev, NULL, skb->dev); /* Wrong ptype */
return 1;
}
#endif
Expand Down Expand Up @@ -258,7 +258,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
skb->dev = dev;
skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_IP);
ip_rcv(skb, dev, ptype); /* Note ptype here is the wrong one, fix me later */
ip_rcv(skb, dev, ptype, dev); /* Note ptype here is the wrong one, fix me later */
break;

case AX25_P_ARP:
Expand All @@ -268,7 +268,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
skb->dev = dev;
skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_ARP);
arp_rcv(skb, dev, ptype); /* Note ptype here is wrong... */
arp_rcv(skb, dev, ptype, dev); /* Note ptype here is wrong... */
break;
#endif
case AX25_P_TEXT:
Expand Down Expand Up @@ -454,7 +454,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
* Receive an AX.25 frame via a SLIP interface.
*/
int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype)
struct packet_type *ptype, struct net_device *orig_dev)
{
skb->sk = NULL; /* Initially we don't know who it's for */
skb->destructor = NULL; /* Who initializes this, dammit?! */
Expand Down
Loading

0 comments on commit f2ccd8f

Please sign in to comment.