diff options
author | sjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com> | 2011-05-13 04:44:04 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-15 23:45:55 +0200 |
commit | b3ccfbe4098a5542177d0f34e8979f32e7d606e1 (patch) | |
tree | 3f0046e3b519ea253db222abcb761af34b8a1718 /include/net/caif | |
parent | caif: Move refcount from service layer to sock and dev. (diff) | |
download | linux-b3ccfbe4098a5542177d0f34e8979f32e7d606e1.tar.xz linux-b3ccfbe4098a5542177d0f34e8979f32e7d606e1.zip |
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.h | 29 |
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, int caif_disconnect_client(struct cflayer *client_layer); /** + * caif_client_register_refcnt - register ref-count functions provided by client. + * + * @adapt_layer: Client layer using CAIF Stack. + * @hold: Function provided by client layer increasing ref-count + * @put: Function provided by client layer decreasing ref-count + * + * Client of the CAIF Stack must register functions for reference counting. + * These functions are called by the CAIF Stack for every upstream packet, + * and must therefore be implemented efficiently. + * + * Client should call caif_free_client when reference count degrease to zero. + */ + +void caif_client_register_refcnt(struct cflayer *adapt_layer, + void (*hold)(struct cflayer *lyr), + void (*put)(struct cflayer *lyr)); +/** * caif_connect_req_to_link_param - Translate configuration parameters * from socket format to internal format. * @cnfg: Pointer to configuration handler @@ -83,8 +100,20 @@ int caif_disconnect_client(struct cflayer *client_layer); * setting up channels. * */ + int caif_connect_req_to_link_param(struct cfcnfg *cnfg, struct caif_connect_request *con_req, struct cfctrl_link_param *setup_param); +/** + * caif_free_client - Free memory used to manage the client in the CAIF Stack. + * + * @client_layer: Client layer to be removed. + * + * This function must be called from client layer in order to free memory. + * Caller must guarantee that no packets are in flight upstream when calling + * this function. + */ +void caif_free_client(struct cflayer *adap_layer); + #endif /* CAIF_DEV_H_ */ |