Commit 889b8f964f2f226b7cd5a0a515109e3d8d9d1613

Authored by David S. Miller
1 parent 7aeef972cc

packet: Kill CONFIG_PACKET_MMAP.

Early on this was an experimental facility that few
people other than Alexey Kuznetsov played with.

Now it's a pretty fundamental thing and as people add
more features to AF_PACKET sockets this config options
creates ifdef spaghetti.

So kill it off.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 4 additions and 43 deletions Side-by-side Diff

Documentation/networking/packet_mmap.txt
... ... @@ -2,7 +2,7 @@
2 2 + ABSTRACT
3 3 --------------------------------------------------------------------------------
4 4  
5   -This file documents the CONFIG_PACKET_MMAP option available with the PACKET
  5 +This file documents the mmap() facility available with the PACKET
6 6 socket interface on 2.4 and 2.6 kernels. This type of sockets is used for
7 7 capture network traffic with utilities like tcpdump or any other that needs
8 8 raw access to network interface.
... ... @@ -44,7 +44,7 @@
44 44 supported by devices of your network.
45 45  
46 46 --------------------------------------------------------------------------------
47   -+ How to use CONFIG_PACKET_MMAP to improve capture process
  47 ++ How to use mmap() to improve capture process
48 48 --------------------------------------------------------------------------------
49 49  
50 50 From the user standpoint, you should use the higher level libpcap library, which
... ... @@ -64,7 +64,7 @@
64 64 support.
65 65  
66 66 --------------------------------------------------------------------------------
67   -+ How to use CONFIG_PACKET_MMAP directly to improve capture process
  67 ++ How to use mmap() directly to improve capture process
68 68 --------------------------------------------------------------------------------
69 69  
70 70 From the system calls stand point, the use of PACKET_MMAP involves
... ... @@ -105,7 +105,7 @@
105 105 the use of this buffer.
106 106  
107 107 --------------------------------------------------------------------------------
108   -+ How to use CONFIG_PACKET_MMAP directly to improve transmission process
  108 ++ How to use mmap() directly to improve transmission process
109 109 --------------------------------------------------------------------------------
110 110 Transmission process is similar to capture as shown below.
111 111  
... ... @@ -14,13 +14,4 @@
14 14 be called af_packet.
15 15  
16 16 If unsure, say Y.
17   -
18   -config PACKET_MMAP
19   - bool "Packet socket: mmapped IO"
20   - depends on PACKET
21   - help
22   - If you say Y here, the Packet protocol driver will use an IO
23   - mechanism that results in faster communication.
24   -
25   - If unsure, say N.
net/packet/af_packet.c
... ... @@ -157,7 +157,6 @@
157 157 unsigned char mr_address[MAX_ADDR_LEN];
158 158 };
159 159  
160   -#ifdef CONFIG_PACKET_MMAP
161 160 static int packet_set_ring(struct sock *sk, struct tpacket_req *req,
162 161 int closing, int tx_ring);
163 162  
... ... @@ -177,7 +176,6 @@
177 176  
178 177 struct packet_sock;
179 178 static int tpacket_snd(struct packet_sock *po, struct msghdr *msg);
180   -#endif
181 179  
182 180 static void packet_flush_mclist(struct sock *sk);
183 181  
184 182  
... ... @@ -185,11 +183,9 @@
185 183 /* struct sock has to be the first member of packet_sock */
186 184 struct sock sk;
187 185 struct tpacket_stats stats;
188   -#ifdef CONFIG_PACKET_MMAP
189 186 struct packet_ring_buffer rx_ring;
190 187 struct packet_ring_buffer tx_ring;
191 188 int copy_thresh;
192   -#endif
193 189 spinlock_t bind_lock;
194 190 struct mutex pg_vec_lock;
195 191 unsigned int running:1, /* prot_hook is attached*/
196 192  
... ... @@ -199,13 +195,11 @@
199 195 int ifindex; /* bound device */
200 196 __be16 num;
201 197 struct packet_mclist *mclist;
202   -#ifdef CONFIG_PACKET_MMAP
203 198 atomic_t mapped;
204 199 enum tpacket_versions tp_version;
205 200 unsigned int tp_hdrlen;
206 201 unsigned int tp_reserve;
207 202 unsigned int tp_loss:1;
208   -#endif
209 203 struct packet_type prot_hook ____cacheline_aligned_in_smp;
210 204 };
211 205  
... ... @@ -219,8 +213,6 @@
219 213  
220 214 #define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb))
221 215  
222   -#ifdef CONFIG_PACKET_MMAP
223   -
224 216 static void __packet_set_status(struct packet_sock *po, void *frame, int status)
225 217 {
226 218 union {
... ... @@ -315,8 +307,6 @@
315 307 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
316 308 }
317 309  
318   -#endif
319   -
320 310 static inline struct packet_sock *pkt_sk(struct sock *sk)
321 311 {
322 312 return (struct packet_sock *)sk;
... ... @@ -640,7 +630,6 @@
640 630 return 0;
641 631 }
642 632  
643   -#ifdef CONFIG_PACKET_MMAP
644 633 static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
645 634 struct packet_type *pt, struct net_device *orig_dev)
646 635 {
... ... @@ -1056,7 +1045,6 @@
1056 1045 mutex_unlock(&po->pg_vec_lock);
1057 1046 return err;
1058 1047 }
1059   -#endif
1060 1048  
1061 1049 static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad,
1062 1050 size_t reserve, size_t len,
1063 1051  
... ... @@ -1248,13 +1236,11 @@
1248 1236 static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
1249 1237 struct msghdr *msg, size_t len)
1250 1238 {
1251   -#ifdef CONFIG_PACKET_MMAP
1252 1239 struct sock *sk = sock->sk;
1253 1240 struct packet_sock *po = pkt_sk(sk);
1254 1241 if (po->tx_ring.pg_vec)
1255 1242 return tpacket_snd(po, msg);
1256 1243 else
1257   -#endif
1258 1244 return packet_snd(sock, msg, len);
1259 1245 }
1260 1246  
1261 1247  
... ... @@ -1268,9 +1254,7 @@
1268 1254 struct sock *sk = sock->sk;
1269 1255 struct packet_sock *po;
1270 1256 struct net *net;
1271   -#ifdef CONFIG_PACKET_MMAP
1272 1257 struct tpacket_req req;
1273   -#endif
1274 1258  
1275 1259 if (!sk)
1276 1260 return 0;
... ... @@ -1299,7 +1283,6 @@
1299 1283  
1300 1284 packet_flush_mclist(sk);
1301 1285  
1302   -#ifdef CONFIG_PACKET_MMAP
1303 1286 memset(&req, 0, sizeof(req));
1304 1287  
1305 1288 if (po->rx_ring.pg_vec)
... ... @@ -1307,7 +1290,6 @@
1307 1290  
1308 1291 if (po->tx_ring.pg_vec)
1309 1292 packet_set_ring(sk, &req, 1, 1);
1310   -#endif
1311 1293  
1312 1294 /*
1313 1295 * Now the socket is dead. No more input will appear.
... ... @@ -1872,7 +1854,6 @@
1872 1854 return ret;
1873 1855 }
1874 1856  
1875   -#ifdef CONFIG_PACKET_MMAP
1876 1857 case PACKET_RX_RING:
1877 1858 case PACKET_TX_RING:
1878 1859 {
... ... @@ -1943,7 +1924,6 @@
1943 1924 po->tp_loss = !!val;
1944 1925 return 0;
1945 1926 }
1946   -#endif
1947 1927 case PACKET_AUXDATA:
1948 1928 {
1949 1929 int val;
... ... @@ -2041,7 +2021,6 @@
2041 2021  
2042 2022 data = &val;
2043 2023 break;
2044   -#ifdef CONFIG_PACKET_MMAP
2045 2024 case PACKET_VERSION:
2046 2025 if (len > sizeof(int))
2047 2026 len = sizeof(int);
... ... @@ -2077,7 +2056,6 @@
2077 2056 val = po->tp_loss;
2078 2057 data = &val;
2079 2058 break;
2080   -#endif
2081 2059 default:
2082 2060 return -ENOPROTOOPT;
2083 2061 }
... ... @@ -2197,11 +2175,6 @@
2197 2175 return 0;
2198 2176 }
2199 2177  
2200   -#ifndef CONFIG_PACKET_MMAP
2201   -#define packet_mmap sock_no_mmap
2202   -#define packet_poll datagram_poll
2203   -#else
2204   -
2205 2178 static unsigned int packet_poll(struct file *file, struct socket *sock,
2206 2179 poll_table *wait)
2207 2180 {
... ... @@ -2483,8 +2456,6 @@
2483 2456 mutex_unlock(&po->pg_vec_lock);
2484 2457 return err;
2485 2458 }
2486   -#endif
2487   -
2488 2459  
2489 2460 static const struct proto_ops packet_ops_spkt = {
2490 2461 .family = PF_PACKET,