From 09640e6365c679b5642b1c41b6d7078f51689ddf Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sun, 1 Feb 2009 00:45:17 -0800 Subject: net: replace uses of __constant_{endian} Base versions handle constant folding now. Signed-off-by: Harvey Harrison Signed-off-by: David S. Miller --- net/ax25/af_ax25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/ax25') diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 00d9e5e1315..d127fd3ba5c 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1986,7 +1986,7 @@ static const struct proto_ops ax25_proto_ops = { * Called by socket.c on kernel start up */ static struct packet_type ax25_packet_type = { - .type = __constant_htons(ETH_P_AX25), + .type = cpu_to_be16(ETH_P_AX25), .dev = NULL, /* All devices */ .func = ax25_kiss_rcv, }; -- cgit v1.2.3 From 910d30b704542b49f83881a4832d8414c6c3d9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Fri, 6 Feb 2009 23:47:14 -0800 Subject: ax25: more common return path joining MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ilpo Järvinen Acked-by: Ralf Baechle Signed-off-by: David S. Miller --- net/ax25/ax25_iface.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'net/ax25') diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c index 8443af57a37..71338f11210 100644 --- a/net/ax25/ax25_iface.c +++ b/net/ax25/ax25_iface.c @@ -61,27 +61,24 @@ void ax25_protocol_release(unsigned int pid) write_lock_bh(&protocol_list_lock); protocol = protocol_list; - if (protocol == NULL) { - write_unlock_bh(&protocol_list_lock); - return; - } + if (protocol == NULL) + goto out; if (protocol->pid == pid) { protocol_list = protocol->next; - write_unlock_bh(&protocol_list_lock); - return; + goto out; } while (protocol != NULL && protocol->next != NULL) { if (protocol->next->pid == pid) { s = protocol->next; protocol->next = protocol->next->next; - write_unlock_bh(&protocol_list_lock); - return; + goto out; } protocol = protocol->next; } +out: write_unlock_bh(&protocol_list_lock); } -- cgit v1.2.3 From 7546dd97d27306d939c13e03318aae695badaa88 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 9 Mar 2009 08:18:29 +0000 Subject: 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 Signed-off-by: David S. Miller --- net/ax25/af_ax25.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'net/ax25') diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index d127fd3ba5c..8f8f63ff656 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1985,9 +1985,8 @@ static const struct proto_ops ax25_proto_ops = { /* * 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), - .dev = NULL, /* All devices */ .func = ax25_kiss_rcv, }; -- cgit v1.2.3 From 60784427ab331dc13c070ac4b0cc9a735bdfa9c0 Mon Sep 17 00:00:00 2001 From: Bernard Pidoux Date: Sat, 21 Mar 2009 13:33:18 -0700 Subject: ax25: SOCK_DEBUG message simplification This patch condenses two debug messages in one. Signed-off-by: Bernard Pidoux Signed-off-by: David S. Miller --- net/ax25/af_ax25.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'net/ax25') diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 8f8f63ff656..fd9d06f291d 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1529,10 +1529,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, dp = ax25->digipeat; } - SOCK_DEBUG(sk, "AX.25: sendto: Addresses built.\n"); - /* Build a packet */ - SOCK_DEBUG(sk, "AX.25: sendto: building packet.\n"); + SOCK_DEBUG(sk, "AX.25: sendto: Addresses built. Building packet.\n"); /* Assume the worst case */ size = len + ax25->ax25_dev->dev->hard_header_len; -- cgit v1.2.3 From f99bcff7a290768e035f3d4726e103c6ebe858bf Mon Sep 17 00:00:00 2001 From: Bernard Pidoux Date: Sat, 21 Mar 2009 13:33:55 -0700 Subject: ax25: zero length frame filtering in AX25 In previous commit 244f46ae6e9e18f6fc0be7d1f49febde4762c34b was introduced a zero length frame filter for ROSE protocole. This patch has the same purpose at AX25 frame level for the same reason. Empty frames have no meaning in AX25 protocole. Signed-off-by: Bernard Pidoux Signed-off-by: David S. Miller --- net/ax25/af_ax25.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'net/ax25') diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index fd9d06f291d..7da5ebb84e9 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1435,6 +1435,11 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, size_t size; int lv, err, addr_len = msg->msg_namelen; + /* AX.25 empty data frame has no meaning : don't send */ + if (len == 0) { + return (0); + } + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; @@ -1634,6 +1639,13 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock, skb_reset_transport_header(skb); copied = skb->len; + /* AX.25 empty data frame has no meaning : ignore it */ + if (copied == 0) { + err = copied; + skb_free_datagram(sk, skb); + goto out; + } + if (copied > size) { copied = size; msg->msg_flags |= MSG_TRUNC; -- cgit v1.2.3 From c44a4366649aca4f5b4a51ff71d4c9cde3b7c9da Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 27 Mar 2009 17:23:42 -0700 Subject: Revert "ax25: zero length frame filtering in AX25" This reverts commit f99bcff7a290768e035f3d4726e103c6ebe858bf. Like netrom, Alan Cox says that zero lengths have real meaning and are useful in this protocol. Signed-off-by: David S. Miller --- net/ax25/af_ax25.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'net/ax25') diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 7da5ebb84e9..fd9d06f291d 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1435,11 +1435,6 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, size_t size; int lv, err, addr_len = msg->msg_namelen; - /* AX.25 empty data frame has no meaning : don't send */ - if (len == 0) { - return (0); - } - if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; @@ -1639,13 +1634,6 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock, skb_reset_transport_header(skb); copied = skb->len; - /* AX.25 empty data frame has no meaning : ignore it */ - if (copied == 0) { - err = copied; - skb_free_datagram(sk, skb); - goto out; - } - if (copied > size) { copied = size; msg->msg_flags |= MSG_TRUNC; -- cgit v1.2.3