aboutsummaryrefslogtreecommitdiffstats
path: root/net/caif
diff options
context:
space:
mode:
authorsjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com>2012-02-02 23:36:19 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-04 16:06:27 -0500
commit4a695823b580124c3ab750d8d528f7c6522628c3 (patch)
tree7628f10e8620c87233cd1be67da8017b21e05a76 /net/caif
parent5c6652f556842f838b6963023dcc25db748ececc (diff)
caif: Kill debugfs vars for caif socket
Kill off the debug-fs exposed varaibles from caif_socket. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif')
-rw-r--r--net/caif/caif_socket.c113
1 files changed, 1 insertions, 112 deletions
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index a98628086452..0d1131864630 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -43,34 +43,9 @@ enum caif_states {
43#define TX_FLOW_ON_BIT 1 43#define TX_FLOW_ON_BIT 1
44#define RX_FLOW_ON_BIT 2 44#define RX_FLOW_ON_BIT 2
45 45
46static struct dentry *debugfsdir;
47
48#ifdef CONFIG_DEBUG_FS
49struct debug_fs_counter {
50 atomic_t caif_nr_socks;
51 atomic_t caif_sock_create;
52 atomic_t num_connect_req;
53 atomic_t num_connect_resp;
54 atomic_t num_connect_fail_resp;
55 atomic_t num_disconnect;
56 atomic_t num_remote_shutdown_ind;
57 atomic_t num_tx_flow_off_ind;
58 atomic_t num_tx_flow_on_ind;
59 atomic_t num_rx_flow_off;
60 atomic_t num_rx_flow_on;
61};
62static struct debug_fs_counter cnt;
63#define dbfs_atomic_inc(v) atomic_inc_return(v)
64#define dbfs_atomic_dec(v) atomic_dec_return(v)
65#else
66#define dbfs_atomic_inc(v) 0
67#define dbfs_atomic_dec(v) 0
68#endif
69
70struct caifsock { 46struct caifsock {
71 struct sock sk; /* must be first member */ 47 struct sock sk; /* must be first member */
72 struct cflayer layer; 48 struct cflayer layer;
73 char name[CAIF_LAYER_NAME_SZ]; /* Used for debugging */
74 u32 flow_state; 49 u32 flow_state;
75 struct caif_connect_request conn_req; 50 struct caif_connect_request conn_req;
76 struct mutex readlock; 51 struct mutex readlock;
@@ -161,7 +136,6 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
161 atomic_read(&cf_sk->sk.sk_rmem_alloc), 136 atomic_read(&cf_sk->sk.sk_rmem_alloc),
162 sk_rcvbuf_lowwater(cf_sk)); 137 sk_rcvbuf_lowwater(cf_sk));
163 set_rx_flow_off(cf_sk); 138 set_rx_flow_off(cf_sk);
164 dbfs_atomic_inc(&cnt.num_rx_flow_off);
165 caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ); 139 caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ);
166 } 140 }
167 141
@@ -172,7 +146,6 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
172 set_rx_flow_off(cf_sk); 146 set_rx_flow_off(cf_sk);
173 if (net_ratelimit()) 147 if (net_ratelimit())
174 pr_debug("sending flow OFF due to rmem_schedule\n"); 148 pr_debug("sending flow OFF due to rmem_schedule\n");
175 dbfs_atomic_inc(&cnt.num_rx_flow_off);
176 caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ); 149 caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ);
177 } 150 }
178 skb->dev = NULL; 151 skb->dev = NULL;
@@ -233,14 +206,12 @@ static void caif_ctrl_cb(struct cflayer *layr,
233 switch (flow) { 206 switch (flow) {
234 case CAIF_CTRLCMD_FLOW_ON_IND: 207 case CAIF_CTRLCMD_FLOW_ON_IND:
235 /* OK from modem to start sending again */ 208 /* OK from modem to start sending again */
236 dbfs_atomic_inc(&cnt.num_tx_flow_on_ind);
237 set_tx_flow_on(cf_sk); 209 set_tx_flow_on(cf_sk);
238 cf_sk->sk.sk_state_change(&cf_sk->sk); 210 cf_sk->sk.sk_state_change(&cf_sk->sk);
239 break; 211 break;
240 212
241 case CAIF_CTRLCMD_FLOW_OFF_IND: 213 case CAIF_CTRLCMD_FLOW_OFF_IND:
242 /* Modem asks us to shut up */ 214 /* Modem asks us to shut up */
243 dbfs_atomic_inc(&cnt.num_tx_flow_off_ind);
244 set_tx_flow_off(cf_sk); 215 set_tx_flow_off(cf_sk);
245 cf_sk->sk.sk_state_change(&cf_sk->sk); 216 cf_sk->sk.sk_state_change(&cf_sk->sk);
246 break; 217 break;
@@ -249,7 +220,6 @@ static void caif_ctrl_cb(struct cflayer *layr,
249 /* We're now connected */ 220 /* We're now connected */
250 caif_client_register_refcnt(&cf_sk->layer, 221 caif_client_register_refcnt(&cf_sk->layer,
251 cfsk_hold, cfsk_put); 222 cfsk_hold, cfsk_put);
252 dbfs_atomic_inc(&cnt.num_connect_resp);
253 cf_sk->sk.sk_state = CAIF_CONNECTED; 223 cf_sk->sk.sk_state = CAIF_CONNECTED;
254 set_tx_flow_on(cf_sk); 224 set_tx_flow_on(cf_sk);
255 cf_sk->sk.sk_state_change(&cf_sk->sk); 225 cf_sk->sk.sk_state_change(&cf_sk->sk);
@@ -263,7 +233,6 @@ static void caif_ctrl_cb(struct cflayer *layr,
263 233
264 case CAIF_CTRLCMD_INIT_FAIL_RSP: 234 case CAIF_CTRLCMD_INIT_FAIL_RSP:
265 /* Connect request failed */ 235 /* Connect request failed */
266 dbfs_atomic_inc(&cnt.num_connect_fail_resp);
267 cf_sk->sk.sk_err = ECONNREFUSED; 236 cf_sk->sk.sk_err = ECONNREFUSED;
268 cf_sk->sk.sk_state = CAIF_DISCONNECTED; 237 cf_sk->sk.sk_state = CAIF_DISCONNECTED;
269 cf_sk->sk.sk_shutdown = SHUTDOWN_MASK; 238 cf_sk->sk.sk_shutdown = SHUTDOWN_MASK;
@@ -277,7 +246,6 @@ static void caif_ctrl_cb(struct cflayer *layr,
277 246
278 case CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: 247 case CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND:
279 /* Modem has closed this connection, or device is down. */ 248 /* Modem has closed this connection, or device is down. */
280 dbfs_atomic_inc(&cnt.num_remote_shutdown_ind);
281 cf_sk->sk.sk_shutdown = SHUTDOWN_MASK; 249 cf_sk->sk.sk_shutdown = SHUTDOWN_MASK;
282 cf_sk->sk.sk_err = ECONNRESET; 250 cf_sk->sk.sk_err = ECONNRESET;
283 set_rx_flow_on(cf_sk); 251 set_rx_flow_on(cf_sk);
@@ -297,7 +265,6 @@ static void caif_check_flow_release(struct sock *sk)
297 return; 265 return;
298 266
299 if (atomic_read(&sk->sk_rmem_alloc) <= sk_rcvbuf_lowwater(cf_sk)) { 267 if (atomic_read(&sk->sk_rmem_alloc) <= sk_rcvbuf_lowwater(cf_sk)) {
300 dbfs_atomic_inc(&cnt.num_rx_flow_on);
301 set_rx_flow_on(cf_sk); 268 set_rx_flow_on(cf_sk);
302 caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_ON_REQ); 269 caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_ON_REQ);
303 } 270 }
@@ -854,7 +821,6 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
854 /*ifindex = id of the interface.*/ 821 /*ifindex = id of the interface.*/
855 cf_sk->conn_req.ifindex = cf_sk->sk.sk_bound_dev_if; 822 cf_sk->conn_req.ifindex = cf_sk->sk.sk_bound_dev_if;
856 823
857 dbfs_atomic_inc(&cnt.num_connect_req);
858 cf_sk->layer.receive = caif_sktrecv_cb; 824 cf_sk->layer.receive = caif_sktrecv_cb;
859 825
860 err = caif_connect_client(sock_net(sk), &cf_sk->conn_req, 826 err = caif_connect_client(sock_net(sk), &cf_sk->conn_req,
@@ -943,8 +909,6 @@ static int caif_release(struct socket *sock)
943 spin_unlock_bh(&sk->sk_receive_queue.lock); 909 spin_unlock_bh(&sk->sk_receive_queue.lock);
944 sock->sk = NULL; 910 sock->sk = NULL;
945 911
946 dbfs_atomic_inc(&cnt.num_disconnect);
947
948 WARN_ON(IS_ERR(cf_sk->debugfs_socket_dir)); 912 WARN_ON(IS_ERR(cf_sk->debugfs_socket_dir));
949 if (cf_sk->debugfs_socket_dir != NULL) 913 if (cf_sk->debugfs_socket_dir != NULL)
950 debugfs_remove_recursive(cf_sk->debugfs_socket_dir); 914 debugfs_remove_recursive(cf_sk->debugfs_socket_dir);
@@ -1052,14 +1016,12 @@ static void caif_sock_destructor(struct sock *sk)
1052 return; 1016 return;
1053 } 1017 }
1054 sk_stream_kill_queues(&cf_sk->sk); 1018 sk_stream_kill_queues(&cf_sk->sk);
1055 dbfs_atomic_dec(&cnt.caif_nr_socks);
1056 caif_free_client(&cf_sk->layer); 1019 caif_free_client(&cf_sk->layer);
1057} 1020}
1058 1021
1059static int caif_create(struct net *net, struct socket *sock, int protocol, 1022static int caif_create(struct net *net, struct socket *sock, int protocol,
1060 int kern) 1023 int kern)
1061{ 1024{
1062 int num;
1063 struct sock *sk = NULL; 1025 struct sock *sk = NULL;
1064 struct caifsock *cf_sk = NULL; 1026 struct caifsock *cf_sk = NULL;
1065 static struct proto prot = {.name = "PF_CAIF", 1027 static struct proto prot = {.name = "PF_CAIF",
@@ -1120,34 +1082,6 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
1120 cf_sk->sk.sk_priority = CAIF_PRIO_NORMAL; 1082 cf_sk->sk.sk_priority = CAIF_PRIO_NORMAL;
1121 cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY; 1083 cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY;
1122 cf_sk->conn_req.protocol = protocol; 1084 cf_sk->conn_req.protocol = protocol;
1123 /* Increase the number of sockets created. */
1124 dbfs_atomic_inc(&cnt.caif_nr_socks);
1125 num = dbfs_atomic_inc(&cnt.caif_sock_create);
1126#ifdef CONFIG_DEBUG_FS
1127 if (!IS_ERR(debugfsdir)) {
1128
1129 /* Fill in some information concerning the misc socket. */
1130 snprintf(cf_sk->name, sizeof(cf_sk->name), "cfsk%d", num);
1131
1132 cf_sk->debugfs_socket_dir =
1133 debugfs_create_dir(cf_sk->name, debugfsdir);
1134
1135 debugfs_create_u32("sk_state", S_IRUSR | S_IWUSR,
1136 cf_sk->debugfs_socket_dir,
1137 (u32 *) &cf_sk->sk.sk_state);
1138 debugfs_create_u32("flow_state", S_IRUSR | S_IWUSR,
1139 cf_sk->debugfs_socket_dir, &cf_sk->flow_state);
1140 debugfs_create_u32("sk_rmem_alloc", S_IRUSR | S_IWUSR,
1141 cf_sk->debugfs_socket_dir,
1142 (u32 *) &cf_sk->sk.sk_rmem_alloc);
1143 debugfs_create_u32("sk_wmem_alloc", S_IRUSR | S_IWUSR,
1144 cf_sk->debugfs_socket_dir,
1145 (u32 *) &cf_sk->sk.sk_wmem_alloc);
1146 debugfs_create_u32("identity", S_IRUSR | S_IWUSR,
1147 cf_sk->debugfs_socket_dir,
1148 (u32 *) &cf_sk->layer.id);
1149 }
1150#endif
1151 release_sock(&cf_sk->sk); 1085 release_sock(&cf_sk->sk);
1152 return 0; 1086 return 0;
1153} 1087}
@@ -1159,7 +1093,7 @@ static struct net_proto_family caif_family_ops = {
1159 .owner = THIS_MODULE, 1093 .owner = THIS_MODULE,
1160}; 1094};
1161 1095
1162static int af_caif_init(void) 1096static int __init caif_sktinit_module(void)
1163{ 1097{
1164 int err = sock_register(&caif_family_ops); 1098 int err = sock_register(&caif_family_ops);
1165 if (!err) 1099 if (!err)
@@ -1167,54 +1101,9 @@ static int af_caif_init(void)
1167 return 0; 1101 return 0;
1168} 1102}
1169 1103
1170static int __init caif_sktinit_module(void)
1171{
1172#ifdef CONFIG_DEBUG_FS
1173 debugfsdir = debugfs_create_dir("caif_sk", NULL);
1174 if (!IS_ERR(debugfsdir)) {
1175 debugfs_create_u32("num_sockets", S_IRUSR | S_IWUSR,
1176 debugfsdir,
1177 (u32 *) &cnt.caif_nr_socks);
1178 debugfs_create_u32("num_create", S_IRUSR | S_IWUSR,
1179 debugfsdir,
1180 (u32 *) &cnt.caif_sock_create);
1181 debugfs_create_u32("num_connect_req", S_IRUSR | S_IWUSR,
1182 debugfsdir,
1183 (u32 *) &cnt.num_connect_req);
1184 debugfs_create_u32("num_connect_resp", S_IRUSR | S_IWUSR,
1185 debugfsdir,
1186 (u32 *) &cnt.num_connect_resp);
1187 debugfs_create_u32("num_connect_fail_resp", S_IRUSR | S_IWUSR,
1188 debugfsdir,
1189 (u32 *) &cnt.num_connect_fail_resp);
1190 debugfs_create_u32("num_disconnect", S_IRUSR | S_IWUSR,
1191 debugfsdir,
1192 (u32 *) &cnt.num_disconnect);
1193 debugfs_create_u32("num_remote_shutdown_ind",
1194 S_IRUSR | S_IWUSR, debugfsdir,
1195 (u32 *) &cnt.num_remote_shutdown_ind);
1196 debugfs_create_u32("num_tx_flow_off_ind", S_IRUSR | S_IWUSR,
1197 debugfsdir,
1198 (u32 *) &cnt.num_tx_flow_off_ind);
1199 debugfs_create_u32("num_tx_flow_on_ind", S_IRUSR | S_IWUSR,
1200 debugfsdir,
1201 (u32 *) &cnt.num_tx_flow_on_ind);
1202 debugfs_create_u32("num_rx_flow_off", S_IRUSR | S_IWUSR,
1203 debugfsdir,
1204 (u32 *) &cnt.num_rx_flow_off);
1205 debugfs_create_u32("num_rx_flow_on", S_IRUSR | S_IWUSR,
1206 debugfsdir,
1207 (u32 *) &cnt.num_rx_flow_on);
1208 }
1209#endif
1210 return af_caif_init();
1211}
1212
1213static void __exit caif_sktexit_module(void) 1104static void __exit caif_sktexit_module(void)
1214{ 1105{
1215 sock_unregister(PF_CAIF); 1106 sock_unregister(PF_CAIF);
1216 if (debugfsdir != NULL)
1217 debugfs_remove_recursive(debugfsdir);
1218} 1107}
1219module_init(caif_sktinit_module); 1108module_init(caif_sktinit_module);
1220module_exit(caif_sktexit_module); 1109module_exit(caif_sktexit_module);