cfcnfg.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /*
  2. * Copyright (C) ST-Ericsson AB 2010
  3. * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
  4. * License terms: GNU General Public License (GPL) version 2
  5. */
  6. #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
  7. #include <linux/kernel.h>
  8. #include <linux/stddef.h>
  9. #include <linux/slab.h>
  10. #include <linux/netdevice.h>
  11. #include <linux/module.h>
  12. #include <net/caif/caif_layer.h>
  13. #include <net/caif/cfpkt.h>
  14. #include <net/caif/cfcnfg.h>
  15. #include <net/caif/cfctrl.h>
  16. #include <net/caif/cfmuxl.h>
  17. #include <net/caif/cffrml.h>
  18. #include <net/caif/cfserl.h>
  19. #include <net/caif/cfsrvl.h>
  20. #include <net/caif/caif_dev.h>
  21. #define container_obj(layr) container_of(layr, struct cfcnfg, layer)
  22. /* Information about CAIF physical interfaces held by Config Module in order
  23. * to manage physical interfaces
  24. */
  25. struct cfcnfg_phyinfo {
  26. struct list_head node;
  27. bool up;
  28. /* Pointer to the layer below the MUX (framing layer) */
  29. struct cflayer *frm_layer;
  30. /* Pointer to the lowest actual physical layer */
  31. struct cflayer *phy_layer;
  32. /* Unique identifier of the physical interface */
  33. unsigned int id;
  34. /* Preference of the physical in interface */
  35. enum cfcnfg_phy_preference pref;
  36. /* Information about the physical device */
  37. struct dev_info dev_info;
  38. /* Interface index */
  39. int ifindex;
  40. /* Use Start of frame extension */
  41. bool use_stx;
  42. /* Use Start of frame checksum */
  43. bool use_fcs;
  44. };
  45. struct cfcnfg {
  46. struct cflayer layer;
  47. struct cflayer *ctrl;
  48. struct cflayer *mux;
  49. struct list_head phys;
  50. struct mutex lock;
  51. };
  52. static void cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id,
  53. enum cfctrl_srv serv, u8 phyid,
  54. struct cflayer *adapt_layer);
  55. static void cfcnfg_linkdestroy_rsp(struct cflayer *layer, u8 channel_id);
  56. static void cfcnfg_reject_rsp(struct cflayer *layer, u8 channel_id,
  57. struct cflayer *adapt_layer);
  58. static void cfctrl_resp_func(void);
  59. static void cfctrl_enum_resp(void);
  60. struct cfcnfg *cfcnfg_create(void)
  61. {
  62. struct cfcnfg *this;
  63. struct cfctrl_rsp *resp;
  64. might_sleep();
  65. /* Initiate this layer */
  66. this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC);
  67. if (!this) {
  68. pr_warn("Out of memory\n");
  69. return NULL;
  70. }
  71. this->mux = cfmuxl_create();
  72. if (!this->mux)
  73. goto out_of_mem;
  74. this->ctrl = cfctrl_create();
  75. if (!this->ctrl)
  76. goto out_of_mem;
  77. /* Initiate response functions */
  78. resp = cfctrl_get_respfuncs(this->ctrl);
  79. resp->enum_rsp = cfctrl_enum_resp;
  80. resp->linkerror_ind = cfctrl_resp_func;
  81. resp->linkdestroy_rsp = cfcnfg_linkdestroy_rsp;
  82. resp->sleep_rsp = cfctrl_resp_func;
  83. resp->wake_rsp = cfctrl_resp_func;
  84. resp->restart_rsp = cfctrl_resp_func;
  85. resp->radioset_rsp = cfctrl_resp_func;
  86. resp->linksetup_rsp = cfcnfg_linkup_rsp;
  87. resp->reject_rsp = cfcnfg_reject_rsp;
  88. INIT_LIST_HEAD(&this->phys);
  89. cfmuxl_set_uplayer(this->mux, this->ctrl, 0);
  90. layer_set_dn(this->ctrl, this->mux);
  91. layer_set_up(this->ctrl, this);
  92. mutex_init(&this->lock);
  93. return this;
  94. out_of_mem:
  95. pr_warn("Out of memory\n");
  96. synchronize_rcu();
  97. kfree(this->mux);
  98. kfree(this->ctrl);
  99. kfree(this);
  100. return NULL;
  101. }
  102. EXPORT_SYMBOL(cfcnfg_create);
  103. void cfcnfg_remove(struct cfcnfg *cfg)
  104. {
  105. might_sleep();
  106. if (cfg) {
  107. synchronize_rcu();
  108. kfree(cfg->mux);
  109. kfree(cfg->ctrl);
  110. kfree(cfg);
  111. }
  112. }
  113. static void cfctrl_resp_func(void)
  114. {
  115. }
  116. static struct cfcnfg_phyinfo *cfcnfg_get_phyinfo_rcu(struct cfcnfg *cnfg,
  117. u8 phyid)
  118. {
  119. struct cfcnfg_phyinfo *phy;
  120. list_for_each_entry_rcu(phy, &cnfg->phys, node)
  121. if (phy->id == phyid)
  122. return phy;
  123. return NULL;
  124. }
  125. static void cfctrl_enum_resp(void)
  126. {
  127. }
  128. static struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
  129. enum cfcnfg_phy_preference phy_pref)
  130. {
  131. /* Try to match with specified preference */
  132. struct cfcnfg_phyinfo *phy;
  133. list_for_each_entry_rcu(phy, &cnfg->phys, node) {
  134. if (phy->up && phy->pref == phy_pref &&
  135. phy->frm_layer != NULL)
  136. return &phy->dev_info;
  137. }
  138. /* Otherwise just return something */
  139. list_for_each_entry_rcu(phy, &cnfg->phys, node)
  140. if (phy->up)
  141. return &phy->dev_info;
  142. return NULL;
  143. }
  144. static int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi)
  145. {
  146. struct cfcnfg_phyinfo *phy;
  147. list_for_each_entry_rcu(phy, &cnfg->phys, node)
  148. if (phy->ifindex == ifi && phy->up)
  149. return phy->id;
  150. return -ENODEV;
  151. }
  152. int caif_disconnect_client(struct net *net, struct cflayer *adap_layer)
  153. {
  154. u8 channel_id = 0;
  155. int ret = 0;
  156. struct cflayer *servl = NULL;
  157. struct cfcnfg *cfg = get_cfcnfg(net);
  158. caif_assert(adap_layer != NULL);
  159. channel_id = adap_layer->id;
  160. if (adap_layer->dn == NULL || channel_id == 0) {
  161. pr_err("adap_layer->dn == NULL or adap_layer->id is 0\n");
  162. ret = -ENOTCONN;
  163. goto end;
  164. }
  165. servl = cfmuxl_remove_uplayer(cfg->mux, channel_id);
  166. if (servl == NULL) {
  167. pr_err("PROTOCOL ERROR - "
  168. "Error removing service_layer Channel_Id(%d)",
  169. channel_id);
  170. ret = -EINVAL;
  171. goto end;
  172. }
  173. ret = cfctrl_linkdown_req(cfg->ctrl, channel_id, adap_layer);
  174. end:
  175. cfctrl_cancel_req(cfg->ctrl, adap_layer);
  176. /* Do RCU sync before initiating cleanup */
  177. synchronize_rcu();
  178. if (adap_layer->ctrlcmd != NULL)
  179. adap_layer->ctrlcmd(adap_layer, CAIF_CTRLCMD_DEINIT_RSP, 0);
  180. return ret;
  181. }
  182. EXPORT_SYMBOL(caif_disconnect_client);
  183. static void cfcnfg_linkdestroy_rsp(struct cflayer *layer, u8 channel_id)
  184. {
  185. }
  186. static const int protohead[CFCTRL_SRV_MASK] = {
  187. [CFCTRL_SRV_VEI] = 4,
  188. [CFCTRL_SRV_DATAGRAM] = 7,
  189. [CFCTRL_SRV_UTIL] = 4,
  190. [CFCTRL_SRV_RFM] = 3,
  191. [CFCTRL_SRV_DBG] = 3,
  192. };
  193. static int caif_connect_req_to_link_param(struct cfcnfg *cnfg,
  194. struct caif_connect_request *s,
  195. struct cfctrl_link_param *l)
  196. {
  197. struct dev_info *dev_info;
  198. enum cfcnfg_phy_preference pref;
  199. int res;
  200. memset(l, 0, sizeof(*l));
  201. /* In caif protocol low value is high priority */
  202. l->priority = CAIF_PRIO_MAX - s->priority + 1;
  203. if (s->ifindex != 0) {
  204. res = cfcnfg_get_id_from_ifi(cnfg, s->ifindex);
  205. if (res < 0)
  206. return res;
  207. l->phyid = res;
  208. } else {
  209. switch (s->link_selector) {
  210. case CAIF_LINK_HIGH_BANDW:
  211. pref = CFPHYPREF_HIGH_BW;
  212. break;
  213. case CAIF_LINK_LOW_LATENCY:
  214. pref = CFPHYPREF_LOW_LAT;
  215. break;
  216. default:
  217. return -EINVAL;
  218. }
  219. dev_info = cfcnfg_get_phyid(cnfg, pref);
  220. if (dev_info == NULL)
  221. return -ENODEV;
  222. l->phyid = dev_info->id;
  223. }
  224. switch (s->protocol) {
  225. case CAIFPROTO_AT:
  226. l->linktype = CFCTRL_SRV_VEI;
  227. l->endpoint = (s->sockaddr.u.at.type >> 2) & 0x3;
  228. l->chtype = s->sockaddr.u.at.type & 0x3;
  229. break;
  230. case CAIFPROTO_DATAGRAM:
  231. l->linktype = CFCTRL_SRV_DATAGRAM;
  232. l->chtype = 0x00;
  233. l->u.datagram.connid = s->sockaddr.u.dgm.connection_id;
  234. break;
  235. case CAIFPROTO_DATAGRAM_LOOP:
  236. l->linktype = CFCTRL_SRV_DATAGRAM;
  237. l->chtype = 0x03;
  238. l->endpoint = 0x00;
  239. l->u.datagram.connid = s->sockaddr.u.dgm.connection_id;
  240. break;
  241. case CAIFPROTO_RFM:
  242. l->linktype = CFCTRL_SRV_RFM;
  243. l->u.datagram.connid = s->sockaddr.u.rfm.connection_id;
  244. strncpy(l->u.rfm.volume, s->sockaddr.u.rfm.volume,
  245. sizeof(l->u.rfm.volume)-1);
  246. l->u.rfm.volume[sizeof(l->u.rfm.volume)-1] = 0;
  247. break;
  248. case CAIFPROTO_UTIL:
  249. l->linktype = CFCTRL_SRV_UTIL;
  250. l->endpoint = 0x00;
  251. l->chtype = 0x00;
  252. strncpy(l->u.utility.name, s->sockaddr.u.util.service,
  253. sizeof(l->u.utility.name)-1);
  254. l->u.utility.name[sizeof(l->u.utility.name)-1] = 0;
  255. caif_assert(sizeof(l->u.utility.name) > 10);
  256. l->u.utility.paramlen = s->param.size;
  257. if (l->u.utility.paramlen > sizeof(l->u.utility.params))
  258. l->u.utility.paramlen = sizeof(l->u.utility.params);
  259. memcpy(l->u.utility.params, s->param.data,
  260. l->u.utility.paramlen);
  261. break;
  262. case CAIFPROTO_DEBUG:
  263. l->linktype = CFCTRL_SRV_DBG;
  264. l->endpoint = s->sockaddr.u.dbg.service;
  265. l->chtype = s->sockaddr.u.dbg.type;
  266. break;
  267. default:
  268. return -EINVAL;
  269. }
  270. return 0;
  271. }
  272. int caif_connect_client(struct net *net, struct caif_connect_request *conn_req,
  273. struct cflayer *adap_layer, int *ifindex,
  274. int *proto_head,
  275. int *proto_tail)
  276. {
  277. struct cflayer *frml;
  278. struct cfcnfg_phyinfo *phy;
  279. int err;
  280. struct cfctrl_link_param param;
  281. struct cfcnfg *cfg = get_cfcnfg(net);
  282. caif_assert(cfg != NULL);
  283. rcu_read_lock();
  284. err = caif_connect_req_to_link_param(cfg, conn_req, &param);
  285. if (err)
  286. goto unlock;
  287. phy = cfcnfg_get_phyinfo_rcu(cfg, param.phyid);
  288. if (!phy) {
  289. err = -ENODEV;
  290. goto unlock;
  291. }
  292. err = -EINVAL;
  293. if (adap_layer == NULL) {
  294. pr_err("adap_layer is zero\n");
  295. goto unlock;
  296. }
  297. if (adap_layer->receive == NULL) {
  298. pr_err("adap_layer->receive is NULL\n");
  299. goto unlock;
  300. }
  301. if (adap_layer->ctrlcmd == NULL) {
  302. pr_err("adap_layer->ctrlcmd == NULL\n");
  303. goto unlock;
  304. }
  305. err = -ENODEV;
  306. frml = phy->frm_layer;
  307. if (frml == NULL) {
  308. pr_err("Specified PHY type does not exist!\n");
  309. goto unlock;
  310. }
  311. caif_assert(param.phyid == phy->id);
  312. caif_assert(phy->frm_layer->id ==
  313. param.phyid);
  314. caif_assert(phy->phy_layer->id ==
  315. param.phyid);
  316. *ifindex = phy->ifindex;
  317. *proto_tail = 2;
  318. *proto_head =
  319. protohead[param.linktype] + (phy->use_stx ? 1 : 0);
  320. rcu_read_unlock();
  321. /* FIXME: ENUMERATE INITIALLY WHEN ACTIVATING PHYSICAL INTERFACE */
  322. cfctrl_enum_req(cfg->ctrl, param.phyid);
  323. return cfctrl_linkup_request(cfg->ctrl, &param, adap_layer);
  324. unlock:
  325. rcu_read_unlock();
  326. return err;
  327. }
  328. EXPORT_SYMBOL(caif_connect_client);
  329. static void cfcnfg_reject_rsp(struct cflayer *layer, u8 channel_id,
  330. struct cflayer *adapt_layer)
  331. {
  332. if (adapt_layer != NULL && adapt_layer->ctrlcmd != NULL)
  333. adapt_layer->ctrlcmd(adapt_layer,
  334. CAIF_CTRLCMD_INIT_FAIL_RSP, 0);
  335. }
  336. static void
  337. cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
  338. u8 phyid, struct cflayer *adapt_layer)
  339. {
  340. struct cfcnfg *cnfg = container_obj(layer);
  341. struct cflayer *servicel = NULL;
  342. struct cfcnfg_phyinfo *phyinfo;
  343. struct net_device *netdev;
  344. rcu_read_lock();
  345. if (adapt_layer == NULL) {
  346. pr_debug("link setup response but no client exist,"
  347. "send linkdown back\n");
  348. cfctrl_linkdown_req(cnfg->ctrl, channel_id, NULL);
  349. goto unlock;
  350. }
  351. caif_assert(cnfg != NULL);
  352. caif_assert(phyid != 0);
  353. phyinfo = cfcnfg_get_phyinfo_rcu(cnfg, phyid);
  354. if (phyinfo == NULL) {
  355. pr_err("ERROR: Link Layer Device dissapeared"
  356. "while connecting\n");
  357. goto unlock;
  358. }
  359. caif_assert(phyinfo != NULL);
  360. caif_assert(phyinfo->id == phyid);
  361. caif_assert(phyinfo->phy_layer != NULL);
  362. caif_assert(phyinfo->phy_layer->id == phyid);
  363. adapt_layer->id = channel_id;
  364. switch (serv) {
  365. case CFCTRL_SRV_VEI:
  366. servicel = cfvei_create(channel_id, &phyinfo->dev_info);
  367. break;
  368. case CFCTRL_SRV_DATAGRAM:
  369. servicel = cfdgml_create(channel_id,
  370. &phyinfo->dev_info);
  371. break;
  372. case CFCTRL_SRV_RFM:
  373. netdev = phyinfo->dev_info.dev;
  374. servicel = cfrfml_create(channel_id, &phyinfo->dev_info,
  375. netdev->mtu);
  376. break;
  377. case CFCTRL_SRV_UTIL:
  378. servicel = cfutill_create(channel_id, &phyinfo->dev_info);
  379. break;
  380. case CFCTRL_SRV_VIDEO:
  381. servicel = cfvidl_create(channel_id, &phyinfo->dev_info);
  382. break;
  383. case CFCTRL_SRV_DBG:
  384. servicel = cfdbgl_create(channel_id, &phyinfo->dev_info);
  385. break;
  386. default:
  387. pr_err("Protocol error. Link setup response "
  388. "- unknown channel type\n");
  389. goto unlock;
  390. }
  391. if (!servicel) {
  392. pr_warn("Out of memory\n");
  393. goto unlock;
  394. }
  395. layer_set_dn(servicel, cnfg->mux);
  396. cfmuxl_set_uplayer(cnfg->mux, servicel, channel_id);
  397. layer_set_up(servicel, adapt_layer);
  398. layer_set_dn(adapt_layer, servicel);
  399. rcu_read_unlock();
  400. servicel->ctrlcmd(servicel, CAIF_CTRLCMD_INIT_RSP, 0);
  401. return;
  402. unlock:
  403. rcu_read_unlock();
  404. }
  405. void
  406. cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
  407. struct net_device *dev, struct cflayer *phy_layer,
  408. enum cfcnfg_phy_preference pref,
  409. bool fcs, bool stx)
  410. {
  411. struct cflayer *frml;
  412. struct cflayer *phy_driver = NULL;
  413. struct cfcnfg_phyinfo *phyinfo;
  414. int i;
  415. u8 phyid;
  416. mutex_lock(&cnfg->lock);
  417. /* CAIF protocol allow maximum 6 link-layers */
  418. for (i = 0; i < 7; i++) {
  419. phyid = (dev->ifindex + i) & 0x7;
  420. if (phyid == 0)
  421. continue;
  422. if (cfcnfg_get_phyinfo_rcu(cnfg, phyid) == NULL)
  423. goto got_phyid;
  424. }
  425. pr_warn("Too many CAIF Link Layers (max 6)\n");
  426. goto out;
  427. got_phyid:
  428. phyinfo = kzalloc(sizeof(struct cfcnfg_phyinfo), GFP_ATOMIC);
  429. switch (phy_type) {
  430. case CFPHYTYPE_FRAG:
  431. phy_driver =
  432. cfserl_create(CFPHYTYPE_FRAG, phyid, stx);
  433. if (!phy_driver) {
  434. pr_warn("Out of memory\n");
  435. goto out;
  436. }
  437. break;
  438. case CFPHYTYPE_CAIF:
  439. phy_driver = NULL;
  440. break;
  441. default:
  442. goto out;
  443. }
  444. phy_layer->id = phyid;
  445. phyinfo->pref = pref;
  446. phyinfo->id = phyid;
  447. phyinfo->dev_info.id = phyid;
  448. phyinfo->dev_info.dev = dev;
  449. phyinfo->phy_layer = phy_layer;
  450. phyinfo->ifindex = dev->ifindex;
  451. phyinfo->use_stx = stx;
  452. phyinfo->use_fcs = fcs;
  453. phy_layer->type = phy_type;
  454. frml = cffrml_create(phyid, fcs);
  455. if (!frml) {
  456. pr_warn("Out of memory\n");
  457. kfree(phyinfo);
  458. goto out;
  459. }
  460. phyinfo->frm_layer = frml;
  461. layer_set_up(frml, cnfg->mux);
  462. if (phy_driver != NULL) {
  463. phy_driver->id = phyid;
  464. layer_set_dn(frml, phy_driver);
  465. layer_set_up(phy_driver, frml);
  466. layer_set_dn(phy_driver, phy_layer);
  467. layer_set_up(phy_layer, phy_driver);
  468. } else {
  469. layer_set_dn(frml, phy_layer);
  470. layer_set_up(phy_layer, frml);
  471. }
  472. list_add_rcu(&phyinfo->node, &cnfg->phys);
  473. out:
  474. mutex_unlock(&cnfg->lock);
  475. }
  476. EXPORT_SYMBOL(cfcnfg_add_phy_layer);
  477. int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer,
  478. bool up)
  479. {
  480. struct cfcnfg_phyinfo *phyinfo;
  481. rcu_read_lock();
  482. phyinfo = cfcnfg_get_phyinfo_rcu(cnfg, phy_layer->id);
  483. if (phyinfo == NULL) {
  484. rcu_read_unlock();
  485. return -ENODEV;
  486. }
  487. if (phyinfo->up == up) {
  488. rcu_read_unlock();
  489. return 0;
  490. }
  491. phyinfo->up = up;
  492. if (up) {
  493. cffrml_hold(phyinfo->frm_layer);
  494. cfmuxl_set_dnlayer(cnfg->mux, phyinfo->frm_layer,
  495. phy_layer->id);
  496. } else {
  497. cfmuxl_remove_dnlayer(cnfg->mux, phy_layer->id);
  498. cffrml_put(phyinfo->frm_layer);
  499. }
  500. rcu_read_unlock();
  501. return 0;
  502. }
  503. EXPORT_SYMBOL(cfcnfg_set_phy_state);
  504. int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer)
  505. {
  506. struct cflayer *frml, *frml_dn;
  507. u16 phyid;
  508. struct cfcnfg_phyinfo *phyinfo;
  509. might_sleep();
  510. mutex_lock(&cnfg->lock);
  511. phyid = phy_layer->id;
  512. phyinfo = cfcnfg_get_phyinfo_rcu(cnfg, phyid);
  513. if (phyinfo == NULL) {
  514. mutex_unlock(&cnfg->lock);
  515. return 0;
  516. }
  517. caif_assert(phyid == phyinfo->id);
  518. caif_assert(phy_layer == phyinfo->phy_layer);
  519. caif_assert(phy_layer->id == phyid);
  520. caif_assert(phyinfo->frm_layer->id == phyid);
  521. list_del_rcu(&phyinfo->node);
  522. synchronize_rcu();
  523. /* Fail if reference count is not zero */
  524. if (cffrml_refcnt_read(phyinfo->frm_layer) != 0) {
  525. pr_info("Wait for device inuse\n");
  526. list_add_rcu(&phyinfo->node, &cnfg->phys);
  527. mutex_unlock(&cnfg->lock);
  528. return -EAGAIN;
  529. }
  530. frml = phyinfo->frm_layer;
  531. frml_dn = frml->dn;
  532. cffrml_set_uplayer(frml, NULL);
  533. cffrml_set_dnlayer(frml, NULL);
  534. if (phy_layer != frml_dn) {
  535. layer_set_up(frml_dn, NULL);
  536. layer_set_dn(frml_dn, NULL);
  537. }
  538. layer_set_up(phy_layer, NULL);
  539. if (phyinfo->phy_layer != frml_dn)
  540. kfree(frml_dn);
  541. cffrml_free(frml);
  542. kfree(phyinfo);
  543. mutex_unlock(&cnfg->lock);
  544. return 0;
  545. }
  546. EXPORT_SYMBOL(cfcnfg_del_phy_layer);