diff options
-rw-r--r-- | include/net/caif/caif_dev.h | 6 | ||||
-rw-r--r-- | include/net/caif/cfcnfg.h | 10 | ||||
-rw-r--r-- | net/caif/caif_dev.c | 15 | ||||
-rw-r--r-- | net/caif/cfcnfg.c | 51 |
4 files changed, 41 insertions, 41 deletions
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index 42a7c7867849..3aa1ff642323 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h | |||
@@ -23,17 +23,19 @@ struct caif_param { | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * caif_connect_request - Request data for CAIF channel setup. | 26 | * struct caif_connect_request - Request data for CAIF channel setup. |
27 | * @protocol: Type of CAIF protocol to use (at, datagram etc) | ||
27 | * @sockaddr: Socket address to connect. | 28 | * @sockaddr: Socket address to connect. |
28 | * @priority: Priority of the connection. | 29 | * @priority: Priority of the connection. |
29 | * @link_selector: Link selector (high bandwidth or low latency) | 30 | * @link_selector: Link selector (high bandwidth or low latency) |
30 | * @link_name: Name of the CAIF Link Layer to use. | 31 | * @link_name: Name of the CAIF Link Layer to use. |
32 | * @param: Connect Request parameters (CAIF_SO_REQ_PARAM). | ||
31 | * | 33 | * |
32 | * This struct is used when connecting a CAIF channel. | 34 | * This struct is used when connecting a CAIF channel. |
33 | * It contains all CAIF channel configuration options. | 35 | * It contains all CAIF channel configuration options. |
34 | */ | 36 | */ |
35 | struct caif_connect_request { | 37 | struct caif_connect_request { |
36 | int protocol; | 38 | enum caif_protocol_type protocol; |
37 | struct sockaddr_caif sockaddr; | 39 | struct sockaddr_caif sockaddr; |
38 | enum caif_channel_priority priority; | 40 | enum caif_channel_priority priority; |
39 | enum caif_link_selector link_selector; | 41 | enum caif_link_selector link_selector; |
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index 366082c5d435..f16b875acc48 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h | |||
@@ -87,13 +87,14 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
87 | int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); | 87 | int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * cfcnfg_del_adapt_layer - Deletes an adaptation layer from the CAIF stack. | 90 | * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer. |
91 | * | 91 | * |
92 | * @cnfg: Pointer to a CAIF configuration object, created by | 92 | * @cnfg: Pointer to a CAIF configuration object, created by |
93 | * cfcnfg_create(). | 93 | * cfcnfg_create(). |
94 | * @adap_layer: Adaptation layer to be removed. | 94 | * @adap_layer: Adaptation layer to be removed. |
95 | */ | 95 | */ |
96 | int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer); | 96 | int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, |
97 | struct cflayer *adap_layer); | ||
97 | 98 | ||
98 | /** | 99 | /** |
99 | * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack. | 100 | * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack. |
@@ -102,14 +103,13 @@ int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer); | |||
102 | * driver functionality is implemented. | 103 | * driver functionality is implemented. |
103 | * | 104 | * |
104 | * @cnfg: Pointer to a CAIF configuration object, created by | 105 | * @cnfg: Pointer to a CAIF configuration object, created by |
105 | * cfcnfg_create(). | 106 | * cfcnfg_create(). |
106 | * @param: Link setup parameters. | 107 | * @param: Link setup parameters. |
107 | * @adap_layer: Specify the adaptation layer; the receive and | 108 | * @adap_layer: Specify the adaptation layer; the receive and |
108 | * flow-control functions MUST be set in the structure. | 109 | * flow-control functions MUST be set in the structure. |
109 | * | 110 | * |
110 | */ | 111 | */ |
111 | int | 112 | int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, |
112 | cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, | ||
113 | struct cfctrl_link_param *param, | 113 | struct cfctrl_link_param *param, |
114 | struct cflayer *adap_layer); | 114 | struct cflayer *adap_layer); |
115 | 115 | ||
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index e84837e1bc86..be1f674a3b67 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -330,20 +330,19 @@ int caif_connect_client(struct caif_connect_request *conn_req, | |||
330 | struct cflayer *client_layer) | 330 | struct cflayer *client_layer) |
331 | { | 331 | { |
332 | struct cfctrl_link_param param; | 332 | struct cfctrl_link_param param; |
333 | if (connect_req_to_link_param(get_caif_conf(), conn_req, ¶m) == 0) | 333 | int ret; |
334 | /* Hook up the adaptation layer. */ | 334 | ret = connect_req_to_link_param(get_caif_conf(), conn_req, ¶m); |
335 | return cfcnfg_add_adaptation_layer(get_caif_conf(), | 335 | if (ret) |
336 | return ret; | ||
337 | /* Hook up the adaptation layer. */ | ||
338 | return cfcnfg_add_adaptation_layer(get_caif_conf(), | ||
336 | ¶m, client_layer); | 339 | ¶m, client_layer); |
337 | |||
338 | return -EINVAL; | ||
339 | |||
340 | caif_assert(0); | ||
341 | } | 340 | } |
342 | EXPORT_SYMBOL(caif_connect_client); | 341 | EXPORT_SYMBOL(caif_connect_client); |
343 | 342 | ||
344 | int caif_disconnect_client(struct cflayer *adap_layer) | 343 | int caif_disconnect_client(struct cflayer *adap_layer) |
345 | { | 344 | { |
346 | return cfcnfg_del_adapt_layer(get_caif_conf(), adap_layer); | 345 | return cfcnfg_disconn_adapt_layer(get_caif_conf(), adap_layer); |
347 | } | 346 | } |
348 | EXPORT_SYMBOL(caif_disconnect_client); | 347 | EXPORT_SYMBOL(caif_disconnect_client); |
349 | 348 | ||
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index c873e3d4387c..d52f2566916e 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -51,12 +51,12 @@ struct cfcnfg { | |||
51 | struct cfcnfg_phyinfo phy_layers[MAX_PHY_LAYERS]; | 51 | struct cfcnfg_phyinfo phy_layers[MAX_PHY_LAYERS]; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static void cncfg_linkup_rsp(struct cflayer *layer, u8 linkid, | 54 | static void cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, |
55 | enum cfctrl_srv serv, u8 phyid, | 55 | enum cfctrl_srv serv, u8 phyid, |
56 | struct cflayer *adapt_layer); | 56 | struct cflayer *adapt_layer); |
57 | static void cncfg_linkdestroy_rsp(struct cflayer *layer, u8 linkid, | 57 | static void cfcnfg_linkdestroy_rsp(struct cflayer *layer, u8 channel_id, |
58 | struct cflayer *client_layer); | 58 | struct cflayer *client_layer); |
59 | static void cncfg_reject_rsp(struct cflayer *layer, u8 linkid, | 59 | static void cfcnfg_reject_rsp(struct cflayer *layer, u8 channel_id, |
60 | struct cflayer *adapt_layer); | 60 | struct cflayer *adapt_layer); |
61 | static void cfctrl_resp_func(void); | 61 | static void cfctrl_resp_func(void); |
62 | static void cfctrl_enum_resp(void); | 62 | static void cfctrl_enum_resp(void); |
@@ -82,13 +82,13 @@ struct cfcnfg *cfcnfg_create(void) | |||
82 | resp = cfctrl_get_respfuncs(this->ctrl); | 82 | resp = cfctrl_get_respfuncs(this->ctrl); |
83 | resp->enum_rsp = cfctrl_enum_resp; | 83 | resp->enum_rsp = cfctrl_enum_resp; |
84 | resp->linkerror_ind = cfctrl_resp_func; | 84 | resp->linkerror_ind = cfctrl_resp_func; |
85 | resp->linkdestroy_rsp = cncfg_linkdestroy_rsp; | 85 | resp->linkdestroy_rsp = cfcnfg_linkdestroy_rsp; |
86 | resp->sleep_rsp = cfctrl_resp_func; | 86 | resp->sleep_rsp = cfctrl_resp_func; |
87 | resp->wake_rsp = cfctrl_resp_func; | 87 | resp->wake_rsp = cfctrl_resp_func; |
88 | resp->restart_rsp = cfctrl_resp_func; | 88 | resp->restart_rsp = cfctrl_resp_func; |
89 | resp->radioset_rsp = cfctrl_resp_func; | 89 | resp->radioset_rsp = cfctrl_resp_func; |
90 | resp->linksetup_rsp = cncfg_linkup_rsp; | 90 | resp->linksetup_rsp = cfcnfg_linkup_rsp; |
91 | resp->reject_rsp = cncfg_reject_rsp; | 91 | resp->reject_rsp = cfcnfg_reject_rsp; |
92 | 92 | ||
93 | this->last_phyid = 1; | 93 | this->last_phyid = 1; |
94 | 94 | ||
@@ -191,8 +191,7 @@ int cfcnfg_get_named(struct cfcnfg *cnfg, char *name) | |||
191 | * 4) Link-Error - (no response) | 191 | * 4) Link-Error - (no response) |
192 | * Not handled, but this should be a CAIF PROTOCOL ERROR | 192 | * Not handled, but this should be a CAIF PROTOCOL ERROR |
193 | */ | 193 | */ |
194 | 194 | int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) | |
195 | int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) | ||
196 | { | 195 | { |
197 | u8 channel_id = 0; | 196 | u8 channel_id = 0; |
198 | int ret = 0; | 197 | int ret = 0; |
@@ -246,9 +245,9 @@ end: | |||
246 | return ret; | 245 | return ret; |
247 | 246 | ||
248 | } | 247 | } |
249 | EXPORT_SYMBOL(cfcnfg_del_adapt_layer); | 248 | EXPORT_SYMBOL(cfcnfg_disconn_adapt_layer); |
250 | 249 | ||
251 | static void cncfg_linkdestroy_rsp(struct cflayer *layer, u8 linkid, | 250 | static void cfcnfg_linkdestroy_rsp(struct cflayer *layer, u8 channel_id, |
252 | struct cflayer *client_layer) | 251 | struct cflayer *client_layer) |
253 | { | 252 | { |
254 | struct cfcnfg *cnfg = container_obj(layer); | 253 | struct cfcnfg *cnfg = container_obj(layer); |
@@ -258,20 +257,20 @@ static void cncfg_linkdestroy_rsp(struct cflayer *layer, u8 linkid, | |||
258 | * 1) Remove service from the MUX layer. The MUX must | 257 | * 1) Remove service from the MUX layer. The MUX must |
259 | * guarante that no more payload sent "upwards" (receive) | 258 | * guarante that no more payload sent "upwards" (receive) |
260 | */ | 259 | */ |
261 | servl = cfmuxl_remove_uplayer(cnfg->mux, linkid); | 260 | servl = cfmuxl_remove_uplayer(cnfg->mux, channel_id); |
262 | 261 | ||
263 | if (servl == NULL) { | 262 | if (servl == NULL) { |
264 | pr_err("CAIF: %s(): PROTOCOL ERROR " | 263 | pr_err("CAIF: %s(): PROTOCOL ERROR " |
265 | "- Error removing service_layer Linkid(%d)", | 264 | "- Error removing service_layer Channel_Id(%d)", |
266 | __func__, linkid); | 265 | __func__, channel_id); |
267 | return; | 266 | return; |
268 | } | 267 | } |
269 | caif_assert(linkid == servl->id); | 268 | caif_assert(channel_id == servl->id); |
270 | 269 | ||
271 | if (servl != client_layer && servl->up != client_layer) { | 270 | if (servl != client_layer && servl->up != client_layer) { |
272 | pr_err("CAIF: %s(): Error removing service_layer " | 271 | pr_err("CAIF: %s(): Error removing service_layer " |
273 | "Linkid(%d) %p %p", | 272 | "Channel_Id(%d) %p %p", |
274 | __func__, linkid, (void *) servl, | 273 | __func__, channel_id, (void *) servl, |
275 | (void *) client_layer); | 274 | (void *) client_layer); |
276 | return; | 275 | return; |
277 | } | 276 | } |
@@ -345,7 +344,7 @@ cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, | |||
345 | } | 344 | } |
346 | EXPORT_SYMBOL(cfcnfg_add_adaptation_layer); | 345 | EXPORT_SYMBOL(cfcnfg_add_adaptation_layer); |
347 | 346 | ||
348 | static void cncfg_reject_rsp(struct cflayer *layer, u8 linkid, | 347 | static void cfcnfg_reject_rsp(struct cflayer *layer, u8 channel_id, |
349 | struct cflayer *adapt_layer) | 348 | struct cflayer *adapt_layer) |
350 | { | 349 | { |
351 | if (adapt_layer != NULL && adapt_layer->ctrlcmd != NULL) | 350 | if (adapt_layer != NULL && adapt_layer->ctrlcmd != NULL) |
@@ -354,7 +353,7 @@ static void cncfg_reject_rsp(struct cflayer *layer, u8 linkid, | |||
354 | } | 353 | } |
355 | 354 | ||
356 | static void | 355 | static void |
357 | cncfg_linkup_rsp(struct cflayer *layer, u8 linkid, enum cfctrl_srv serv, | 356 | cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, |
358 | u8 phyid, struct cflayer *adapt_layer) | 357 | u8 phyid, struct cflayer *adapt_layer) |
359 | { | 358 | { |
360 | struct cfcnfg *cnfg = container_obj(layer); | 359 | struct cfcnfg *cnfg = container_obj(layer); |
@@ -383,26 +382,26 @@ cncfg_linkup_rsp(struct cflayer *layer, u8 linkid, enum cfctrl_srv serv, | |||
383 | _CAIF_MODEMCMD_PHYIF_USEFULL); | 382 | _CAIF_MODEMCMD_PHYIF_USEFULL); |
384 | 383 | ||
385 | } | 384 | } |
386 | adapt_layer->id = linkid; | 385 | adapt_layer->id = channel_id; |
387 | 386 | ||
388 | switch (serv) { | 387 | switch (serv) { |
389 | case CFCTRL_SRV_VEI: | 388 | case CFCTRL_SRV_VEI: |
390 | servicel = cfvei_create(linkid, &phyinfo->dev_info); | 389 | servicel = cfvei_create(channel_id, &phyinfo->dev_info); |
391 | break; | 390 | break; |
392 | case CFCTRL_SRV_DATAGRAM: | 391 | case CFCTRL_SRV_DATAGRAM: |
393 | servicel = cfdgml_create(linkid, &phyinfo->dev_info); | 392 | servicel = cfdgml_create(channel_id, &phyinfo->dev_info); |
394 | break; | 393 | break; |
395 | case CFCTRL_SRV_RFM: | 394 | case CFCTRL_SRV_RFM: |
396 | servicel = cfrfml_create(linkid, &phyinfo->dev_info); | 395 | servicel = cfrfml_create(channel_id, &phyinfo->dev_info); |
397 | break; | 396 | break; |
398 | case CFCTRL_SRV_UTIL: | 397 | case CFCTRL_SRV_UTIL: |
399 | servicel = cfutill_create(linkid, &phyinfo->dev_info); | 398 | servicel = cfutill_create(channel_id, &phyinfo->dev_info); |
400 | break; | 399 | break; |
401 | case CFCTRL_SRV_VIDEO: | 400 | case CFCTRL_SRV_VIDEO: |
402 | servicel = cfvidl_create(linkid, &phyinfo->dev_info); | 401 | servicel = cfvidl_create(channel_id, &phyinfo->dev_info); |
403 | break; | 402 | break; |
404 | case CFCTRL_SRV_DBG: | 403 | case CFCTRL_SRV_DBG: |
405 | servicel = cfdbgl_create(linkid, &phyinfo->dev_info); | 404 | servicel = cfdbgl_create(channel_id, &phyinfo->dev_info); |
406 | break; | 405 | break; |
407 | default: | 406 | default: |
408 | pr_err("CAIF: %s(): Protocol error. " | 407 | pr_err("CAIF: %s(): Protocol error. " |
@@ -415,7 +414,7 @@ cncfg_linkup_rsp(struct cflayer *layer, u8 linkid, enum cfctrl_srv serv, | |||
415 | return; | 414 | return; |
416 | } | 415 | } |
417 | layer_set_dn(servicel, cnfg->mux); | 416 | layer_set_dn(servicel, cnfg->mux); |
418 | cfmuxl_set_uplayer(cnfg->mux, servicel, linkid); | 417 | cfmuxl_set_uplayer(cnfg->mux, servicel, channel_id); |
419 | layer_set_up(servicel, adapt_layer); | 418 | layer_set_up(servicel, adapt_layer); |
420 | layer_set_dn(adapt_layer, servicel); | 419 | layer_set_dn(adapt_layer, servicel); |
421 | servicel->ctrlcmd(servicel, CAIF_CTRLCMD_INIT_RSP, 0); | 420 | servicel->ctrlcmd(servicel, CAIF_CTRLCMD_INIT_RSP, 0); |