aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/caif
diff options
context:
space:
mode:
authorsjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com>2011-05-12 22:44:04 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-15 17:45:55 -0400
commitb3ccfbe4098a5542177d0f34e8979f32e7d606e1 (patch)
tree3f0046e3b519ea253db222abcb761af34b8a1718 /include/net/caif
parent43e3692101086add8719c3b8b50b05c9ac5b14e1 (diff)
caif: Protected in-flight packets using dev or sock refcont.
CAIF Socket Layer and ip-interface registers reference counters in CAIF service layer. The functions sock_hold, sock_put and dev_hold, dev_put are used by CAIF Stack to protect from freeing memory while packets are in-flight. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/caif')
-rw-r--r--include/net/caif/caif_dev.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index 7e3f7a6d2ba3..6638435525fc 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -74,6 +74,23 @@ int caif_connect_client(struct caif_connect_request *conn_req,
74int caif_disconnect_client(struct cflayer *client_layer); 74int caif_disconnect_client(struct cflayer *client_layer);
75 75
76/** 76/**
77 * caif_client_register_refcnt - register ref-count functions provided by client.
78 *
79 * @adapt_layer: Client layer using CAIF Stack.
80 * @hold: Function provided by client layer increasing ref-count
81 * @put: Function provided by client layer decreasing ref-count
82 *
83 * Client of the CAIF Stack must register functions for reference counting.
84 * These functions are called by the CAIF Stack for every upstream packet,
85 * and must therefore be implemented efficiently.
86 *
87 * Client should call caif_free_client when reference count degrease to zero.
88 */
89
90void caif_client_register_refcnt(struct cflayer *adapt_layer,
91 void (*hold)(struct cflayer *lyr),
92 void (*put)(struct cflayer *lyr));
93/**
77 * caif_connect_req_to_link_param - Translate configuration parameters 94 * caif_connect_req_to_link_param - Translate configuration parameters
78 * from socket format to internal format. 95 * from socket format to internal format.
79 * @cnfg: Pointer to configuration handler 96 * @cnfg: Pointer to configuration handler
@@ -83,8 +100,20 @@ int caif_disconnect_client(struct cflayer *client_layer);
83 * setting up channels. 100 * setting up channels.
84 * 101 *
85 */ 102 */
103
86int caif_connect_req_to_link_param(struct cfcnfg *cnfg, 104int caif_connect_req_to_link_param(struct cfcnfg *cnfg,
87 struct caif_connect_request *con_req, 105 struct caif_connect_request *con_req,
88 struct cfctrl_link_param *setup_param); 106 struct cfctrl_link_param *setup_param);
89 107
108/**
109 * caif_free_client - Free memory used to manage the client in the CAIF Stack.
110 *
111 * @client_layer: Client layer to be removed.
112 *
113 * This function must be called from client layer in order to free memory.
114 * Caller must guarantee that no packets are in flight upstream when calling
115 * this function.
116 */
117void caif_free_client(struct cflayer *adap_layer);
118
90#endif /* CAIF_DEV_H_ */ 119#endif /* CAIF_DEV_H_ */