Commit 889b8f96 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent 7aeef972
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
+ ABSTRACT + ABSTRACT
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
This file documents the CONFIG_PACKET_MMAP option available with the PACKET This file documents the mmap() facility available with the PACKET
socket interface on 2.4 and 2.6 kernels. This type of sockets is used for socket interface on 2.4 and 2.6 kernels. This type of sockets is used for
capture network traffic with utilities like tcpdump or any other that needs capture network traffic with utilities like tcpdump or any other that needs
raw access to network interface. raw access to network interface.
...@@ -44,7 +44,7 @@ enabled. For transmission, check the MTU (Maximum Transmission Unit) used and ...@@ -44,7 +44,7 @@ enabled. For transmission, check the MTU (Maximum Transmission Unit) used and
supported by devices of your network. supported by devices of your network.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
+ How to use CONFIG_PACKET_MMAP to improve capture process + How to use mmap() to improve capture process
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
From the user standpoint, you should use the higher level libpcap library, which From the user standpoint, you should use the higher level libpcap library, which
...@@ -64,7 +64,7 @@ the low level details or want to improve libpcap by including PACKET_MMAP ...@@ -64,7 +64,7 @@ the low level details or want to improve libpcap by including PACKET_MMAP
support. support.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
+ How to use CONFIG_PACKET_MMAP directly to improve capture process + How to use mmap() directly to improve capture process
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
From the system calls stand point, the use of PACKET_MMAP involves From the system calls stand point, the use of PACKET_MMAP involves
...@@ -105,7 +105,7 @@ also the mapping of the circular buffer in the user process and ...@@ -105,7 +105,7 @@ also the mapping of the circular buffer in the user process and
the use of this buffer. the use of this buffer.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
+ How to use CONFIG_PACKET_MMAP directly to improve transmission process + How to use mmap() directly to improve transmission process
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Transmission process is similar to capture as shown below. Transmission process is similar to capture as shown below.
......
...@@ -14,13 +14,3 @@ config PACKET ...@@ -14,13 +14,3 @@ config PACKET
be called af_packet. be called af_packet.
If unsure, say Y. If unsure, say Y.
config PACKET_MMAP
bool "Packet socket: mmapped IO"
depends on PACKET
help
If you say Y here, the Packet protocol driver will use an IO
mechanism that results in faster communication.
If unsure, say N.
...@@ -157,7 +157,6 @@ struct packet_mreq_max { ...@@ -157,7 +157,6 @@ struct packet_mreq_max {
unsigned char mr_address[MAX_ADDR_LEN]; unsigned char mr_address[MAX_ADDR_LEN];
}; };
#ifdef CONFIG_PACKET_MMAP
static int packet_set_ring(struct sock *sk, struct tpacket_req *req, static int packet_set_ring(struct sock *sk, struct tpacket_req *req,
int closing, int tx_ring); int closing, int tx_ring);
...@@ -177,7 +176,6 @@ struct packet_ring_buffer { ...@@ -177,7 +176,6 @@ struct packet_ring_buffer {
struct packet_sock; struct packet_sock;
static int tpacket_snd(struct packet_sock *po, struct msghdr *msg); static int tpacket_snd(struct packet_sock *po, struct msghdr *msg);
#endif
static void packet_flush_mclist(struct sock *sk); static void packet_flush_mclist(struct sock *sk);
...@@ -185,11 +183,9 @@ struct packet_sock { ...@@ -185,11 +183,9 @@ struct packet_sock {
/* struct sock has to be the first member of packet_sock */ /* struct sock has to be the first member of packet_sock */
struct sock sk; struct sock sk;
struct tpacket_stats stats; struct tpacket_stats stats;
#ifdef CONFIG_PACKET_MMAP
struct packet_ring_buffer rx_ring; struct packet_ring_buffer rx_ring;
struct packet_ring_buffer tx_ring; struct packet_ring_buffer tx_ring;
int copy_thresh; int copy_thresh;
#endif
spinlock_t bind_lock; spinlock_t bind_lock;
struct mutex pg_vec_lock; struct mutex pg_vec_lock;
unsigned int running:1, /* prot_hook is attached*/ unsigned int running:1, /* prot_hook is attached*/
...@@ -199,13 +195,11 @@ struct packet_sock { ...@@ -199,13 +195,11 @@ struct packet_sock {
int ifindex; /* bound device */ int ifindex; /* bound device */
__be16 num; __be16 num;
struct packet_mclist *mclist; struct packet_mclist *mclist;
#ifdef CONFIG_PACKET_MMAP
atomic_t mapped; atomic_t mapped;
enum tpacket_versions tp_version; enum tpacket_versions tp_version;
unsigned int tp_hdrlen; unsigned int tp_hdrlen;
unsigned int tp_reserve; unsigned int tp_reserve;
unsigned int tp_loss:1; unsigned int tp_loss:1;
#endif
struct packet_type prot_hook ____cacheline_aligned_in_smp; struct packet_type prot_hook ____cacheline_aligned_in_smp;
}; };
...@@ -219,8 +213,6 @@ struct packet_skb_cb { ...@@ -219,8 +213,6 @@ struct packet_skb_cb {
#define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb)) #define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb))
#ifdef CONFIG_PACKET_MMAP
static void __packet_set_status(struct packet_sock *po, void *frame, int status) static void __packet_set_status(struct packet_sock *po, void *frame, int status)
{ {
union { union {
...@@ -315,8 +307,6 @@ static inline void packet_increment_head(struct packet_ring_buffer *buff) ...@@ -315,8 +307,6 @@ static inline void packet_increment_head(struct packet_ring_buffer *buff)
buff->head = buff->head != buff->frame_max ? buff->head+1 : 0; buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
} }
#endif
static inline struct packet_sock *pkt_sk(struct sock *sk) static inline struct packet_sock *pkt_sk(struct sock *sk)
{ {
return (struct packet_sock *)sk; return (struct packet_sock *)sk;
...@@ -640,7 +630,6 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -640,7 +630,6 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
return 0; return 0;
} }
#ifdef CONFIG_PACKET_MMAP
static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev) struct packet_type *pt, struct net_device *orig_dev)
{ {
...@@ -1056,7 +1045,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) ...@@ -1056,7 +1045,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
mutex_unlock(&po->pg_vec_lock); mutex_unlock(&po->pg_vec_lock);
return err; return err;
} }
#endif
static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad, static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad,
size_t reserve, size_t len, size_t reserve, size_t len,
...@@ -1248,13 +1236,11 @@ static int packet_snd(struct socket *sock, ...@@ -1248,13 +1236,11 @@ static int packet_snd(struct socket *sock,
static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len) struct msghdr *msg, size_t len)
{ {
#ifdef CONFIG_PACKET_MMAP
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct packet_sock *po = pkt_sk(sk); struct packet_sock *po = pkt_sk(sk);
if (po->tx_ring.pg_vec) if (po->tx_ring.pg_vec)
return tpacket_snd(po, msg); return tpacket_snd(po, msg);
else else
#endif
return packet_snd(sock, msg, len); return packet_snd(sock, msg, len);
} }
...@@ -1268,9 +1254,7 @@ static int packet_release(struct socket *sock) ...@@ -1268,9 +1254,7 @@ static int packet_release(struct socket *sock)
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct packet_sock *po; struct packet_sock *po;
struct net *net; struct net *net;
#ifdef CONFIG_PACKET_MMAP
struct tpacket_req req; struct tpacket_req req;
#endif
if (!sk) if (!sk)
return 0; return 0;
...@@ -1299,7 +1283,6 @@ static int packet_release(struct socket *sock) ...@@ -1299,7 +1283,6 @@ static int packet_release(struct socket *sock)
packet_flush_mclist(sk); packet_flush_mclist(sk);
#ifdef CONFIG_PACKET_MMAP
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
if (po->rx_ring.pg_vec) if (po->rx_ring.pg_vec)
...@@ -1307,7 +1290,6 @@ static int packet_release(struct socket *sock) ...@@ -1307,7 +1290,6 @@ static int packet_release(struct socket *sock)
if (po->tx_ring.pg_vec) if (po->tx_ring.pg_vec)
packet_set_ring(sk, &req, 1, 1); packet_set_ring(sk, &req, 1, 1);
#endif
/* /*
* Now the socket is dead. No more input will appear. * 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,7 +1854,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
return ret; return ret;
} }
#ifdef CONFIG_PACKET_MMAP
case PACKET_RX_RING: case PACKET_RX_RING:
case PACKET_TX_RING: case PACKET_TX_RING:
{ {
...@@ -1943,7 +1924,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv ...@@ -1943,7 +1924,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
po->tp_loss = !!val; po->tp_loss = !!val;
return 0; return 0;
} }
#endif
case PACKET_AUXDATA: case PACKET_AUXDATA:
{ {
int val; int val;
...@@ -2041,7 +2021,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, ...@@ -2041,7 +2021,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
data = &val; data = &val;
break; break;
#ifdef CONFIG_PACKET_MMAP
case PACKET_VERSION: case PACKET_VERSION:
if (len > sizeof(int)) if (len > sizeof(int))
len = sizeof(int); len = sizeof(int);
...@@ -2077,7 +2056,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, ...@@ -2077,7 +2056,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
val = po->tp_loss; val = po->tp_loss;
data = &val; data = &val;
break; break;
#endif
default: default:
return -ENOPROTOOPT; return -ENOPROTOOPT;
} }
...@@ -2197,11 +2175,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -2197,11 +2175,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
return 0; return 0;
} }
#ifndef CONFIG_PACKET_MMAP
#define packet_mmap sock_no_mmap
#define packet_poll datagram_poll
#else
static unsigned int packet_poll(struct file *file, struct socket *sock, static unsigned int packet_poll(struct file *file, struct socket *sock,
poll_table *wait) poll_table *wait)
{ {
...@@ -2483,8 +2456,6 @@ static int packet_mmap(struct file *file, struct socket *sock, ...@@ -2483,8 +2456,6 @@ static int packet_mmap(struct file *file, struct socket *sock,
mutex_unlock(&po->pg_vec_lock); mutex_unlock(&po->pg_vec_lock);
return err; return err;
} }
#endif
static const struct proto_ops packet_ops_spkt = { static const struct proto_ops packet_ops_spkt = {
.family = PF_PACKET, .family = PF_PACKET,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment