From fd1dc88c2dec6d68d26ba7a9a7019c6acf08eba2 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 24 Sep 2003 14:09:36 -0700 Subject: [PATCH] [NET]: Add and use PKT_CAN_SHARE_SKB instead of (void *) 1. --- drivers/net/bonding/bond_alb.c | 2 +- drivers/net/bonding/bond_main.c | 2 +- drivers/net/pppoe.c | 4 ++-- drivers/net/wan/hdlc_generic.c | 2 +- drivers/net/wan/syncppp.c | 2 +- include/linux/netdevice.h | 1 + net/8021q/vlan.c | 2 +- net/appletalk/ddp.c | 4 ++-- net/ax25/af_ax25.c | 2 +- net/core/dev.c | 4 ++-- net/decnet/af_decnet.c | 2 +- net/ipv4/arp.c | 2 +- net/ipv4/ip_output.c | 2 +- net/ipv6/ipv6_sockglue.c | 2 +- net/ipx/af_ipx.c | 4 ++-- net/irda/irsyms.c | 2 +- net/llc/llc_core.c | 4 ++-- 17 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 284c405a8030..72a5866d0e10 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -888,7 +888,7 @@ 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 = (void*)1; /* understand shared skbs */ + pk_type->data = PKT_CAN_SHARE_SKB; dev_add_pack(pk_type); diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 949c58d469c7..dca5e1ebbff8 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -955,7 +955,7 @@ 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 = (void*)1; /* understand shared skbs */ + pk_type->data = PKT_CAN_SHARE_SKB; dev_add_pack(pk_type); } diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 0df17469de7b..564debfb0381 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c @@ -468,13 +468,13 @@ out: static struct packet_type pppoes_ptype = { .type = __constant_htons(ETH_P_PPP_SES), .func = pppoe_rcv, - .data = (void *)1, + .data = PKT_CAN_SHARE_SKB, }; static struct packet_type pppoed_ptype = { .type = __constant_htons(ETH_P_PPP_DISC), .func = pppoe_disc_rcv, - .data = (void *)1, + .data = PKT_CAN_SHARE_SKB, }; /*********************************************************************** diff --git a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c index f9f37fcb0df5..a587298a1db5 100644 --- a/drivers/net/wan/hdlc_generic.c +++ b/drivers/net/wan/hdlc_generic.c @@ -283,7 +283,7 @@ static struct packet_type hdlc_packet_type = { .type = __constant_htons(ETH_P_HDLC), .func = hdlc_rcv, - .data = (void *)1, + .data = PKT_CAN_SHARE_SKB, }; diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index d0925bee7f02..baaae34588c8 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c @@ -1454,7 +1454,7 @@ 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 = (void*)1, /* must be non-NULL to indicate 'new' protocol */ + .data = PKT_CAN_SHARE_SKB, }; static char banner[] __initdata = diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a69f0c920d20..1de1bb9b44d8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -477,6 +477,7 @@ struct net_device */ #define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) +#define PKT_CAN_SHARE_SKB ((void*)1) struct packet_type { diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 7efda3575e40..ed8f1c6dc2f7 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -67,7 +67,7 @@ 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 = (void *)1, /* understands shared skb */ + .data = PKT_CAN_SHARE_SKB, }; /* End of global variables definitions. */ diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 217244bd611d..23b5abec69ec 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1872,13 +1872,13 @@ static struct notifier_block ddp_notifier = { struct packet_type ltalk_packet_type = { .type = __constant_htons(ETH_P_LOCALTALK), .func = ltalk_rcv, - .data = (void *)1, + .data = PKT_CAN_SHARE_SKB, }; struct packet_type ppptalk_packet_type = { .type = __constant_htons(ETH_P_PPPTALK), .func = atalk_rcv, - .data = (void *)1, + .data = PKT_CAN_SHARE_SKB, }; static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B }; diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 43662ed9a619..620271283ff2 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1978,7 +1978,7 @@ static struct packet_type ax25_packet_type = { .type = __constant_htons(ETH_P_AX25), .dev = NULL, /* All devices */ .func = ax25_kiss_rcv, - .data = (void *) 1 + .data = PKT_CAN_SHARE_SKB, }; static struct notifier_block ax25_dev_notifier = { diff --git a/net/core/dev.c b/net/core/dev.c index bb0306ad62e9..d6f77d31f496 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -229,7 +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 && (long)(pt->data) != 1) { + if (pt->data && pt->data != PKT_CAN_SHARE_SKB) { netdev_fastroute_obstacles++; dev_clear_fastroute(pt->dev); } @@ -277,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) + if (pt->data && pt->data != PKT_CAN_SHARE_SKB) netdev_fastroute_obstacles--; #endif list_del_rcu(&pt->list); diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 13ce550e5101..edaafd620e99 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -2081,7 +2081,7 @@ static struct packet_type dn_dix_packet_type = { .type = __constant_htons(ETH_P_DNA_RT), .dev = NULL, /* All devices */ .func = dn_route_rcv, - .data = (void*)1, + .data = PKT_CAN_SHARE_SKB, }; #ifdef CONFIG_PROC_FS diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 8f2ee6148461..bfe4c406da3e 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1108,7 +1108,7 @@ void arp_ifdown(struct net_device *dev) static struct packet_type arp_packet_type = { .type = __constant_htons(ETH_P_ARP), .func = arp_rcv, - .data = (void*) 1, /* understand shared skbs */ + .data = PKT_CAN_SHARE_SKB, }; static int arp_proc_init(void); diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 6d6c10d3eabc..be54c3bcbf7c 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1299,7 +1299,7 @@ static struct packet_type ip_packet_type = .type = __constant_htons(ETH_P_IP), .dev = NULL, /* All devices */ .func = ip_rcv, - .data = (void*)1, + .data = PKT_CAN_SHARE_SKB, }; /* diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 271cb34b316c..012af38b28b7 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -62,7 +62,7 @@ static struct packet_type ipv6_packet_type = .type = __constant_htons(ETH_P_IPV6), .dev = NULL, /* All devices */ .func = ipv6_rcv, - .data = (void*)1, + .data = PKT_CAN_SHARE_SKB, }; /* diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 8c9091ede27d..864b32339fce 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -1920,13 +1920,13 @@ 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 = (void *)1, /* yap, I understand shared skbs :-) */ + .data = PKT_CAN_SHARE_SKB, }; static struct packet_type ipx_dix_packet_type = { .type = __constant_htons(ETH_P_IPX), .func = ipx_rcv, - .data = (void *)1, /* yap, I understand shared skbs :-) */ + .data = PKT_CAN_SHARE_SKB, }; static struct notifier_block ipx_dev_notifier = { diff --git a/net/irda/irsyms.c b/net/irda/irsyms.c index 54def7ead679..58e30e53e0e0 100644 --- a/net/irda/irsyms.c +++ b/net/irda/irsyms.c @@ -191,7 +191,7 @@ 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 = (void*) 1, /* Understand shared skbs */ + .data = PKT_CAN_SHARE_SKB, //.next = NULL, }; diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c index d0f9262505b0..06edb66c17ed 100644 --- a/net/llc/llc_core.c +++ b/net/llc/llc_core.c @@ -140,13 +140,13 @@ 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 = (void *)1, + .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 = (void *)1, + .data = PKT_CAN_SHARE_SKB, }; static int __init llc_init(void) -- 2.47.3