net: convert usage of packet_type to read_mostly

Protocols that use packet_type can be __read_mostly section for better
locality. Elminate any unnecessary initializations of NULL.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stephen Hemminger 2009-03-09 08:18:29 +00:00 коммит произвёл David S. Miller
Родитель 3f612132c7
Коммит 7546dd97d2
21 изменённых файлов: 26 добавлений и 29 удалений

Просмотреть файл

@ -151,7 +151,7 @@ exit:
return 0; return 0;
} }
static struct packet_type aoe_pt = { static struct packet_type aoe_pt __read_mostly = {
.type = __constant_htons(ETH_P_AOE), .type = __constant_htons(ETH_P_AOE),
.func = aoenet_rcv, .func = aoenet_rcv,
}; };

Просмотреть файл

@ -97,7 +97,7 @@ static char bpq_eth_addr[6];
static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); 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 int bpq_device_event(struct notifier_block *, unsigned long, void *);
static struct packet_type bpq_packet_type = { static struct packet_type bpq_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_BPQ), .type = cpu_to_be16(ETH_P_BPQ),
.func = bpq_rcv, .func = bpq_rcv,
}; };

Просмотреть файл

@ -513,17 +513,17 @@ out:
return NET_RX_SUCCESS; /* Lies... :-) */ return NET_RX_SUCCESS; /* Lies... :-) */
} }
static struct packet_type pppoes_ptype = { static struct packet_type pppoes_ptype __read_mostly = {
.type = cpu_to_be16(ETH_P_PPP_SES), .type = cpu_to_be16(ETH_P_PPP_SES),
.func = pppoe_rcv, .func = pppoe_rcv,
}; };
static struct packet_type pppoed_ptype = { static struct packet_type pppoed_ptype __read_mostly = {
.type = cpu_to_be16(ETH_P_PPP_DISC), .type = cpu_to_be16(ETH_P_PPP_DISC),
.func = pppoe_disc_rcv, .func = pppoe_disc_rcv,
}; };
static struct proto pppoe_sk_proto = { static struct proto pppoe_sk_proto __read_mostly = {
.name = "PPPOE", .name = "PPPOE",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.obj_size = sizeof(struct pppox_sock), .obj_size = sizeof(struct pppox_sock),

Просмотреть файл

@ -348,7 +348,7 @@ EXPORT_SYMBOL(unregister_hdlc_protocol);
EXPORT_SYMBOL(attach_hdlc_protocol); EXPORT_SYMBOL(attach_hdlc_protocol);
EXPORT_SYMBOL(detach_hdlc_protocol); EXPORT_SYMBOL(detach_hdlc_protocol);
static struct packet_type hdlc_packet_type = { static struct packet_type hdlc_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_HDLC), .type = cpu_to_be16(ETH_P_HDLC),
.func = hdlc_rcv, .func = hdlc_rcv,
}; };

Просмотреть файл

@ -421,7 +421,7 @@ static int lapbeth_device_event(struct notifier_block *this,
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
static struct packet_type lapbeth_packet_type = { static struct packet_type lapbeth_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_DEC), .type = cpu_to_be16(ETH_P_DEC),
.func = lapbeth_rcv, .func = lapbeth_rcv,
}; };

Просмотреть файл

@ -51,7 +51,7 @@ const char vlan_version[] = DRV_VERSION;
static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
static struct packet_type vlan_packet_type = { static struct packet_type vlan_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_8021Q), .type = cpu_to_be16(ETH_P_8021Q),
.func = vlan_skb_recv, /* VLAN receive method */ .func = vlan_skb_recv, /* VLAN receive method */
}; };

Просмотреть файл

@ -1860,12 +1860,12 @@ static struct notifier_block ddp_notifier = {
.notifier_call = ddp_device_event, .notifier_call = ddp_device_event,
}; };
static struct packet_type ltalk_packet_type = { static struct packet_type ltalk_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_LOCALTALK), .type = cpu_to_be16(ETH_P_LOCALTALK),
.func = ltalk_rcv, .func = ltalk_rcv,
}; };
static struct packet_type ppptalk_packet_type = { static struct packet_type ppptalk_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_PPPTALK), .type = cpu_to_be16(ETH_P_PPPTALK),
.func = atalk_rcv, .func = atalk_rcv,
}; };

Просмотреть файл

@ -1985,9 +1985,8 @@ static const struct proto_ops ax25_proto_ops = {
/* /*
* Called by socket.c on kernel start up * Called by socket.c on kernel start up
*/ */
static struct packet_type ax25_packet_type = { static struct packet_type ax25_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_AX25), .type = cpu_to_be16(ETH_P_AX25),
.dev = NULL, /* All devices */
.func = ax25_kiss_rcv, .func = ax25_kiss_rcv,
}; };

Просмотреть файл

@ -2112,9 +2112,8 @@ static struct notifier_block dn_dev_notifier = {
extern int dn_route_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); extern int dn_route_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
static struct packet_type dn_dix_packet_type = { static struct packet_type dn_dix_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_DNA_RT), .type = cpu_to_be16(ETH_P_DNA_RT),
.dev = NULL, /* All devices */
.func = dn_route_rcv, .func = dn_route_rcv,
}; };

Просмотреть файл

@ -175,7 +175,7 @@ out:
return 0; return 0;
} }
static struct packet_type dsa_packet_type = { static struct packet_type dsa_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_DSA), .type = cpu_to_be16(ETH_P_DSA),
.func = dsa_rcv, .func = dsa_rcv,
}; };

Просмотреть файл

@ -194,7 +194,7 @@ out:
return 0; return 0;
} }
static struct packet_type edsa_packet_type = { static struct packet_type edsa_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_EDSA), .type = cpu_to_be16(ETH_P_EDSA),
.func = edsa_rcv, .func = edsa_rcv,
}; };

Просмотреть файл

@ -111,7 +111,7 @@ out:
return 0; return 0;
} }
static struct packet_type trailer_packet_type = { static struct packet_type trailer_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_TRAILER), .type = cpu_to_be16(ETH_P_TRAILER),
.func = trailer_rcv, .func = trailer_rcv,
}; };

Просмотреть файл

@ -1102,7 +1102,7 @@ drop:
return NET_RX_DROP; return NET_RX_DROP;
} }
static struct packet_type econet_packet_type = { static struct packet_type econet_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_ECONET), .type = cpu_to_be16(ETH_P_ECONET),
.func = econet_rcv, .func = econet_rcv,
}; };

Просмотреть файл

@ -1500,7 +1500,7 @@ static int ipv4_proc_init(void);
* IP protocol layer initialiser * IP protocol layer initialiser
*/ */
static struct packet_type ip_packet_type = { static struct packet_type ip_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_IP), .type = cpu_to_be16(ETH_P_IP),
.func = ip_rcv, .func = ip_rcv,
.gso_send_check = inet_gso_send_check, .gso_send_check = inet_gso_send_check,

Просмотреть файл

@ -1225,7 +1225,7 @@ void arp_ifdown(struct net_device *dev)
* Called once on startup. * Called once on startup.
*/ */
static struct packet_type arp_packet_type = { static struct packet_type arp_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_ARP), .type = cpu_to_be16(ETH_P_ARP),
.func = arp_rcv, .func = arp_rcv,
}; };

Просмотреть файл

@ -893,7 +893,7 @@ out_unlock:
return err; return err;
} }
static struct packet_type ipv6_packet_type = { static struct packet_type ipv6_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_IPV6), .type = cpu_to_be16(ETH_P_IPV6),
.func = ipv6_rcv, .func = ipv6_rcv,
.gso_send_check = ipv6_gso_send_check, .gso_send_check = ipv6_gso_send_check,

Просмотреть файл

@ -1958,12 +1958,12 @@ static const struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
SOCKOPS_WRAP(ipx_dgram, PF_IPX); SOCKOPS_WRAP(ipx_dgram, PF_IPX);
static struct packet_type ipx_8023_packet_type = { static struct packet_type ipx_8023_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_802_3), .type = cpu_to_be16(ETH_P_802_3),
.func = ipx_rcv, .func = ipx_rcv,
}; };
static struct packet_type ipx_dix_packet_type = { static struct packet_type ipx_dix_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_IPX), .type = cpu_to_be16(ETH_P_IPX),
.func = ipx_rcv, .func = ipx_rcv,
}; };

Просмотреть файл

@ -55,7 +55,7 @@ EXPORT_SYMBOL(irda_debug);
/* Packet type handler. /* Packet type handler.
* Tell the kernel how IrDA packets should be handled. * Tell the kernel how IrDA packets should be handled.
*/ */
static struct packet_type irda_packet_type = { static struct packet_type irda_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_IRDA), .type = cpu_to_be16(ETH_P_IRDA),
.func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */ .func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */
}; };

Просмотреть файл

@ -147,12 +147,12 @@ void llc_sap_close(struct llc_sap *sap)
kfree(sap); kfree(sap);
} }
static struct packet_type llc_packet_type = { static struct packet_type llc_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_802_2), .type = cpu_to_be16(ETH_P_802_2),
.func = llc_rcv, .func = llc_rcv,
}; };
static struct packet_type llc_tr_packet_type = { static struct packet_type llc_tr_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_TR_802_2), .type = cpu_to_be16(ETH_P_TR_802_2),
.func = llc_rcv, .func = llc_rcv,
}; };

Просмотреть файл

@ -382,9 +382,8 @@ out:
return NET_RX_DROP; return NET_RX_DROP;
} }
static struct packet_type phonet_packet_type = { static struct packet_type phonet_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_PHONET), .type = cpu_to_be16(ETH_P_PHONET),
.dev = NULL,
.func = phonet_rcv, .func = phonet_rcv,
}; };

Просмотреть файл

@ -1608,7 +1608,7 @@ static const struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = {
SOCKOPS_WRAP(x25_proto, AF_X25); SOCKOPS_WRAP(x25_proto, AF_X25);
static struct packet_type x25_packet_type = { static struct packet_type x25_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_X25), .type = cpu_to_be16(ETH_P_X25),
.func = x25_lapb_receive_frame, .func = x25_lapb_receive_frame,
}; };