diff options
Diffstat (limited to 'include/net/caif/caif_dev.h')
-rw-r--r-- | include/net/caif/caif_dev.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index 6da573c75d54..c011281d92c0 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <net/caif/cfcnfg.h> | 11 | #include <net/caif/cfcnfg.h> |
12 | #include <linux/caif/caif_socket.h> | 12 | #include <linux/caif/caif_socket.h> |
13 | #include <linux/if.h> | 13 | #include <linux/if.h> |
14 | #include <linux/net.h> | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * struct caif_param - CAIF parameters. | 17 | * struct caif_param - CAIF parameters. |
@@ -28,7 +29,7 @@ struct caif_param { | |||
28 | * @sockaddr: Socket address to connect. | 29 | * @sockaddr: Socket address to connect. |
29 | * @priority: Priority of the connection. | 30 | * @priority: Priority of the connection. |
30 | * @link_selector: Link selector (high bandwidth or low latency) | 31 | * @link_selector: Link selector (high bandwidth or low latency) |
31 | * @link_name: Name of the CAIF Link Layer to use. | 32 | * @ifindex: kernel index of the interface. |
32 | * @param: Connect Request parameters (CAIF_SO_REQ_PARAM). | 33 | * @param: Connect Request parameters (CAIF_SO_REQ_PARAM). |
33 | * | 34 | * |
34 | * This struct is used when connecting a CAIF channel. | 35 | * This struct is used when connecting a CAIF channel. |
@@ -39,7 +40,7 @@ struct caif_connect_request { | |||
39 | struct sockaddr_caif sockaddr; | 40 | struct sockaddr_caif sockaddr; |
40 | enum caif_channel_priority priority; | 41 | enum caif_channel_priority priority; |
41 | enum caif_link_selector link_selector; | 42 | enum caif_link_selector link_selector; |
42 | char link_name[16]; | 43 | int ifindex; |
43 | struct caif_param param; | 44 | struct caif_param param; |
44 | }; | 45 | }; |
45 | 46 | ||
@@ -62,46 +63,45 @@ struct caif_connect_request { | |||
62 | * E.g. CAIF Socket will call this function for each socket it connects | 63 | * E.g. CAIF Socket will call this function for each socket it connects |
63 | * and have one client_layer instance for each socket. | 64 | * and have one client_layer instance for each socket. |
64 | */ | 65 | */ |
65 | int caif_connect_client(struct caif_connect_request *conn_req, | 66 | int caif_connect_client(struct net *net, |
67 | struct caif_connect_request *conn_req, | ||
66 | struct cflayer *client_layer, int *ifindex, | 68 | struct cflayer *client_layer, int *ifindex, |
67 | int *headroom, int *tailroom); | 69 | int *headroom, int *tailroom); |
68 | 70 | ||
69 | /** | 71 | /** |
70 | * caif_disconnect_client - Disconnects a client from the CAIF stack. | 72 | * caif_disconnect_client - Disconnects a client from the CAIF stack. |
71 | * | 73 | * |
72 | * @client_layer: Client layer to be removed. | 74 | * @client_layer: Client layer to be disconnected. |
73 | */ | 75 | */ |
74 | int caif_disconnect_client(struct cflayer *client_layer); | 76 | int caif_disconnect_client(struct net *net, struct cflayer *client_layer); |
77 | |||
75 | 78 | ||
76 | /** | 79 | /** |
77 | * caif_release_client - Release adaptation layer reference to client. | 80 | * caif_client_register_refcnt - register ref-count functions provided by client. |
78 | * | 81 | * |
79 | * @client_layer: Client layer. | 82 | * @adapt_layer: Client layer using CAIF Stack. |
83 | * @hold: Function provided by client layer increasing ref-count | ||
84 | * @put: Function provided by client layer decreasing ref-count | ||
80 | * | 85 | * |
81 | * Releases a client/adaptation layer use of the caif stack. | 86 | * Client of the CAIF Stack must register functions for reference counting. |
82 | * This function must be used after caif_disconnect_client to | 87 | * These functions are called by the CAIF Stack for every upstream packet, |
83 | * decrease the reference count of the service layer. | 88 | * and must therefore be implemented efficiently. |
84 | */ | ||
85 | void caif_release_client(struct cflayer *client_layer); | ||
86 | |||
87 | /** | ||
88 | * connect_req_to_link_param - Translate configuration parameters | ||
89 | * from socket format to internal format. | ||
90 | * @cnfg: Pointer to configuration handler | ||
91 | * @con_req: Configuration parameters supplied in function | ||
92 | * caif_connect_client | ||
93 | * @channel_setup_param: Parameters supplied to the CAIF Core stack for | ||
94 | * setting up channels. | ||
95 | * | 89 | * |
90 | * Client should call caif_free_client when reference count degrease to zero. | ||
96 | */ | 91 | */ |
97 | int connect_req_to_link_param(struct cfcnfg *cnfg, | ||
98 | struct caif_connect_request *con_req, | ||
99 | struct cfctrl_link_param *channel_setup_param); | ||
100 | 92 | ||
93 | void caif_client_register_refcnt(struct cflayer *adapt_layer, | ||
94 | void (*hold)(struct cflayer *lyr), | ||
95 | void (*put)(struct cflayer *lyr)); | ||
101 | /** | 96 | /** |
102 | * get_caif_conf() - Get the configuration handler. | 97 | * caif_free_client - Free memory used to manage the client in the CAIF Stack. |
98 | * | ||
99 | * @client_layer: Client layer to be removed. | ||
100 | * | ||
101 | * This function must be called from client layer in order to free memory. | ||
102 | * Caller must guarantee that no packets are in flight upstream when calling | ||
103 | * this function. | ||
103 | */ | 104 | */ |
104 | struct cfcnfg *get_caif_conf(void); | 105 | void caif_free_client(struct cflayer *adap_layer); |
105 | |||
106 | 106 | ||
107 | #endif /* CAIF_DEV_H_ */ | 107 | #endif /* CAIF_DEV_H_ */ |