[PATCH v2] net: make getname() functions return length rather than use int* parameter

2018-02-12 Thread Denys Vlasenko
Changes since v1:
Added changes in these files:
drivers/infiniband/hw/usnic/usnic_transport.c
drivers/staging/lustre/lnet/lnet/lib-socket.c
drivers/target/iscsi/iscsi_target_login.c
drivers/vhost/net.c
fs/dlm/lowcomms.c
fs/ocfs2/cluster/tcp.c
security/tomoyo/network.c


Before:
All these functions either return a negative error indicator,
or store length of sockaddr into "int *socklen" parameter
and return zero on success.

"int *socklen" parameter is awkward. For example, if caller does not
care, it still needs to provide on-stack storage for the value
it does not need.

None of the many FOO_getname() functions of various protocols
ever used old value of *socklen. They always just overwrite it.

This change drops this parameter, and makes all these functions, on success,
return length of sockaddr. It's always >= 0 and can be differentiated
from an error.

Tests in callers are changed from "if (err)" to "if (err < 0)", where needed.

rpc_sockname() lost "int buflen" parameter, since its only use was
to be passed to kernel_getsockname() as  and subsequently
not used in any way.

Userspace API is not changed.

textdata bss  dec hex filename
30108430 2633624  873672 33615726 200ef6e vmlinux.before.o
30108109 2633612  873672 33615393 200ee21 vmlinux.o

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: David S. Miller <da...@davemloft.net>
CC: linux-ker...@vger.kernel.org
CC: net...@vger.kernel.org
CC: linux-blueto...@vger.kernel.org
CC: linux-decnet-u...@lists.sourceforge.net
CC: linux-wireless@vger.kernel.org
CC: linux-r...@vger.kernel.org
CC: linux-s...@vger.kernel.org
CC: linux-...@vger.kernel.org
CC: linux-...@vger.kernel.org
---
 drivers/infiniband/hw/usnic/usnic_transport.c |  5 ++--
 drivers/isdn/mISDN/socket.c   |  5 ++--
 drivers/net/ppp/pppoe.c   |  6 ++---
 drivers/net/ppp/pptp.c|  6 ++---
 drivers/scsi/iscsi_tcp.c  | 14 +--
 drivers/soc/qcom/qmi_interface.c  |  3 +--
 drivers/staging/ipx/af_ipx.c  |  6 ++---
 drivers/staging/irda/net/af_irda.c|  8 +++---
 drivers/staging/lustre/lnet/lnet/lib-socket.c |  7 +++---
 drivers/target/iscsi/iscsi_target_login.c | 18 +++---
 drivers/vhost/net.c   |  7 +++---
 fs/dlm/lowcomms.c |  7 +++---
 fs/ocfs2/cluster/tcp.c|  6 ++---
 include/linux/net.h   |  8 +++---
 include/net/inet_common.h |  2 +-
 include/net/ipv6.h|  2 +-
 include/net/sock.h|  2 +-
 net/appletalk/ddp.c   |  5 ++--
 net/atm/pvc.c |  5 ++--
 net/atm/svc.c |  5 ++--
 net/ax25/af_ax25.c|  4 +--
 net/bluetooth/hci_sock.c  |  4 +--
 net/bluetooth/l2cap_sock.c|  5 ++--
 net/bluetooth/rfcomm/sock.c   |  5 ++--
 net/bluetooth/sco.c   |  5 ++--
 net/can/raw.c |  6 ++---
 net/core/sock.c   |  5 ++--
 net/decnet/af_decnet.c|  6 ++---
 net/ipv4/af_inet.c|  5 ++--
 net/ipv6/af_inet6.c   |  5 ++--
 net/iucv/af_iucv.c|  5 ++--
 net/l2tp/l2tp_ip.c|  5 ++--
 net/l2tp/l2tp_ip6.c   |  5 ++--
 net/l2tp/l2tp_ppp.c   |  5 ++--
 net/llc/af_llc.c  |  5 ++--
 net/netlink/af_netlink.c  |  5 ++--
 net/netrom/af_netrom.c|  9 ---
 net/nfc/llcp_sock.c   |  5 ++--
 net/packet/af_packet.c| 10 +++-
 net/phonet/socket.c   |  5 ++--
 net/qrtr/qrtr.c   |  5 ++--
 net/rds/af_rds.c  |  5 ++--
 net/rds/tcp.c |  7 ++
 net/rose/af_rose.c|  5 ++--
 net/sctp/ipv6.c   |  8 +++---
 net/smc/af_smc.c  | 11 -
 net/socket.c  | 35 +--
 net/sunrpc/clnt.c |  6 ++---
 net/sunrpc/svcsock.c  | 13 ++
 net/sunrpc/xprtsock.c |  3 +--
 net/tipc/socket.c |  5 ++--
 net/unix/af_unix.c| 10 
 net/vmw_vsock/af_vsock.c  |  4 +--
 net/x25/af_x25.c  |  4 +--
 security/tomoyo/network.c |  5 ++--
 55 file

Re: [PATCH] net: make getname() functions return length rather than use int* parameter

2018-02-12 Thread Denys Vlasenko

On 02/12/2018 06:47 PM, David Miller wrote:

From: Denys Vlasenko <dvlas...@redhat.com>
Date: Mon, 12 Feb 2018 15:15:18 +0100


Before:
All these functions either return a negative error indicator,
or store length of sockaddr into "int *socklen" parameter
and return zero on success.

"int *socklen" parameter is awkward. For example, if caller does not
care, it still needs to provide on-stack storage for the value
it does not need.

None of the many FOO_getname() functions of various protocols
ever used old value of *socklen. They always just overwrite it.

This change drops this parameter, and makes all these functions, on success,
return length of sockaddr. It's always >= 0 and can be differentiated
from an error.

Tests in callers are changed from "if (err)" to "if (err < 0)", where needed.

rpc_sockname() lost "int buflen" parameter, since its only use was
to be passed to kernel_getsockname() as  and subsequently
not used in any way.

Userspace API is not changed.

 textdata bss  dec hex filename
30108430 2633624  873672 33615726 200ef6e vmlinux.before.o
30108109 2633612  873672 33615393 200ee21 vmlinux.o

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>


Please do an allmodconfig build, there are still some conversions you
missed:

security/tomoyo/network.c: In function ‘tomoyo_socket_listen_permission’:
security/tomoyo/network.c:658:19: warning: passing argument 3 of 
‘sock->ops->getname’ makes integer from pointer without a cast 
[-Wint-conversion]
 , _len, 0);
^
security/tomoyo/network.c:658:19: note: expected ‘int’ but argument is of type 
‘int *’
security/tomoyo/network.c:657:21: error: too many arguments to function 
‘sock->ops->getname’
const int error = sock->ops->getname(sock, (struct sockaddr *)
  ^~~~
fs/dlm/lowcomms.c: In function ‘lowcomms_error_report’:
fs/dlm/lowcomms.c:495:6: error: too many arguments to function 
‘kernel_getpeername’
   kernel_getpeername(con->sock, (struct sockaddr *), )) {
   ^~
fs/dlm/lowcomms.c: In function ‘tcp_accept_from_sock’:
fs/dlm/lowcomms.c:761:7: warning: passing argument 3 of ‘newsock->ops->getname’ 
makes integer from pointer without a cast [-Wint-conversion]
, 2)) {
^
fs/dlm/lowcomms.c:761:7: note: expected ‘int’ but argument is of type ‘int *’
fs/dlm/lowcomms.c:760:6: error: too many arguments to function 
‘newsock->ops->getname’
   if (newsock->ops->getname(newsock, (struct sockaddr *),
   ^~~


Sorry. Will send updated patch.
 


[PATCH] net: make getname() functions return length rather than use int* parameter

2018-02-12 Thread Denys Vlasenko
Before:
All these functions either return a negative error indicator,
or store length of sockaddr into "int *socklen" parameter
and return zero on success.

"int *socklen" parameter is awkward. For example, if caller does not
care, it still needs to provide on-stack storage for the value
it does not need.

None of the many FOO_getname() functions of various protocols
ever used old value of *socklen. They always just overwrite it.

This change drops this parameter, and makes all these functions, on success,
return length of sockaddr. It's always >= 0 and can be differentiated
from an error.

Tests in callers are changed from "if (err)" to "if (err < 0)", where needed.

rpc_sockname() lost "int buflen" parameter, since its only use was
to be passed to kernel_getsockname() as  and subsequently
not used in any way.

Userspace API is not changed.

textdata bss  dec hex filename
30108430 2633624  873672 33615726 200ef6e vmlinux.before.o
30108109 2633612  873672 33615393 200ee21 vmlinux.o

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: David S. Miller <da...@davemloft.net>
CC: linux-ker...@vger.kernel.org
CC: net...@vger.kernel.org
CC: linux-blueto...@vger.kernel.org
CC: linux-decnet-u...@lists.sourceforge.net
CC: linux-wireless@vger.kernel.org
CC: linux-r...@vger.kernel.org
CC: linux-s...@vger.kernel.org
CC: linux-...@vger.kernel.org
CC: linux-...@vger.kernel.org
---
 drivers/isdn/mISDN/socket.c|  5 ++---
 drivers/net/ppp/pppoe.c|  6 ++
 drivers/net/ppp/pptp.c |  6 ++
 drivers/scsi/iscsi_tcp.c   | 14 +++---
 drivers/soc/qcom/qmi_interface.c   |  3 +--
 drivers/staging/ipx/af_ipx.c   |  6 ++
 drivers/staging/irda/net/af_irda.c |  8 +++-
 include/linux/net.h|  8 +++-
 include/net/inet_common.h  |  2 +-
 include/net/ipv6.h |  2 +-
 include/net/sock.h |  2 +-
 net/appletalk/ddp.c|  5 ++---
 net/atm/pvc.c  |  5 ++---
 net/atm/svc.c  |  5 ++---
 net/ax25/af_ax25.c |  4 ++--
 net/bluetooth/hci_sock.c   |  4 ++--
 net/bluetooth/l2cap_sock.c |  5 ++---
 net/bluetooth/rfcomm/sock.c|  5 ++---
 net/bluetooth/sco.c|  5 ++---
 net/can/raw.c  |  6 ++
 net/core/sock.c|  5 +++--
 net/decnet/af_decnet.c |  6 ++
 net/ipv4/af_inet.c |  5 ++---
 net/ipv6/af_inet6.c|  5 ++---
 net/iucv/af_iucv.c |  5 ++---
 net/l2tp/l2tp_ip.c |  5 ++---
 net/l2tp/l2tp_ip6.c|  5 ++---
 net/l2tp/l2tp_ppp.c|  5 ++---
 net/llc/af_llc.c   |  5 ++---
 net/netlink/af_netlink.c   |  5 ++---
 net/netrom/af_netrom.c |  9 +
 net/nfc/llcp_sock.c|  5 ++---
 net/packet/af_packet.c | 10 --
 net/phonet/socket.c|  5 ++---
 net/qrtr/qrtr.c|  5 ++---
 net/rds/af_rds.c   |  5 ++---
 net/rds/tcp.c  |  7 ++-
 net/rose/af_rose.c |  5 ++---
 net/sctp/ipv6.c|  8 
 net/smc/af_smc.c   |  7 +++
 net/socket.c   | 35 +--
 net/sunrpc/clnt.c  |  6 +++---
 net/sunrpc/svcsock.c   | 13 -
 net/sunrpc/xprtsock.c  |  3 +--
 net/tipc/socket.c  |  5 ++---
 net/unix/af_unix.c | 10 +-
 net/vmw_vsock/af_vsock.c   |  4 ++--
 net/x25/af_x25.c   |  4 ++--
 48 files changed, 132 insertions(+), 171 deletions(-)

diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c
index c5603d1a07d6..1f8f489b4167 100644
--- a/drivers/isdn/mISDN/socket.c
+++ b/drivers/isdn/mISDN/socket.c
@@ -560,7 +560,7 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, 
int addr_len)
 
 static int
 data_sock_getname(struct socket *sock, struct sockaddr *addr,
- int *addr_len, int peer)
+ int peer)
 {
struct sockaddr_mISDN   *maddr = (struct sockaddr_mISDN *) addr;
struct sock *sk = sock->sk;
@@ -570,14 +570,13 @@ data_sock_getname(struct socket *sock, struct sockaddr 
*addr,
 
lock_sock(sk);
 
-   *addr_len = sizeof(*maddr);
maddr->family = AF_ISDN;
maddr->dev = _pms(sk)->dev->id;
maddr->channel = _pms(sk)->ch.nr;
maddr->sapi = _pms(sk)->ch.addr & 0xff;
maddr->tei = (_pms(sk)->ch.addr >> 8) & 0xff;
release_sock(sk);
-   return 0;
+   return sizeof(*maddr);
 }
 
 static const struct proto_ops data_sock_ops = {
diff --git a/drivers/net/ppp/pppoe.c b/drivers/

[PATCH RESEND] NFC: hci: delete unused nfc_llc_get_rx_head_tail_room()

2016-06-05 Thread Denys Vlasenko
It used to be EXPORTed, but then EXPORT usage was cleaned up
(in 2012), without noticing that the function has no users at all
(and curiously, never had any users).

Delete it.

While at it, remove non-static "inline" hints on nearby functions:
these hints don't work across compilation units anyway,
and these functions are not used in their .c file, thus they are
never inlined. IOW: "inline" here does not help in any way.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Samuel Ortiz <sa...@linux.intel.com>
CC: Christophe Ricard <christophe.ric...@gmail.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 include/net/nfc/llc.h |  4 
 net/nfc/hci/llc.c | 17 +
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/include/net/nfc/llc.h b/include/net/nfc/llc.h
index c25fbde..7ecb457 100644
--- a/include/net/nfc/llc.h
+++ b/include/net/nfc/llc.h
@@ -37,10 +37,6 @@ struct nfc_llc *nfc_llc_allocate(const char *name, struct 
nfc_hci_dev *hdev,
 int tx_tailroom, llc_failure_t llc_failure);
 void nfc_llc_free(struct nfc_llc *llc);
 
-void nfc_llc_get_rx_head_tail_room(struct nfc_llc *llc, int *rx_headroom,
-  int *rx_tailroom);
-
-
 int nfc_llc_start(struct nfc_llc *llc);
 int nfc_llc_stop(struct nfc_llc *llc);
 void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb);
diff --git a/net/nfc/hci/llc.c b/net/nfc/hci/llc.c
index 1399a03..3d699cb 100644
--- a/net/nfc/hci/llc.c
+++ b/net/nfc/hci/llc.c
@@ -133,36 +133,29 @@ void nfc_llc_free(struct nfc_llc *llc)
kfree(llc);
 }
 
-inline void nfc_llc_get_rx_head_tail_room(struct nfc_llc *llc, int 
*rx_headroom,
- int *rx_tailroom)
-{
-   *rx_headroom = llc->rx_headroom;
-   *rx_tailroom = llc->rx_tailroom;
-}
-
-inline int nfc_llc_start(struct nfc_llc *llc)
+int nfc_llc_start(struct nfc_llc *llc)
 {
return llc->ops->start(llc);
 }
 EXPORT_SYMBOL(nfc_llc_start);
 
-inline int nfc_llc_stop(struct nfc_llc *llc)
+int nfc_llc_stop(struct nfc_llc *llc)
 {
return llc->ops->stop(llc);
 }
 EXPORT_SYMBOL(nfc_llc_stop);
 
-inline void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb)
+void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb)
 {
llc->ops->rcv_from_drv(llc, skb);
 }
 
-inline int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb)
+int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb)
 {
return llc->ops->xmit_from_hci(llc, skb);
 }
 
-inline void *nfc_llc_get_data(struct nfc_llc *llc)
+void *nfc_llc_get_data(struct nfc_llc *llc)
 {
return llc->data;
 }
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] rtlwifi: rtl818x: Deinline indexed IO functions, save 21568 bytes

2016-04-25 Thread Denys Vlasenko
rtl818x_ioread8_idx: 151 bytes, 29 calls
rtl818x_ioread16_idx: 151 bytes, 11 calls
rtl818x_ioread32_idx: 151 bytes, 5 calls
rtl818x_iowrite8_idx: 157 bytes, 117 calls
rtl818x_iowrite16_idx: 158 bytes, 74 calls
rtl818x_iowrite32_idx: 157 bytes, 22 calls

Each of these functions has a pair of mutex lock/unlock ops,
both of these ops perform atomic updates of memory (on x86, it boils down to
"lock cmpxchg %reg,mem" insn), which are 4-8 times more expensive than 
call+return.

text data  bss   dec hex filename
95894242 20860288 35991552 152746082 91ab862 vmlinux_before
95872674 20860320 35991552 152724546 91a6442 vmlinux

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Larry Finger <larry.fin...@lwfinger.net>
CC: Chaoming Li <chaoming...@realsil.com.cn>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 .../net/wireless/realtek/rtl818x/rtl8187/rtl8187.h | 99 +++---
 .../net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 93 
 2 files changed, 105 insertions(+), 87 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h 
b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h
index a6ad79f..324451d 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.h
@@ -160,104 +160,40 @@ struct rtl8187_priv {
 
 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
 
-static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
-u8 *addr, u8 idx)
-{
-   u8 val;
-
-   mutex_lock(>io_mutex);
-   usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
-   RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-   (unsigned long)addr, idx & 0x03,
-   >io_dmabuf->bits8, sizeof(val), HZ / 2);
-
-   val = priv->io_dmabuf->bits8;
-   mutex_unlock(>io_mutex);
-
-   return val;
-}
+u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
+   u8 *addr, u8 idx);
 
 static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr)
 {
return rtl818x_ioread8_idx(priv, addr, 0);
 }
 
-static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
-  __le16 *addr, u8 idx)
-{
-   __le16 val;
-
-   mutex_lock(>io_mutex);
-   usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
-   RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-   (unsigned long)addr, idx & 0x03,
-   >io_dmabuf->bits16, sizeof(val), HZ / 2);
-
-   val = priv->io_dmabuf->bits16;
-   mutex_unlock(>io_mutex);
-
-   return le16_to_cpu(val);
-}
+u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
+   __le16 *addr, u8 idx);
 
 static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr)
 {
return rtl818x_ioread16_idx(priv, addr, 0);
 }
 
-static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
-  __le32 *addr, u8 idx)
-{
-   __le32 val;
-
-   mutex_lock(>io_mutex);
-   usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
-   RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-   (unsigned long)addr, idx & 0x03,
-   >io_dmabuf->bits32, sizeof(val), HZ / 2);
-
-   val = priv->io_dmabuf->bits32;
-   mutex_unlock(>io_mutex);
-
-   return le32_to_cpu(val);
-}
+u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
+   __le32 *addr, u8 idx);
 
 static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
 {
return rtl818x_ioread32_idx(priv, addr, 0);
 }
 
-static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
-   u8 *addr, u8 val, u8 idx)
-{
-   mutex_lock(>io_mutex);
-
-   priv->io_dmabuf->bits8 = val;
-   usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
-   RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-   (unsigned long)addr, idx & 0x03,
-   >io_dmabuf->bits8, sizeof(val), HZ / 2);
-
-   mutex_unlock(>io_mutex);
-}
+void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
+   u8 *addr, u8 val, u8 idx);
 
 static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 
val)
 {
rtl818x_iowrite8_idx(priv, addr, val, 0);
 }
 
-static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
-__le16 *addr, u16 val, u8 idx)
-{
-   mutex_lock(>io_mutex);
-
-   priv->io_dmabuf->bits16 = cpu_to_le16(val);
-   usb_control_msg(priv->udev, 

[PATCH] NFC: hci: delete unused nfc_llc_get_rx_head_tail_room()

2016-04-15 Thread Denys Vlasenko
It used to be EXPORTed, but then EXPORT usage was cleaned up
(in 2012), without noticing that the function has no users at all
(and curiously, never had any users).

Delete it.

While at it, remove non-static "inline" hints on nearby functions:
these hints don't work across compilation units anyway,
and these functions are not used in their .c file, thus they are
never inlined. IOW: "inline" here does not help in any way.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Samuel Ortiz <sa...@linux.intel.com>
CC: Christophe Ricard <christophe.ric...@gmail.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 include/net/nfc/llc.h |  4 
 net/nfc/hci/llc.c | 17 +
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/include/net/nfc/llc.h b/include/net/nfc/llc.h
index c25fbde..7ecb457 100644
--- a/include/net/nfc/llc.h
+++ b/include/net/nfc/llc.h
@@ -37,10 +37,6 @@ struct nfc_llc *nfc_llc_allocate(const char *name, struct 
nfc_hci_dev *hdev,
 int tx_tailroom, llc_failure_t llc_failure);
 void nfc_llc_free(struct nfc_llc *llc);
 
-void nfc_llc_get_rx_head_tail_room(struct nfc_llc *llc, int *rx_headroom,
-  int *rx_tailroom);
-
-
 int nfc_llc_start(struct nfc_llc *llc);
 int nfc_llc_stop(struct nfc_llc *llc);
 void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb);
diff --git a/net/nfc/hci/llc.c b/net/nfc/hci/llc.c
index 1399a03..3d699cb 100644
--- a/net/nfc/hci/llc.c
+++ b/net/nfc/hci/llc.c
@@ -133,36 +133,29 @@ void nfc_llc_free(struct nfc_llc *llc)
kfree(llc);
 }
 
-inline void nfc_llc_get_rx_head_tail_room(struct nfc_llc *llc, int 
*rx_headroom,
- int *rx_tailroom)
-{
-   *rx_headroom = llc->rx_headroom;
-   *rx_tailroom = llc->rx_tailroom;
-}
-
-inline int nfc_llc_start(struct nfc_llc *llc)
+int nfc_llc_start(struct nfc_llc *llc)
 {
return llc->ops->start(llc);
 }
 EXPORT_SYMBOL(nfc_llc_start);
 
-inline int nfc_llc_stop(struct nfc_llc *llc)
+int nfc_llc_stop(struct nfc_llc *llc)
 {
return llc->ops->stop(llc);
 }
 EXPORT_SYMBOL(nfc_llc_stop);
 
-inline void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb)
+void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb)
 {
llc->ops->rcv_from_drv(llc, skb);
 }
 
-inline int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb)
+int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb)
 {
return llc->ops->xmit_from_hci(llc, skb);
 }
 
-inline void *nfc_llc_get_data(struct nfc_llc *llc)
+void *nfc_llc_get_data(struct nfc_llc *llc)
 {
return llc->data;
 }
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] iwlwifi: Deinline iwl_write8/write32/read32()

2015-09-24 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining these functions have sizes and callsite counts
as follows:

iwl_write8: 315 bytes, 3 calls
iwl_write32: 296 bytes, 90 calls
iwl_read32: 278 bytes, 51 calls

Total size reduction is about 40 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: Emmanuel Grumbach <emmanuel.grumb...@intel.com>
CC: Intel Linux Wireless <i...@linux.intel.com>
CC: Gregory Greenman <gregory.green...@intel.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 drivers/net/wireless/iwlwifi/iwl-io.c | 22 ++
 drivers/net/wireless/iwlwifi/iwl-io.h | 21 +++--
 2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c 
b/drivers/net/wireless/iwlwifi/iwl-io.c
index 27c66e4..782e7e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -38,6 +38,28 @@
 
 #define IWL_POLL_INTERVAL 10   /* microseconds */
 
+void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
+{
+   trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val);
+   iwl_trans_write8(trans, ofs, val);
+}
+IWL_EXPORT_SYMBOL(iwl_write8);
+
+void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val)
+{
+   trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val);
+   iwl_trans_write32(trans, ofs, val);
+}
+IWL_EXPORT_SYMBOL(iwl_write32);
+
+u32 iwl_read32(struct iwl_trans *trans, u32 ofs)
+{
+   u32 val = iwl_trans_read32(trans, ofs);
+   trace_iwlwifi_dev_ioread32(trans->dev, ofs, val);
+   return val;
+}
+IWL_EXPORT_SYMBOL(iwl_read32);
+
 int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
 u32 bits, u32 mask, int timeout)
 {
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h 
b/drivers/net/wireless/iwlwifi/iwl-io.h
index 705d12c..501d056 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -32,24 +32,9 @@
 #include "iwl-devtrace.h"
 #include "iwl-trans.h"
 
-static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
-{
-   trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val);
-   iwl_trans_write8(trans, ofs, val);
-}
-
-static inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val)
-{
-   trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val);
-   iwl_trans_write32(trans, ofs, val);
-}
-
-static inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs)
-{
-   u32 val = iwl_trans_read32(trans, ofs);
-   trace_iwlwifi_dev_ioread32(trans->dev, ofs, val);
-   return val;
-}
+void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val);
+void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val);
+u32 iwl_read32(struct iwl_trans *trans, u32 ofs);
 
 static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask)
 {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] mac80211: Deinline drv_ampdu_action()

2015-09-23 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining the function size is 755 bytes and there are
6 callsites.

Total size reduction is about 3.3 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---

Rediffed against mac80211-next

 net/mac80211/driver-ops.c | 26 ++
 net/mac80211/driver-ops.h | 30 +-
 2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 54581ce..4f7c81d 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -191,3 +191,29 @@ drv_switch_vif_chanctx(struct ieee80211_local *local,
 
return ret;
 }
+
+int drv_ampdu_action(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+enum ieee80211_ampdu_mlme_action action,
+struct ieee80211_sta *sta, u16 tid,
+u16 *ssn, u8 buf_size, bool amsdu)
+{
+   int ret = -EOPNOTSUPP;
+
+   might_sleep();
+
+   sdata = get_bss_sdata(sdata);
+   if (!check_sdata_in_driver(sdata))
+   return -EIO;
+
+   trace_drv_ampdu_action(local, sdata, action, sta, tid,
+  ssn, buf_size, amsdu);
+
+   if (local->ops->ampdu_action)
+   ret = local->ops->ampdu_action(>hw, >vif, action,
+  sta, tid, ssn, buf_size, amsdu);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 1cf1b4a..7f08d82 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -649,31 +649,11 @@ static inline int drv_tx_last_beacon(struct 
ieee80211_local *local)
return ret;
 }
 
-static inline int drv_ampdu_action(struct ieee80211_local *local,
-  struct ieee80211_sub_if_data *sdata,
-  enum ieee80211_ampdu_mlme_action action,
-  struct ieee80211_sta *sta, u16 tid,
-  u16 *ssn, u8 buf_size, bool amsdu)
-{
-   int ret = -EOPNOTSUPP;
-
-   might_sleep();
-
-   sdata = get_bss_sdata(sdata);
-   if (!check_sdata_in_driver(sdata))
-   return -EIO;
-
-   trace_drv_ampdu_action(local, sdata, action, sta, tid,
-  ssn, buf_size, amsdu);
-
-   if (local->ops->ampdu_action)
-   ret = local->ops->ampdu_action(>hw, >vif, action,
-  sta, tid, ssn, buf_size, amsdu);
-
-   trace_drv_return_int(local, ret);
-
-   return ret;
-}
+int drv_ampdu_action(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+enum ieee80211_ampdu_mlme_action action,
+struct ieee80211_sta *sta, u16 tid,
+u16 *ssn, u8 buf_size, bool amsdu);
 
 static inline int drv_get_survey(struct ieee80211_local *local, int idx,
struct survey_info *survey)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] mac80211: Deinline drv_get/set/reset_tsf()

2015-09-23 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining these functions have sizes and callsite counts
as follows:

drv_get_tsf: 634 bytes, 6 calls
drv_set_tsf: 626 bytes, 2 calls
drv_reset_tsf: 617 bytes, 2 calls

Total size reduction is about 4.2 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---

Rediffed against mac80211-next

 net/mac80211/driver-ops.c | 46 +
 net/mac80211/driver-ops.h | 52 +++
 2 files changed, 53 insertions(+), 45 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 4f7c81d..5d51a5d 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -139,6 +139,52 @@ int drv_conf_tx(struct ieee80211_local *local,
return ret;
 }
 
+u64 drv_get_tsf(struct ieee80211_local *local,
+   struct ieee80211_sub_if_data *sdata)
+{
+   u64 ret = -1ULL;
+
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return ret;
+
+   trace_drv_get_tsf(local, sdata);
+   if (local->ops->get_tsf)
+   ret = local->ops->get_tsf(>hw, >vif);
+   trace_drv_return_u64(local, ret);
+   return ret;
+}
+
+void drv_set_tsf(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+u64 tsf)
+{
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return;
+
+   trace_drv_set_tsf(local, sdata, tsf);
+   if (local->ops->set_tsf)
+   local->ops->set_tsf(>hw, >vif, tsf);
+   trace_drv_return_void(local);
+}
+
+void drv_reset_tsf(struct ieee80211_local *local,
+  struct ieee80211_sub_if_data *sdata)
+{
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return;
+
+   trace_drv_reset_tsf(local, sdata);
+   if (local->ops->reset_tsf)
+   local->ops->reset_tsf(>hw, >vif);
+   trace_drv_return_void(local);
+}
+
 int
 drv_switch_vif_chanctx(struct ieee80211_local *local,
   struct ieee80211_vif_chanctx_switch *vifs,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 7f08d82..5ef28af 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -590,51 +590,13 @@ int drv_conf_tx(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, u16 ac,
const struct ieee80211_tx_queue_params *params);
 
-static inline u64 drv_get_tsf(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata)
-{
-   u64 ret = -1ULL;
-
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return ret;
-
-   trace_drv_get_tsf(local, sdata);
-   if (local->ops->get_tsf)
-   ret = local->ops->get_tsf(>hw, >vif);
-   trace_drv_return_u64(local, ret);
-   return ret;
-}
-
-static inline void drv_set_tsf(struct ieee80211_local *local,
-  struct ieee80211_sub_if_data *sdata,
-  u64 tsf)
-{
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return;
-
-   trace_drv_set_tsf(local, sdata, tsf);
-   if (local->ops->set_tsf)
-   local->ops->set_tsf(>hw, >vif, tsf);
-   trace_drv_return_void(local);
-}
-
-static inline void drv_reset_tsf(struct ieee80211_local *local,
-struct ieee80211_sub_if_data *sdata)
-{
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return;
-
-   trace_drv_reset_tsf(local, sdata);
-   if (local->ops->reset_tsf)
-   local->ops->reset_tsf(>hw, >vif);
-   trace_drv_return_void(local);
-}
+u64 drv_get_tsf(struct ieee80211_local *local,
+   struct ieee80211_sub_if_data *sdata);
+void drv_set_tsf(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+u64 tsf);
+void drv_reset_tsf(struct ieee80211_local *local,
+  struct ieee80211_sub_if_data *sdata);
 
 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
 {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] mac80211: Deinline drv_switch_vif_chanctx()

2015-09-23 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining the function size is 821 bytes and there are
2 callsites, reducing code size by about 800 bytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---

Rediffed against mac80211-next

 net/mac80211/driver-ops.c | 53 +++
 net/mac80211/driver-ops.h | 51 ++---
 2 files changed, 55 insertions(+), 49 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index b284e6e..54581ce 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -138,3 +138,56 @@ int drv_conf_tx(struct ieee80211_local *local,
trace_drv_return_int(local, ret);
return ret;
 }
+
+int
+drv_switch_vif_chanctx(struct ieee80211_local *local,
+  struct ieee80211_vif_chanctx_switch *vifs,
+  int n_vifs,
+  enum ieee80211_chanctx_switch_mode mode)
+{
+   int ret = 0;
+   int i;
+
+   if (!local->ops->switch_vif_chanctx)
+   return -EOPNOTSUPP;
+
+   for (i = 0; i < n_vifs; i++) {
+   struct ieee80211_chanctx *new_ctx =
+   container_of(vifs[i].new_ctx,
+struct ieee80211_chanctx,
+conf);
+   struct ieee80211_chanctx *old_ctx =
+   container_of(vifs[i].old_ctx,
+struct ieee80211_chanctx,
+conf);
+
+   WARN_ON_ONCE(!old_ctx->driver_present);
+   WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
+ new_ctx->driver_present) ||
+(mode == CHANCTX_SWMODE_REASSIGN_VIF &&
+ !new_ctx->driver_present));
+   }
+
+   trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
+   ret = local->ops->switch_vif_chanctx(>hw,
+vifs, n_vifs, mode);
+   trace_drv_return_int(local, ret);
+
+   if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) {
+   for (i = 0; i < n_vifs; i++) {
+   struct ieee80211_chanctx *new_ctx =
+   container_of(vifs[i].new_ctx,
+struct ieee80211_chanctx,
+conf);
+   struct ieee80211_chanctx *old_ctx =
+   container_of(vifs[i].old_ctx,
+struct ieee80211_chanctx,
+conf);
+
+   new_ctx->driver_present = true;
+   old_ctx->driver_present = false;
+   }
+   }
+
+   return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0baeefd..1cf1b4a 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1002,58 +1002,11 @@ static inline void drv_unassign_vif_chanctx(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
-static inline int
+int
 drv_switch_vif_chanctx(struct ieee80211_local *local,
   struct ieee80211_vif_chanctx_switch *vifs,
   int n_vifs,
-  enum ieee80211_chanctx_switch_mode mode)
-{
-   int ret = 0;
-   int i;
-
-   if (!local->ops->switch_vif_chanctx)
-   return -EOPNOTSUPP;
-
-   for (i = 0; i < n_vifs; i++) {
-   struct ieee80211_chanctx *new_ctx =
-   container_of(vifs[i].new_ctx,
-struct ieee80211_chanctx,
-conf);
-   struct ieee80211_chanctx *old_ctx =
-   container_of(vifs[i].old_ctx,
-struct ieee80211_chanctx,
-conf);
-
-   WARN_ON_ONCE(!old_ctx->driver_present);
-   WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
- new_ctx->driver_present) ||
-(mode == CHANCTX_SWMODE_REASSIGN_VIF &&
- !new_ctx->driver_present));
-   }
-
-   trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
-   ret = local->ops->switch_vif_chanctx(>hw,
-vifs, n_vifs, mode);
-   trace_drv_return_int(local, ret);
-
-   if (!ret && mode == C

[PATCH 3/6] mac80211: Deinline drv_ampdu_action()

2015-09-18 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining the function size is 755 bytes and there are
6 callsites.

Total size reduction is about 3.3 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/driver-ops.c | 25 +
 net/mac80211/driver-ops.h | 29 +
 2 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index b85f6ff..476d684 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -84,3 +84,28 @@ int drv_conf_tx(struct ieee80211_local *local,
trace_drv_return_int(local, ret);
return ret;
 }
+
+int drv_ampdu_action(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+enum ieee80211_ampdu_mlme_action action,
+struct ieee80211_sta *sta, u16 tid,
+u16 *ssn, u8 buf_size)
+{
+   int ret = -EOPNOTSUPP;
+
+   might_sleep();
+
+   sdata = get_bss_sdata(sdata);
+   if (!check_sdata_in_driver(sdata))
+   return -EIO;
+
+   trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
+
+   if (local->ops->ampdu_action)
+   ret = local->ops->ampdu_action(>hw, >vif, action,
+  sta, tid, ssn, buf_size);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index fdde11e..92e7cf1 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -677,30 +677,11 @@ static inline int drv_tx_last_beacon(struct 
ieee80211_local *local)
return ret;
 }
 
-static inline int drv_ampdu_action(struct ieee80211_local *local,
-  struct ieee80211_sub_if_data *sdata,
-  enum ieee80211_ampdu_mlme_action action,
-  struct ieee80211_sta *sta, u16 tid,
-  u16 *ssn, u8 buf_size)
-{
-   int ret = -EOPNOTSUPP;
-
-   might_sleep();
-
-   sdata = get_bss_sdata(sdata);
-   if (!check_sdata_in_driver(sdata))
-   return -EIO;
-
-   trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
-
-   if (local->ops->ampdu_action)
-   ret = local->ops->ampdu_action(>hw, >vif, action,
-  sta, tid, ssn, buf_size);
-
-   trace_drv_return_int(local, ret);
-
-   return ret;
-}
+int drv_ampdu_action(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+enum ieee80211_ampdu_mlme_action action,
+struct ieee80211_sta *sta, u16 tid,
+u16 *ssn, u8 buf_size);
 
 static inline int drv_get_survey(struct ieee80211_local *local, int idx,
struct survey_info *survey)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] mac80211: Deinline drv_get/set/reset_tsf()

2015-09-18 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining these functions have sizes and callsite counts
as follows:

drv_get_tsf: 634 bytes, 6 calls
drv_set_tsf: 626 bytes, 2 calls
drv_reset_tsf: 617 bytes, 2 calls

Total size reduction is about 4.2 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/driver-ops.c | 46 +++
 net/mac80211/driver-ops.h | 50 +++
 2 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 476d684..1c91a22 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -85,6 +85,52 @@ int drv_conf_tx(struct ieee80211_local *local,
return ret;
 }
 
+u64 drv_get_tsf(struct ieee80211_local *local,
+   struct ieee80211_sub_if_data *sdata)
+{
+   u64 ret = -1ULL;
+
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return ret;
+
+   trace_drv_get_tsf(local, sdata);
+   if (local->ops->get_tsf)
+   ret = local->ops->get_tsf(>hw, >vif);
+   trace_drv_return_u64(local, ret);
+   return ret;
+}
+
+void drv_set_tsf(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+u64 tsf)
+{
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return;
+
+   trace_drv_set_tsf(local, sdata, tsf);
+   if (local->ops->set_tsf)
+   local->ops->set_tsf(>hw, >vif, tsf);
+   trace_drv_return_void(local);
+}
+
+void drv_reset_tsf(struct ieee80211_local *local,
+  struct ieee80211_sub_if_data *sdata)
+{
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return;
+
+   trace_drv_reset_tsf(local, sdata);
+   if (local->ops->reset_tsf)
+   local->ops->reset_tsf(>hw, >vif);
+   trace_drv_return_void(local);
+}
+
 int drv_ampdu_action(struct ieee80211_local *local,
 struct ieee80211_sub_if_data *sdata,
 enum ieee80211_ampdu_mlme_action action,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 92e7cf1..62999a7 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -618,51 +618,15 @@ int drv_conf_tx(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, u16 ac,
const struct ieee80211_tx_queue_params *params);
 
-static inline u64 drv_get_tsf(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata)
-{
-   u64 ret = -1ULL;
-
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return ret;
-
-   trace_drv_get_tsf(local, sdata);
-   if (local->ops->get_tsf)
-   ret = local->ops->get_tsf(>hw, >vif);
-   trace_drv_return_u64(local, ret);
-   return ret;
-}
+u64 drv_get_tsf(struct ieee80211_local *local,
+   struct ieee80211_sub_if_data *sdata);
 
-static inline void drv_set_tsf(struct ieee80211_local *local,
-  struct ieee80211_sub_if_data *sdata,
-  u64 tsf)
-{
-   might_sleep();
+void drv_set_tsf(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+u64 tsf);
 
-   if (!check_sdata_in_driver(sdata))
-   return;
-
-   trace_drv_set_tsf(local, sdata, tsf);
-   if (local->ops->set_tsf)
-   local->ops->set_tsf(>hw, >vif, tsf);
-   trace_drv_return_void(local);
-}
-
-static inline void drv_reset_tsf(struct ieee80211_local *local,
-struct ieee80211_sub_if_data *sdata)
-{
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return;
-
-   trace_drv_reset_tsf(local, sdata);
-   if (local->ops->reset_tsf)
-   local->ops->reset_tsf(>hw, >vif);
-   trace_drv_return_void(local);
-}
+void drv_reset_tsf(struct ieee80211_local *local,
+  struct ieee80211_sub_if_data *sdata);
 
 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
 {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] mac80211: Deinline drv_conf_tx()

2015-09-18 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining the function size is 785 bytes and there are
7 callsites.

Total size reduction is about 3.5 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/driver-ops.c | 25 +
 net/mac80211/driver-ops.h | 27 +++
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 267c3b1..b28e66ca 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -39,3 +39,28 @@ int drv_sta_state(struct ieee80211_local *local,
trace_drv_return_int(local, ret);
return ret;
 }
+
+int drv_conf_tx(struct ieee80211_local *local,
+   struct ieee80211_sub_if_data *sdata, u16 ac,
+   const struct ieee80211_tx_queue_params *params)
+{
+   int ret = -EOPNOTSUPP;
+
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return -EIO;
+
+   if (WARN_ONCE(params->cw_min == 0 ||
+ params->cw_min > params->cw_max,
+ "%s: invalid CW_min/CW_max: %d/%d\n",
+ sdata->name, params->cw_min, params->cw_max))
+   return -EINVAL;
+
+   trace_drv_conf_tx(local, sdata, ac, params);
+   if (local->ops->conf_tx)
+   ret = local->ops->conf_tx(>hw, >vif,
+ ac, params);
+   trace_drv_return_int(local, ret);
+   return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 02d9133..bac456b 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -630,30 +630,9 @@ static inline void drv_sta_statistics(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
-static inline int drv_conf_tx(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata, u16 ac,
- const struct ieee80211_tx_queue_params *params)
-{
-   int ret = -EOPNOTSUPP;
-
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return -EIO;
-
-   if (WARN_ONCE(params->cw_min == 0 ||
- params->cw_min > params->cw_max,
- "%s: invalid CW_min/CW_max: %d/%d\n",
- sdata->name, params->cw_min, params->cw_max))
-   return -EINVAL;
-
-   trace_drv_conf_tx(local, sdata, ac, params);
-   if (local->ops->conf_tx)
-   ret = local->ops->conf_tx(>hw, >vif,
- ac, params);
-   trace_drv_return_int(local, ret);
-   return ret;
-}
+int drv_conf_tx(struct ieee80211_local *local,
+   struct ieee80211_sub_if_data *sdata, u16 ac,
+   const struct ieee80211_tx_queue_params *params);
 
 static inline u64 drv_get_tsf(struct ieee80211_local *local,
  struct ieee80211_sub_if_data *sdata)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] mac80211: Deinline drv_sta_rc_update()

2015-09-18 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining the function size is 706 bytes and there are
2 callsites, reducing code size by about 700 bytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/driver-ops.c | 20 
 net/mac80211/driver-ops.h | 22 +++---
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index b28e66ca..b85f6ff 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -40,6 +40,26 @@ int drv_sta_state(struct ieee80211_local *local,
return ret;
 }
 
+void drv_sta_rc_update(struct ieee80211_local *local,
+  struct ieee80211_sub_if_data *sdata,
+  struct ieee80211_sta *sta, u32 changed)
+{
+   sdata = get_bss_sdata(sdata);
+   if (!check_sdata_in_driver(sdata))
+   return;
+
+   WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
+   (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
+sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
+
+   trace_drv_sta_rc_update(local, sdata, sta, changed);
+   if (local->ops->sta_rc_update)
+   local->ops->sta_rc_update(>hw, >vif,
+ sta, changed);
+
+   trace_drv_return_void(local);
+}
+
 int drv_conf_tx(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, u16 ac,
const struct ieee80211_tx_queue_params *params)
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index bac456b..fdde11e 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -580,25 +580,9 @@ int drv_sta_state(struct ieee80211_local *local,
  enum ieee80211_sta_state old_state,
  enum ieee80211_sta_state new_state);
 
-static inline void drv_sta_rc_update(struct ieee80211_local *local,
-struct ieee80211_sub_if_data *sdata,
-struct ieee80211_sta *sta, u32 changed)
-{
-   sdata = get_bss_sdata(sdata);
-   if (!check_sdata_in_driver(sdata))
-   return;
-
-   WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
-   (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
-
-   trace_drv_sta_rc_update(local, sdata, sta, changed);
-   if (local->ops->sta_rc_update)
-   local->ops->sta_rc_update(>hw, >vif,
- sta, changed);
-
-   trace_drv_return_void(local);
-}
+void drv_sta_rc_update(struct ieee80211_local *local,
+  struct ieee80211_sub_if_data *sdata,
+  struct ieee80211_sta *sta, u32 changed);
 
 static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
   struct ieee80211_sub_if_data *sdata,
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] mac80211: Deinline drv_add/remove/change_interface()

2015-09-18 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining these functions have sizes and callsite counts
as follows:

drv_add_interface: 638 bytes, 5 calls
drv_remove_interface: 611 bytes, 6 calls
drv_change_interface: 658 bytes, 1 call

Total size reduction is about 9 kbytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/driver-ops.c | 54 +++
 net/mac80211/driver-ops.h | 58 ++-
 2 files changed, 61 insertions(+), 51 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 1c91a22..3e144b9 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -8,6 +8,60 @@
 #include "trace.h"
 #include "driver-ops.h"
 
+int drv_add_interface(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata)
+{
+   int ret;
+
+   might_sleep();
+
+   if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
+   (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
+!ieee80211_hw_check(>hw, WANT_MONITOR_VIF) &&
+!(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE
+   return -EINVAL;
+
+   trace_drv_add_interface(local, sdata);
+   ret = local->ops->add_interface(>hw, >vif);
+   trace_drv_return_int(local, ret);
+
+   if (ret == 0)
+   sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
+
+   return ret;
+}
+
+int drv_change_interface(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+enum nl80211_iftype type, bool p2p)
+{
+   int ret;
+
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return -EIO;
+
+   trace_drv_change_interface(local, sdata, type, p2p);
+   ret = local->ops->change_interface(>hw, >vif, type, p2p);
+   trace_drv_return_int(local, ret);
+   return ret;
+}
+
+void drv_remove_interface(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata)
+{
+   might_sleep();
+
+   if (!check_sdata_in_driver(sdata))
+   return;
+
+   trace_drv_remove_interface(local, sdata);
+   local->ops->remove_interface(>hw, >vif);
+   sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
+   trace_drv_return_void(local);
+}
+
 __must_check
 int drv_sta_state(struct ieee80211_local *local,
  struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 62999a7..518c574 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -137,59 +137,15 @@ static inline void drv_set_wakeup(struct ieee80211_local 
*local,
 }
 #endif
 
-static inline int drv_add_interface(struct ieee80211_local *local,
-   struct ieee80211_sub_if_data *sdata)
-{
-   int ret;
-
-   might_sleep();
-
-   if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
-   (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
-!ieee80211_hw_check(>hw, WANT_MONITOR_VIF) &&
-!(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE
-   return -EINVAL;
-
-   trace_drv_add_interface(local, sdata);
-   ret = local->ops->add_interface(>hw, >vif);
-   trace_drv_return_int(local, ret);
-
-   if (ret == 0)
-   sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
-
-   return ret;
-}
-
-static inline int drv_change_interface(struct ieee80211_local *local,
-  struct ieee80211_sub_if_data *sdata,
-  enum nl80211_iftype type, bool p2p)
-{
-   int ret;
-
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return -EIO;
-
-   trace_drv_change_interface(local, sdata, type, p2p);
-   ret = local->ops->change_interface(>hw, >vif, type, p2p);
-   trace_drv_return_int(local, ret);
-   return ret;
-}
+int drv_add_interface(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata);
 
-static inline void drv_remove_interface(struct ieee80211_local *local,
-   struct ieee80211_sub_if_data *sdata)
-{
-   might_sleep();
-
-   if (!check_sdata_in_driver(sdata))
-   return;
+int drv_change_interface(struct ieee80211_local *local,
+struct ieee80211_sub_if_data *sdata,
+enum nl80211_iftype type, bool p2p);
 

[PATCH 0/6] mac80211: Deinline large functions in driver-ops.h

2015-09-18 Thread Denys Vlasenko
After measuring size of inlines, these functions were found to be largest.
These patches reduce code size by about 21 kbytes.

CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org

Denys Vlasenko (6):
  mac80211: Deinline drv_conf_tx()
  mac80211: Deinline drv_sta_rc_update()
  mac80211: Deinline drv_ampdu_action()
  mac80211: Deinline drv_get/set/reset_tsf()
  mac80211: Deinline drv_add/remove/change_interface()
  mac80211: Deinline drv_switch_vif_chanctx()

 net/mac80211/driver-ops.c | 223 +++
 net/mac80211/driver-ops.h | 237 ++
 2 files changed, 250 insertions(+), 210 deletions(-)

-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] mac80211: Deinline drv_switch_vif_chanctx()

2015-09-18 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config_ALLYES_Os,
after deinlining the function size is 821 bytes and there are
2 callsites, reducing code size by about 800 bytes.

Signed-off-by: Denys Vlasenko <dvlas...@redhat.com>
CC: John Linville <linvi...@tuxdriver.com>
CC: Michal Kazior <michal.kaz...@tieto.com>
CC: Johannes Berg <johannes.b...@intel.com>
CC: linux-wireless@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/driver-ops.c | 53 +++
 net/mac80211/driver-ops.h | 51 ++---
 2 files changed, 55 insertions(+), 49 deletions(-)

diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 3e144b9..e4d68d7 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -209,3 +209,56 @@ int drv_ampdu_action(struct ieee80211_local *local,
 
return ret;
 }
+
+int
+drv_switch_vif_chanctx(struct ieee80211_local *local,
+  struct ieee80211_vif_chanctx_switch *vifs,
+  int n_vifs,
+  enum ieee80211_chanctx_switch_mode mode)
+{
+   int ret = 0;
+   int i;
+
+   if (!local->ops->switch_vif_chanctx)
+   return -EOPNOTSUPP;
+
+   for (i = 0; i < n_vifs; i++) {
+   struct ieee80211_chanctx *new_ctx =
+   container_of(vifs[i].new_ctx,
+struct ieee80211_chanctx,
+conf);
+   struct ieee80211_chanctx *old_ctx =
+   container_of(vifs[i].old_ctx,
+struct ieee80211_chanctx,
+conf);
+
+   WARN_ON_ONCE(!old_ctx->driver_present);
+   WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
+ new_ctx->driver_present) ||
+(mode == CHANCTX_SWMODE_REASSIGN_VIF &&
+ !new_ctx->driver_present));
+   }
+
+   trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
+   ret = local->ops->switch_vif_chanctx(>hw,
+vifs, n_vifs, mode);
+   trace_drv_return_int(local, ret);
+
+   if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) {
+   for (i = 0; i < n_vifs; i++) {
+   struct ieee80211_chanctx *new_ctx =
+   container_of(vifs[i].new_ctx,
+struct ieee80211_chanctx,
+conf);
+   struct ieee80211_chanctx *old_ctx =
+   container_of(vifs[i].old_ctx,
+struct ieee80211_chanctx,
+conf);
+
+   new_ctx->driver_present = true;
+   old_ctx->driver_present = false;
+   }
+   }
+
+   return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 518c574..79f8234 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -930,58 +930,11 @@ static inline void drv_unassign_vif_chanctx(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
-static inline int
+int
 drv_switch_vif_chanctx(struct ieee80211_local *local,
   struct ieee80211_vif_chanctx_switch *vifs,
   int n_vifs,
-  enum ieee80211_chanctx_switch_mode mode)
-{
-   int ret = 0;
-   int i;
-
-   if (!local->ops->switch_vif_chanctx)
-   return -EOPNOTSUPP;
-
-   for (i = 0; i < n_vifs; i++) {
-   struct ieee80211_chanctx *new_ctx =
-   container_of(vifs[i].new_ctx,
-struct ieee80211_chanctx,
-conf);
-   struct ieee80211_chanctx *old_ctx =
-   container_of(vifs[i].old_ctx,
-struct ieee80211_chanctx,
-conf);
-
-   WARN_ON_ONCE(!old_ctx->driver_present);
-   WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
- new_ctx->driver_present) ||
-(mode == CHANCTX_SWMODE_REASSIGN_VIF &&
- !new_ctx->driver_present));
-   }
-
-   trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
-   ret = local->ops->switch_vif_chanctx(>hw,
-vifs, n_vifs, mode);
-   trace_drv_return_int(local, ret);
-
-   if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) {
-   for (i = 0; i &l

[PATCH] mac80211: Deinline drv_sta_state

2015-07-15 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config,
after deinlining the function size is 3132 bytes and there are
7 callsites.

Total size reduction: about 20 kbytes.

Signed-off-by: Denys Vlasenko dvlas...@redhat.com
CC: John Linville linvi...@tuxdriver.com
CC: Michal Kazior michal.kaz...@tieto.com
Cc: Johannes Berg johannes.b...@intel.com
Cc: linux-wireless@vger.kernel.org
Cc: net...@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/Makefile |  1 +
 net/mac80211/driver-ops.c | 41 +
 net/mac80211/driver-ops.h | 29 ++---
 3 files changed, 44 insertions(+), 27 deletions(-)
 create mode 100644 net/mac80211/driver-ops.c

diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 3275f01..783e891 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_MAC80211) += mac80211.o
 # mac80211 objects
 mac80211-y := \
main.o status.o \
+   driver-ops.o \
sta_info.o \
wep.o \
wpa.o \
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
new file mode 100644
index 000..267c3b1
--- /dev/null
+++ b/net/mac80211/driver-ops.c
@@ -0,0 +1,41 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include net/mac80211.h
+#include ieee80211_i.h
+#include trace.h
+#include driver-ops.h
+
+__must_check
+int drv_sta_state(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct sta_info *sta,
+ enum ieee80211_sta_state old_state,
+ enum ieee80211_sta_state new_state)
+{
+   int ret = 0;
+
+   might_sleep();
+
+   sdata = get_bss_sdata(sdata);
+   if (!check_sdata_in_driver(sdata))
+   return -EIO;
+
+   trace_drv_sta_state(local, sdata, sta-sta, old_state, new_state);
+   if (local-ops-sta_state) {
+   ret = local-ops-sta_state(local-hw, sdata-vif, sta-sta,
+   old_state, new_state);
+   } else if (old_state == IEEE80211_STA_AUTH 
+  new_state == IEEE80211_STA_ASSOC) {
+   ret = drv_sta_add(local, sdata, sta-sta);
+   if (ret == 0)
+   sta-uploaded = true;
+   } else if (old_state == IEEE80211_STA_ASSOC 
+  new_state == IEEE80211_STA_AUTH) {
+   drv_sta_remove(local, sdata, sta-sta);
+   }
+   trace_drv_return_int(local, ret);
+   return ret;
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 32a2e70..02d9133 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -573,37 +573,12 @@ static inline void drv_sta_pre_rcu_remove(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
-static inline __must_check
+__must_check
 int drv_sta_state(struct ieee80211_local *local,
  struct ieee80211_sub_if_data *sdata,
  struct sta_info *sta,
  enum ieee80211_sta_state old_state,
- enum ieee80211_sta_state new_state)
-{
-   int ret = 0;
-
-   might_sleep();
-
-   sdata = get_bss_sdata(sdata);
-   if (!check_sdata_in_driver(sdata))
-   return -EIO;
-
-   trace_drv_sta_state(local, sdata, sta-sta, old_state, new_state);
-   if (local-ops-sta_state) {
-   ret = local-ops-sta_state(local-hw, sdata-vif, sta-sta,
-   old_state, new_state);
-   } else if (old_state == IEEE80211_STA_AUTH 
-  new_state == IEEE80211_STA_ASSOC) {
-   ret = drv_sta_add(local, sdata, sta-sta);
-   if (ret == 0)
-   sta-uploaded = true;
-   } else if (old_state == IEEE80211_STA_ASSOC 
-  new_state == IEEE80211_STA_AUTH) {
-   drv_sta_remove(local, sdata, sta-sta);
-   }
-   trace_drv_return_int(local, ret);
-   return ret;
-}
+ enum ieee80211_sta_state new_state);
 
 static inline void drv_sta_rc_update(struct ieee80211_local *local,
 struct ieee80211_sub_if_data *sdata,
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: Deinline rate_control_rate_init, rate_control_rate_update

2015-07-15 Thread Denys Vlasenko
With this .config: http://busybox.net/~vda/kernel_config,
after deinlining these functions have sizes and callsite counts
as follows:

rate_control_rate_init: 554 bytes, 8 calls
rate_control_rate_update: 1596 bytes, 5 calls

Total size reduction: about 11 kbytes.

Signed-off-by: Denys Vlasenko dvlas...@redhat.com
CC: John Linville linvi...@tuxdriver.com
CC: Michal Kazior michal.kaz...@tieto.com
CC: Johannes Berg johannes.b...@intel.com
Cc: linux-wireless@vger.kernel.org
Cc: net...@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 net/mac80211/rate.c | 59 
 net/mac80211/rate.h | 60 +++--
 2 files changed, 62 insertions(+), 57 deletions(-)

diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index fda33f9..03687d2 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo, charp, 0644);
 MODULE_PARM_DESC(ieee80211_default_rc_algo,
 Default rate control algorithm for mac80211 to use);
 
+void rate_control_rate_init(struct sta_info *sta)
+{
+   struct ieee80211_local *local = sta-sdata-local;
+   struct rate_control_ref *ref = sta-rate_ctrl;
+   struct ieee80211_sta *ista = sta-sta;
+   void *priv_sta = sta-rate_ctrl_priv;
+   struct ieee80211_supported_band *sband;
+   struct ieee80211_chanctx_conf *chanctx_conf;
+
+   ieee80211_sta_set_rx_nss(sta);
+
+   if (!ref)
+   return;
+
+   rcu_read_lock();
+
+   chanctx_conf = rcu_dereference(sta-sdata-vif.chanctx_conf);
+   if (WARN_ON(!chanctx_conf)) {
+   rcu_read_unlock();
+   return;
+   }
+
+   sband = local-hw.wiphy-bands[chanctx_conf-def.chan-band];
+
+   spin_lock_bh(sta-rate_ctrl_lock);
+   ref-ops-rate_init(ref-priv, sband, chanctx_conf-def, ista,
+   priv_sta);
+   spin_unlock_bh(sta-rate_ctrl_lock);
+   rcu_read_unlock();
+   set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
+}
+
+void rate_control_rate_update(struct ieee80211_local *local,
+   struct ieee80211_supported_band *sband,
+   struct sta_info *sta, u32 changed)
+{
+   struct rate_control_ref *ref = local-rate_ctrl;
+   struct ieee80211_sta *ista = sta-sta;
+   void *priv_sta = sta-rate_ctrl_priv;
+   struct ieee80211_chanctx_conf *chanctx_conf;
+
+   if (ref  ref-ops-rate_update) {
+   rcu_read_lock();
+
+   chanctx_conf = rcu_dereference(sta-sdata-vif.chanctx_conf);
+   if (WARN_ON(!chanctx_conf)) {
+   rcu_read_unlock();
+   return;
+   }
+
+   spin_lock_bh(sta-rate_ctrl_lock);
+   ref-ops-rate_update(ref-priv, sband, chanctx_conf-def,
+ ista, priv_sta, changed);
+   spin_unlock_bh(sta-rate_ctrl_lock);
+   rcu_read_unlock();
+   }
+   drv_sta_rc_update(local, sta-sdata, sta-sta, changed);
+}
+
 int ieee80211_rate_control_register(const struct rate_control_ops *ops)
 {
struct rate_control_alg *alg;
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index 25c9be5..624fe5b 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee80211_local *local,
spin_unlock_bh(sta-rate_ctrl_lock);
 }
 
-static inline void rate_control_rate_init(struct sta_info *sta)
-{
-   struct ieee80211_local *local = sta-sdata-local;
-   struct rate_control_ref *ref = sta-rate_ctrl;
-   struct ieee80211_sta *ista = sta-sta;
-   void *priv_sta = sta-rate_ctrl_priv;
-   struct ieee80211_supported_band *sband;
-   struct ieee80211_chanctx_conf *chanctx_conf;
-
-   ieee80211_sta_set_rx_nss(sta);
-
-   if (!ref)
-   return;
-
-   rcu_read_lock();
-
-   chanctx_conf = rcu_dereference(sta-sdata-vif.chanctx_conf);
-   if (WARN_ON(!chanctx_conf)) {
-   rcu_read_unlock();
-   return;
-   }
-
-   sband = local-hw.wiphy-bands[chanctx_conf-def.chan-band];
-
-   spin_lock_bh(sta-rate_ctrl_lock);
-   ref-ops-rate_init(ref-priv, sband, chanctx_conf-def, ista,
-   priv_sta);
-   spin_unlock_bh(sta-rate_ctrl_lock);
-   rcu_read_unlock();
-   set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
-}
-
-static inline void rate_control_rate_update(struct ieee80211_local *local,
+void rate_control_rate_init(struct sta_info *sta);
+void rate_control_rate_update(struct ieee80211_local *local,
struct ieee80211_supported_band *sband,
-   struct sta_info *sta, u32 changed)
-{
-   struct rate_control_ref *ref = local-rate_ctrl;
-   struct ieee80211_sta *ista = sta-sta;
-   void *priv_sta = sta-rate_ctrl_priv

[PATCH] iwlwifi: Deinline iwl_{read,write}{8,32}

2015-07-14 Thread Denys Vlasenko
With CONFIG_IWLWIFI_DEVICE_TRACING=y, these functions are rather large,
too big for inlining.

With this .config: http://busybox.net/~vda/kernel_config,
after uninlining these functions have sizes and callsite counts
as follows:

iwl_read32  475 bytes, 51 callsites
iwl_write32 477 bytes, 90 callsites
iwl_write8  493 bytes, 3 callsites

Reduction in size is about 74,000 bytes:

text data  bss   dec hex filename
90758147 17226024 36659200 144643371 89f152b vmlinux0
90687995 17221928 36659200 144569123 89df323 vmlinux.after

Signed-off-by: Denys Vlasenko dvlas...@redhat.com
CC: Johannes Berg johannes.b...@intel.com
CC: Emmanuel Grumbach emmanuel.grumb...@intel.com
Cc: John W. Linville linvi...@tuxdriver.com
Cc: Intel Linux Wireless i...@linux.intel.com
Cc: linux-wireless@vger.kernel.org
Cc: net...@vger.kernel.org
CC: linux-ker...@vger.kernel.org
---
 drivers/net/wireless/iwlwifi/iwl-io.c |  7 +++
 drivers/net/wireless/iwlwifi/iwl-io.h | 39 +--
 2 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c 
b/drivers/net/wireless/iwlwifi/iwl-io.c
index 27c66e4..aed121e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -38,6 +38,13 @@
 
 #define IWL_POLL_INTERVAL 10   /* microseconds */
 
+#if defined(CONFIG_IWLWIFI_DEVICE_TRACING)
+IWL_READ_WRITE( /*not inlined*/ )
+IWL_EXPORT_SYMBOL(iwl_write8);
+IWL_EXPORT_SYMBOL(iwl_write32);
+IWL_EXPORT_SYMBOL(iwl_read32);
+#endif
+
 int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
 u32 bits, u32 mask, int timeout)
 {
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h 
b/drivers/net/wireless/iwlwifi/iwl-io.h
index 705d12c..3c9d2a8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -32,24 +32,31 @@
 #include iwl-devtrace.h
 #include iwl-trans.h
 
-static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
-{
-   trace_iwlwifi_dev_iowrite8(trans-dev, ofs, val);
-   iwl_trans_write8(trans, ofs, val);
-}
-
-static inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val)
-{
-   trace_iwlwifi_dev_iowrite32(trans-dev, ofs, val);
-   iwl_trans_write32(trans, ofs, val);
+#define IWL_READ_WRITE(static_inline) \
+static_inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) \
+{ \
+   trace_iwlwifi_dev_iowrite8(trans-dev, ofs, val); \
+   iwl_trans_write8(trans, ofs, val); \
+} \
+static_inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val) \
+{ \
+   trace_iwlwifi_dev_iowrite32(trans-dev, ofs, val); \
+   iwl_trans_write32(trans, ofs, val); \
+} \
+static_inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs) \
+{ \
+   u32 val = iwl_trans_read32(trans, ofs); \
+   trace_iwlwifi_dev_ioread32(trans-dev, ofs, val); \
+   return val; \
 }
 
-static inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs)
-{
-   u32 val = iwl_trans_read32(trans, ofs);
-   trace_iwlwifi_dev_ioread32(trans-dev, ofs, val);
-   return val;
-}
+#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
+IWL_READ_WRITE(static inline)
+#else
+void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val);
+void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val);
+u32 iwl_read32(struct iwl_trans *trans, u32 ofs);
+#endif
 
 static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask)
 {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html