aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-02-05 19:29:48 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-05 19:29:48 -0500
commit889b8f964f2f226b7cd5a0a515109e3d8d9d1613 (patch)
treec576152db1b3ea0b68206393735aec566e9aadf3 /net/packet
parent7aeef972cce30b0ab04047e07918b04d867e7a29 (diff)
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>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/Kconfig10
-rw-r--r--net/packet/af_packet.c29
2 files changed, 0 insertions, 39 deletions
diff --git a/net/packet/Kconfig b/net/packet/Kconfig
index 34ff93ff894d..0060e3b396b7 100644
--- a/net/packet/Kconfig
+++ b/net/packet/Kconfig
@@ -14,13 +14,3 @@ config PACKET
14 be called af_packet. 14 be called af_packet.
15 15
16 If unsure, say Y. 16 If unsure, say Y.
17
18config 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.
26
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 178e2937bbaa..6ecb426bc0cf 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -157,7 +157,6 @@ struct packet_mreq_max {
157 unsigned char mr_address[MAX_ADDR_LEN]; 157 unsigned char mr_address[MAX_ADDR_LEN];
158}; 158};
159 159
160#ifdef CONFIG_PACKET_MMAP
161static int packet_set_ring(struct sock *sk, struct tpacket_req *req, 160static int packet_set_ring(struct sock *sk, struct tpacket_req *req,
162 int closing, int tx_ring); 161 int closing, int tx_ring);
163 162
@@ -177,7 +176,6 @@ struct packet_ring_buffer {
177 176
178struct packet_sock; 177struct packet_sock;
179static int tpacket_snd(struct packet_sock *po, struct msghdr *msg); 178static int tpacket_snd(struct packet_sock *po, struct msghdr *msg);
180#endif
181 179
182static void packet_flush_mclist(struct sock *sk); 180static void packet_flush_mclist(struct sock *sk);
183 181
@@ -185,11 +183,9 @@ struct packet_sock {
185 /* struct sock has to be the first member of packet_sock */ 183 /* struct sock has to be the first member of packet_sock */
186 struct sock sk; 184 struct sock sk;
187 struct tpacket_stats stats; 185 struct tpacket_stats stats;
188#ifdef CONFIG_PACKET_MMAP
189 struct packet_ring_buffer rx_ring; 186 struct packet_ring_buffer rx_ring;
190 struct packet_ring_buffer tx_ring; 187 struct packet_ring_buffer tx_ring;
191 int copy_thresh; 188 int copy_thresh;
192#endif
193 spinlock_t bind_lock; 189 spinlock_t bind_lock;
194 struct mutex pg_vec_lock; 190 struct mutex pg_vec_lock;
195 unsigned int running:1, /* prot_hook is attached*/ 191 unsigned int running:1, /* prot_hook is attached*/
@@ -199,13 +195,11 @@ struct packet_sock {
199 int ifindex; /* bound device */ 195 int ifindex; /* bound device */
200 __be16 num; 196 __be16 num;
201 struct packet_mclist *mclist; 197 struct packet_mclist *mclist;
202#ifdef CONFIG_PACKET_MMAP
203 atomic_t mapped; 198 atomic_t mapped;
204 enum tpacket_versions tp_version; 199 enum tpacket_versions tp_version;
205 unsigned int tp_hdrlen; 200 unsigned int tp_hdrlen;
206 unsigned int tp_reserve; 201 unsigned int tp_reserve;
207 unsigned int tp_loss:1; 202 unsigned int tp_loss:1;
208#endif
209 struct packet_type prot_hook ____cacheline_aligned_in_smp; 203 struct packet_type prot_hook ____cacheline_aligned_in_smp;
210}; 204};
211 205
@@ -219,8 +213,6 @@ struct packet_skb_cb {
219 213
220#define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb)) 214#define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb))
221 215
222#ifdef CONFIG_PACKET_MMAP
223
224static void __packet_set_status(struct packet_sock *po, void *frame, int status) 216static void __packet_set_status(struct packet_sock *po, void *frame, int status)
225{ 217{
226 union { 218 union {
@@ -315,8 +307,6 @@ static inline void packet_increment_head(struct packet_ring_buffer *buff)
315 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0; 307 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
316} 308}
317 309
318#endif
319
320static inline struct packet_sock *pkt_sk(struct sock *sk) 310static inline struct packet_sock *pkt_sk(struct sock *sk)
321{ 311{
322 return (struct packet_sock *)sk; 312 return (struct packet_sock *)sk;
@@ -640,7 +630,6 @@ drop:
640 return 0; 630 return 0;
641} 631}
642 632
643#ifdef CONFIG_PACKET_MMAP
644static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, 633static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
645 struct packet_type *pt, struct net_device *orig_dev) 634 struct packet_type *pt, struct net_device *orig_dev)
646{ 635{
@@ -1056,7 +1045,6 @@ out:
1056 mutex_unlock(&po->pg_vec_lock); 1045 mutex_unlock(&po->pg_vec_lock);
1057 return err; 1046 return err;
1058} 1047}
1059#endif
1060 1048
1061static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad, 1049static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad,
1062 size_t reserve, size_t len, 1050 size_t reserve, size_t len,
@@ -1248,13 +1236,11 @@ out:
1248static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, 1236static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
1249 struct msghdr *msg, size_t len) 1237 struct msghdr *msg, size_t len)
1250{ 1238{
1251#ifdef CONFIG_PACKET_MMAP
1252 struct sock *sk = sock->sk; 1239 struct sock *sk = sock->sk;
1253 struct packet_sock *po = pkt_sk(sk); 1240 struct packet_sock *po = pkt_sk(sk);
1254 if (po->tx_ring.pg_vec) 1241 if (po->tx_ring.pg_vec)
1255 return tpacket_snd(po, msg); 1242 return tpacket_snd(po, msg);
1256 else 1243 else
1257#endif
1258 return packet_snd(sock, msg, len); 1244 return packet_snd(sock, msg, len);
1259} 1245}
1260 1246
@@ -1268,9 +1254,7 @@ static int packet_release(struct socket *sock)
1268 struct sock *sk = sock->sk; 1254 struct sock *sk = sock->sk;
1269 struct packet_sock *po; 1255 struct packet_sock *po;
1270 struct net *net; 1256 struct net *net;
1271#ifdef CONFIG_PACKET_MMAP
1272 struct tpacket_req req; 1257 struct tpacket_req req;
1273#endif
1274 1258
1275 if (!sk) 1259 if (!sk)
1276 return 0; 1260 return 0;
@@ -1299,7 +1283,6 @@ static int packet_release(struct socket *sock)
1299 1283
1300 packet_flush_mclist(sk); 1284 packet_flush_mclist(sk);
1301 1285
1302#ifdef CONFIG_PACKET_MMAP
1303 memset(&req, 0, sizeof(req)); 1286 memset(&req, 0, sizeof(req));
1304 1287
1305 if (po->rx_ring.pg_vec) 1288 if (po->rx_ring.pg_vec)
@@ -1307,7 +1290,6 @@ static int packet_release(struct socket *sock)
1307 1290
1308 if (po->tx_ring.pg_vec) 1291 if (po->tx_ring.pg_vec)
1309 packet_set_ring(sk, &req, 1, 1); 1292 packet_set_ring(sk, &req, 1, 1);
1310#endif
1311 1293
1312 /* 1294 /*
1313 * Now the socket is dead. No more input will appear. 1295 * Now the socket is dead. No more input will appear.
@@ -1872,7 +1854,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1872 return ret; 1854 return ret;
1873 } 1855 }
1874 1856
1875#ifdef CONFIG_PACKET_MMAP
1876 case PACKET_RX_RING: 1857 case PACKET_RX_RING:
1877 case PACKET_TX_RING: 1858 case PACKET_TX_RING:
1878 { 1859 {
@@ -1943,7 +1924,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1943 po->tp_loss = !!val; 1924 po->tp_loss = !!val;
1944 return 0; 1925 return 0;
1945 } 1926 }
1946#endif
1947 case PACKET_AUXDATA: 1927 case PACKET_AUXDATA:
1948 { 1928 {
1949 int val; 1929 int val;
@@ -2041,7 +2021,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
2041 2021
2042 data = &val; 2022 data = &val;
2043 break; 2023 break;
2044#ifdef CONFIG_PACKET_MMAP
2045 case PACKET_VERSION: 2024 case PACKET_VERSION:
2046 if (len > sizeof(int)) 2025 if (len > sizeof(int))
2047 len = sizeof(int); 2026 len = sizeof(int);
@@ -2077,7 +2056,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
2077 val = po->tp_loss; 2056 val = po->tp_loss;
2078 data = &val; 2057 data = &val;
2079 break; 2058 break;
2080#endif
2081 default: 2059 default:
2082 return -ENOPROTOOPT; 2060 return -ENOPROTOOPT;
2083 } 2061 }
@@ -2197,11 +2175,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
2197 return 0; 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
2205static unsigned int packet_poll(struct file *file, struct socket *sock, 2178static unsigned int packet_poll(struct file *file, struct socket *sock,
2206 poll_table *wait) 2179 poll_table *wait)
2207{ 2180{
@@ -2483,8 +2456,6 @@ out:
2483 mutex_unlock(&po->pg_vec_lock); 2456 mutex_unlock(&po->pg_vec_lock);
2484 return err; 2457 return err;
2485} 2458}
2486#endif
2487
2488 2459
2489static const struct proto_ops packet_ops_spkt = { 2460static const struct proto_ops packet_ops_spkt = {
2490 .family = PF_PACKET, 2461 .family = PF_PACKET,