Commit 4c744fb0 authored by David S. Miller's avatar David S. Miller

[NET]: Delete support for old-style protocols, no longer necessary.

parent 609c0d95
......@@ -888,7 +888,6 @@ rlb_initialize(struct bonding *bond)
pk_type->type = __constant_htons(ETH_P_ARP);
pk_type->dev = bond->device;
pk_type->func = rlb_arp_recv;
pk_type->data = PKT_CAN_SHARE_SKB;
dev_add_pack(pk_type);
......
......@@ -955,7 +955,6 @@ static void bond_register_lacpdu(struct bonding *bond)
pk_type->type = PKT_TYPE_LACPDU;
pk_type->dev = bond->device;
pk_type->func = bond_3ad_lacpdu_recv;
pk_type->data = PKT_CAN_SHARE_SKB;
dev_add_pack(pk_type);
}
......
......@@ -105,7 +105,6 @@ static const char *bpq_print_ethaddr(const unsigned char *);
static struct packet_type bpq_packet_type = {
.type = __constant_htons(ETH_P_BPQ),
.func = bpq_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct notifier_block bpq_dev_notifier = {
......
......@@ -468,13 +468,11 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
static struct packet_type pppoes_ptype = {
.type = __constant_htons(ETH_P_PPP_SES),
.func = pppoe_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct packet_type pppoed_ptype = {
.type = __constant_htons(ETH_P_PPP_DISC),
.func = pppoe_disc_rcv,
.data = PKT_CAN_SHARE_SKB,
};
/***********************************************************************
......
......@@ -279,11 +279,9 @@ EXPORT_SYMBOL(hdlc_ioctl);
EXPORT_SYMBOL(register_hdlc_device);
EXPORT_SYMBOL(unregister_hdlc_device);
static struct packet_type hdlc_packet_type =
{
static struct packet_type hdlc_packet_type = {
.type = __constant_htons(ETH_P_HDLC),
.func = hdlc_rcv,
.data = PKT_CAN_SHARE_SKB,
};
......
......@@ -438,7 +438,6 @@ static int lapbeth_device_event(struct notifier_block *this,
static struct packet_type lapbeth_packet_type = {
.type = __constant_htons(ETH_P_DEC),
.func = lapbeth_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct notifier_block lapbeth_dev_notifier = {
......
......@@ -1455,7 +1455,6 @@ static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_t
struct packet_type sppp_packet_type = {
.type = __constant_htons(ETH_P_WAN_PPP),
.func = sppp_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static char banner[] __initdata =
......
......@@ -477,15 +477,12 @@ struct net_device
*/
#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev))
#define PKT_CAN_SHARE_SKB ((void*)1)
struct packet_type
{
struct packet_type {
unsigned short 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 *);
void *data; /* Private to the packet type */
void *af_packet_priv;
struct list_head list;
};
......
......@@ -67,7 +67,6 @@ unsigned short vlan_default_dev_flags = 1;
static struct packet_type vlan_packet_type = {
.type = __constant_htons(ETH_P_8021Q),
.func = vlan_skb_recv, /* VLAN receive method */
.data = PKT_CAN_SHARE_SKB,
};
/* End of global variables definitions. */
......
......@@ -1872,13 +1872,11 @@ static struct notifier_block ddp_notifier = {
struct packet_type ltalk_packet_type = {
.type = __constant_htons(ETH_P_LOCALTALK),
.func = ltalk_rcv,
.data = PKT_CAN_SHARE_SKB,
};
struct packet_type ppptalk_packet_type = {
.type = __constant_htons(ETH_P_PPPTALK),
.func = atalk_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B };
......
......@@ -1978,7 +1978,6 @@ static struct packet_type ax25_packet_type = {
.type = __constant_htons(ETH_P_AX25),
.dev = NULL, /* All devices */
.func = ax25_kiss_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct notifier_block ax25_dev_notifier = {
......
......@@ -229,8 +229,7 @@ void dev_add_pack(struct packet_type *pt)
spin_lock_bh(&ptype_lock);
#ifdef CONFIG_NET_FASTROUTE
/* Hack to detect packet socket */
if (pt->data && pt->data != PKT_CAN_SHARE_SKB) {
if (pt->af_packet_priv) {
netdev_fastroute_obstacles++;
dev_clear_fastroute(pt->dev);
}
......@@ -278,7 +277,7 @@ void __dev_remove_pack(struct packet_type *pt)
list_for_each_entry(pt1, head, list) {
if (pt == pt1) {
#ifdef CONFIG_NET_FASTROUTE
if (pt->data && pt->data != PKT_CAN_SHARE_SKB)
if (pt->af_packet_priv)
netdev_fastroute_obstacles--;
#endif
list_del_rcu(&pt->list);
......@@ -943,7 +942,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
* they originated from - MvS (miquels@drinkel.ow.org)
*/
if ((ptype->dev == dev || !ptype->dev) &&
(struct sock *)ptype->data != skb->sk) {
(struct sock *)ptype->af_packet_priv != skb->sk) {
struct sk_buff *skb2= skb_clone(skb, GFP_ATOMIC);
if (!skb2)
break;
......@@ -1404,36 +1403,6 @@ int netif_rx(struct sk_buff *skb)
return NET_RX_DROP;
}
/* Deliver skb to an old protocol, which is not threaded well
or which do not understand shared skbs.
*/
static int deliver_to_old_ones(struct packet_type *pt,
struct sk_buff *skb, int last)
{
int ret = NET_RX_DROP;
if (!last) {
skb = skb_clone(skb, GFP_ATOMIC);
if (!skb)
goto out;
}
if (skb_is_nonlinear(skb) && __skb_linearize(skb, GFP_ATOMIC))
goto out_kfree;
#ifdef CONFIG_SMP
/* Old protocols did not depened on BHs different of NET_BH and
TIMER_BH - they need to be fixed for the new assumptions.
*/
print_symbol("fix old protocol handler %s!\n", (unsigned long)pt->func);
#endif
ret = pt->func(skb, skb->dev, pt);
out:
return ret;
out_kfree:
kfree_skb(skb);
goto out;
}
static __inline__ void skb_bond(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
......@@ -1493,12 +1462,8 @@ static void net_tx_action(struct softirq_action *h)
static __inline__ int deliver_skb(struct sk_buff *skb,
struct packet_type *pt_prev, int last)
{
if (unlikely(!pt_prev->data))
return deliver_to_old_ones(pt_prev, skb, last);
else {
atomic_inc(&skb->users);
return pt_prev->func(skb, skb->dev, pt_prev);
}
atomic_inc(&skb->users);
return pt_prev->func(skb, skb->dev, pt_prev);
}
......@@ -1579,11 +1544,7 @@ int netif_receive_skb(struct sk_buff *skb)
}
if (pt_prev) {
if (!pt_prev->data) {
ret = deliver_to_old_ones(pt_prev, skb, 1);
} else {
ret = pt_prev->func(skb, skb->dev, pt_prev);
}
ret = pt_prev->func(skb, skb->dev, pt_prev);
} else {
kfree_skb(skb);
/* Jamal, now you will not able to escape explaining
......
......@@ -2081,7 +2081,6 @@ static struct packet_type dn_dix_packet_type = {
.type = __constant_htons(ETH_P_DNA_RT),
.dev = NULL, /* All devices */
.func = dn_route_rcv,
.data = PKT_CAN_SHARE_SKB,
};
#ifdef CONFIG_PROC_FS
......
......@@ -1052,7 +1052,6 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
static struct packet_type econet_packet_type = {
.type = __constant_htons(ETH_P_ECONET),
.func = econet_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static void econet_hw_initialise(void)
......
......@@ -1110,7 +1110,6 @@ void arp_ifdown(struct net_device *dev)
static struct packet_type arp_packet_type = {
.type = __constant_htons(ETH_P_ARP),
.func = arp_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static int arp_proc_init(void);
......
......@@ -1295,12 +1295,9 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
* IP protocol layer initialiser
*/
static struct packet_type ip_packet_type =
{
static struct packet_type ip_packet_type = {
.type = __constant_htons(ETH_P_IP),
.dev = NULL, /* All devices */
.func = ip_rcv,
.data = PKT_CAN_SHARE_SKB,
};
/*
......
......@@ -390,7 +390,6 @@ static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct pack
static struct packet_type rarp_packet_type __initdata = {
.type = __constant_htons(ETH_P_RARP),
.func = ic_rarp_recv,
.data = PKT_CAN_SHARE_SKB,
};
static inline void ic_rarp_init(void)
......@@ -553,7 +552,6 @@ static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct pac
static struct packet_type bootp_packet_type __initdata = {
.type = __constant_htons(ETH_P_IP),
.func = ic_bootp_recv,
.data = PKT_CAN_SHARE_SKB,
};
......
......@@ -57,12 +57,9 @@
DEFINE_SNMP_STAT(struct ipv6_mib, ipv6_statistics);
static struct packet_type ipv6_packet_type =
{
static struct packet_type ipv6_packet_type = {
.type = __constant_htons(ETH_P_IPV6),
.dev = NULL, /* All devices */
.func = ipv6_rcv,
.data = PKT_CAN_SHARE_SKB,
};
/*
......
......@@ -1920,13 +1920,11 @@ SOCKOPS_WRAP(ipx_dgram, PF_IPX);
static struct packet_type ipx_8023_packet_type = {
.type = __constant_htons(ETH_P_802_3),
.func = ipx_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct packet_type ipx_dix_packet_type = {
.type = __constant_htons(ETH_P_IPX),
.func = ipx_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct notifier_block ipx_dev_notifier = {
......
......@@ -187,13 +187,9 @@ __u32 irda_debug = IRDA_DEBUG_LEVEL;
/* Packet type handler.
* Tell the kernel how IrDA packets should be handled.
*/
static struct packet_type irda_packet_type =
{
static struct packet_type irda_packet_type = {
.type = __constant_htons(ETH_P_IRDA),
.dev = NULL, /* Wildcard : All devices */
.func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */
.data = PKT_CAN_SHARE_SKB,
//.next = NULL,
};
/*
......@@ -310,7 +306,6 @@ void __exit irda_cleanup(void)
#endif
/* Remove IrDA packet type (stop receiving packets) */
irda_packet_type.type = htons(ETH_P_IRDA);
dev_remove_pack(&irda_packet_type);
/* Stop receiving interfaces notifications */
......
......@@ -140,13 +140,11 @@ void llc_sap_close(struct llc_sap *sap)
static struct packet_type llc_packet_type = {
.type = __constant_htons(ETH_P_802_2),
.func = llc_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static struct packet_type llc_tr_packet_type = {
.type = __constant_htons(ETH_P_TR_802_2),
.func = llc_rcv,
.data = PKT_CAN_SHARE_SKB,
};
static int __init llc_init(void)
......
......@@ -227,7 +227,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct
* field for just this event.
*/
sk = (struct sock *) pt->data;
sk = pt->af_packet_priv;
/*
* Yank back the headers [hope the device set this
......@@ -422,7 +422,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
if (skb->pkt_type == PACKET_LOOPBACK)
goto drop;
sk = (struct sock *) pt->data;
sk = pt->af_packet_priv;
po = pkt_sk(sk);
skb->dev = dev;
......@@ -525,7 +525,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
if (skb->pkt_type == PACKET_LOOPBACK)
goto drop;
sk = (struct sock *) pt->data;
sk = pt->af_packet_priv;
po = pkt_sk(sk);
if (dev->hard_header) {
......@@ -973,7 +973,7 @@ static int packet_create(struct socket *sock, int protocol)
if (sock->type == SOCK_PACKET)
po->prot_hook.func = packet_rcv_spkt;
#endif
po->prot_hook.data = (void *)sk;
po->prot_hook.af_packet_priv = sk;
if (protocol) {
po->prot_hook.type = protocol;
......
......@@ -1345,7 +1345,6 @@ SOCKOPS_WRAP(x25_proto, AF_X25);
static struct packet_type x25_packet_type = {
.type = __constant_htons(ETH_P_X25),
.func = x25_lapb_receive_frame,
.data = PKT_CAN_SHARE_SKB,
};
struct notifier_block x25_dev_notifier = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment