Commit 7546dd97d27306d939c13e03318aae695badaa88

Authored by Stephen Hemminger
Committed by David S. Miller
1 parent 3f612132c7

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>

Showing 21 changed files with 26 additions and 29 deletions Side-by-side Diff

drivers/block/aoe/aoenet.c
... ... @@ -151,7 +151,7 @@
151 151 return 0;
152 152 }
153 153  
154   -static struct packet_type aoe_pt = {
  154 +static struct packet_type aoe_pt __read_mostly = {
155 155 .type = __constant_htons(ETH_P_AOE),
156 156 .func = aoenet_rcv,
157 157 };
drivers/net/hamradio/bpqether.c
... ... @@ -97,7 +97,7 @@
97 97 static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
98 98 static int bpq_device_event(struct notifier_block *, unsigned long, void *);
99 99  
100   -static struct packet_type bpq_packet_type = {
  100 +static struct packet_type bpq_packet_type __read_mostly = {
101 101 .type = cpu_to_be16(ETH_P_BPQ),
102 102 .func = bpq_rcv,
103 103 };
... ... @@ -513,17 +513,17 @@
513 513 return NET_RX_SUCCESS; /* Lies... :-) */
514 514 }
515 515  
516   -static struct packet_type pppoes_ptype = {
  516 +static struct packet_type pppoes_ptype __read_mostly = {
517 517 .type = cpu_to_be16(ETH_P_PPP_SES),
518 518 .func = pppoe_rcv,
519 519 };
520 520  
521   -static struct packet_type pppoed_ptype = {
  521 +static struct packet_type pppoed_ptype __read_mostly = {
522 522 .type = cpu_to_be16(ETH_P_PPP_DISC),
523 523 .func = pppoe_disc_rcv,
524 524 };
525 525  
526   -static struct proto pppoe_sk_proto = {
  526 +static struct proto pppoe_sk_proto __read_mostly = {
527 527 .name = "PPPOE",
528 528 .owner = THIS_MODULE,
529 529 .obj_size = sizeof(struct pppox_sock),
drivers/net/wan/hdlc.c
... ... @@ -348,7 +348,7 @@
348 348 EXPORT_SYMBOL(attach_hdlc_protocol);
349 349 EXPORT_SYMBOL(detach_hdlc_protocol);
350 350  
351   -static struct packet_type hdlc_packet_type = {
  351 +static struct packet_type hdlc_packet_type __read_mostly = {
352 352 .type = cpu_to_be16(ETH_P_HDLC),
353 353 .func = hdlc_rcv,
354 354 };
drivers/net/wan/lapbether.c
... ... @@ -421,7 +421,7 @@
421 421  
422 422 /* ------------------------------------------------------------------------ */
423 423  
424   -static struct packet_type lapbeth_packet_type = {
  424 +static struct packet_type lapbeth_packet_type __read_mostly = {
425 425 .type = cpu_to_be16(ETH_P_DEC),
426 426 .func = lapbeth_rcv,
427 427 };
... ... @@ -51,7 +51,7 @@
51 51 static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
52 52 static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
53 53  
54   -static struct packet_type vlan_packet_type = {
  54 +static struct packet_type vlan_packet_type __read_mostly = {
55 55 .type = cpu_to_be16(ETH_P_8021Q),
56 56 .func = vlan_skb_recv, /* VLAN receive method */
57 57 };
... ... @@ -1860,12 +1860,12 @@
1860 1860 .notifier_call = ddp_device_event,
1861 1861 };
1862 1862  
1863   -static struct packet_type ltalk_packet_type = {
  1863 +static struct packet_type ltalk_packet_type __read_mostly = {
1864 1864 .type = cpu_to_be16(ETH_P_LOCALTALK),
1865 1865 .func = ltalk_rcv,
1866 1866 };
1867 1867  
1868   -static struct packet_type ppptalk_packet_type = {
  1868 +static struct packet_type ppptalk_packet_type __read_mostly = {
1869 1869 .type = cpu_to_be16(ETH_P_PPPTALK),
1870 1870 .func = atalk_rcv,
1871 1871 };
... ... @@ -1985,9 +1985,8 @@
1985 1985 /*
1986 1986 * Called by socket.c on kernel start up
1987 1987 */
1988   -static struct packet_type ax25_packet_type = {
  1988 +static struct packet_type ax25_packet_type __read_mostly = {
1989 1989 .type = cpu_to_be16(ETH_P_AX25),
1990   - .dev = NULL, /* All devices */
1991 1990 .func = ax25_kiss_rcv,
1992 1991 };
1993 1992  
net/decnet/af_decnet.c
... ... @@ -2112,9 +2112,8 @@
2112 2112  
2113 2113 extern int dn_route_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
2114 2114  
2115   -static struct packet_type dn_dix_packet_type = {
  2115 +static struct packet_type dn_dix_packet_type __read_mostly = {
2116 2116 .type = cpu_to_be16(ETH_P_DNA_RT),
2117   - .dev = NULL, /* All devices */
2118 2117 .func = dn_route_rcv,
2119 2118 };
2120 2119  
... ... @@ -175,7 +175,7 @@
175 175 return 0;
176 176 }
177 177  
178   -static struct packet_type dsa_packet_type = {
  178 +static struct packet_type dsa_packet_type __read_mostly = {
179 179 .type = cpu_to_be16(ETH_P_DSA),
180 180 .func = dsa_rcv,
181 181 };
... ... @@ -194,7 +194,7 @@
194 194 return 0;
195 195 }
196 196  
197   -static struct packet_type edsa_packet_type = {
  197 +static struct packet_type edsa_packet_type __read_mostly = {
198 198 .type = cpu_to_be16(ETH_P_EDSA),
199 199 .func = edsa_rcv,
200 200 };
net/dsa/tag_trailer.c
... ... @@ -111,7 +111,7 @@
111 111 return 0;
112 112 }
113 113  
114   -static struct packet_type trailer_packet_type = {
  114 +static struct packet_type trailer_packet_type __read_mostly = {
115 115 .type = cpu_to_be16(ETH_P_TRAILER),
116 116 .func = trailer_rcv,
117 117 };
net/econet/af_econet.c
... ... @@ -1102,7 +1102,7 @@
1102 1102 return NET_RX_DROP;
1103 1103 }
1104 1104  
1105   -static struct packet_type econet_packet_type = {
  1105 +static struct packet_type econet_packet_type __read_mostly = {
1106 1106 .type = cpu_to_be16(ETH_P_ECONET),
1107 1107 .func = econet_rcv,
1108 1108 };
... ... @@ -1500,7 +1500,7 @@
1500 1500 * IP protocol layer initialiser
1501 1501 */
1502 1502  
1503   -static struct packet_type ip_packet_type = {
  1503 +static struct packet_type ip_packet_type __read_mostly = {
1504 1504 .type = cpu_to_be16(ETH_P_IP),
1505 1505 .func = ip_rcv,
1506 1506 .gso_send_check = inet_gso_send_check,
... ... @@ -1225,7 +1225,7 @@
1225 1225 * Called once on startup.
1226 1226 */
1227 1227  
1228   -static struct packet_type arp_packet_type = {
  1228 +static struct packet_type arp_packet_type __read_mostly = {
1229 1229 .type = cpu_to_be16(ETH_P_ARP),
1230 1230 .func = arp_rcv,
1231 1231 };
... ... @@ -893,7 +893,7 @@
893 893 return err;
894 894 }
895 895  
896   -static struct packet_type ipv6_packet_type = {
  896 +static struct packet_type ipv6_packet_type __read_mostly = {
897 897 .type = cpu_to_be16(ETH_P_IPV6),
898 898 .func = ipv6_rcv,
899 899 .gso_send_check = ipv6_gso_send_check,
... ... @@ -1958,12 +1958,12 @@
1958 1958  
1959 1959 SOCKOPS_WRAP(ipx_dgram, PF_IPX);
1960 1960  
1961   -static struct packet_type ipx_8023_packet_type = {
  1961 +static struct packet_type ipx_8023_packet_type __read_mostly = {
1962 1962 .type = cpu_to_be16(ETH_P_802_3),
1963 1963 .func = ipx_rcv,
1964 1964 };
1965 1965  
1966   -static struct packet_type ipx_dix_packet_type = {
  1966 +static struct packet_type ipx_dix_packet_type __read_mostly = {
1967 1967 .type = cpu_to_be16(ETH_P_IPX),
1968 1968 .func = ipx_rcv,
1969 1969 };
... ... @@ -55,7 +55,7 @@
55 55 /* Packet type handler.
56 56 * Tell the kernel how IrDA packets should be handled.
57 57 */
58   -static struct packet_type irda_packet_type = {
  58 +static struct packet_type irda_packet_type __read_mostly = {
59 59 .type = cpu_to_be16(ETH_P_IRDA),
60 60 .func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */
61 61 };
... ... @@ -147,12 +147,12 @@
147 147 kfree(sap);
148 148 }
149 149  
150   -static struct packet_type llc_packet_type = {
  150 +static struct packet_type llc_packet_type __read_mostly = {
151 151 .type = cpu_to_be16(ETH_P_802_2),
152 152 .func = llc_rcv,
153 153 };
154 154  
155   -static struct packet_type llc_tr_packet_type = {
  155 +static struct packet_type llc_tr_packet_type __read_mostly = {
156 156 .type = cpu_to_be16(ETH_P_TR_802_2),
157 157 .func = llc_rcv,
158 158 };
net/phonet/af_phonet.c
... ... @@ -382,9 +382,8 @@
382 382 return NET_RX_DROP;
383 383 }
384 384  
385   -static struct packet_type phonet_packet_type = {
  385 +static struct packet_type phonet_packet_type __read_mostly = {
386 386 .type = cpu_to_be16(ETH_P_PHONET),
387   - .dev = NULL,
388 387 .func = phonet_rcv,
389 388 };
390 389  
... ... @@ -1608,7 +1608,7 @@
1608 1608  
1609 1609 SOCKOPS_WRAP(x25_proto, AF_X25);
1610 1610  
1611   -static struct packet_type x25_packet_type = {
  1611 +static struct packet_type x25_packet_type __read_mostly = {
1612 1612 .type = cpu_to_be16(ETH_P_X25),
1613 1613 .func = x25_lapb_receive_frame,
1614 1614 };