Lines Matching refs:ctlb

47 static void t7xx_ccmni_enable_napi(struct t7xx_ccmni_ctrl *ctlb)  in t7xx_ccmni_enable_napi()  argument
52 ctrl = ctlb->hif_ctrl; in t7xx_ccmni_enable_napi()
54 if (ctlb->is_napi_en) in t7xx_ccmni_enable_napi()
68 napi_enable(ctlb->napi[i]); in t7xx_ccmni_enable_napi()
69 napi_schedule(ctlb->napi[i]); in t7xx_ccmni_enable_napi()
71 ctlb->is_napi_en = true; in t7xx_ccmni_enable_napi()
74 static void t7xx_ccmni_disable_napi(struct t7xx_ccmni_ctrl *ctlb) in t7xx_ccmni_disable_napi() argument
78 if (!ctlb->is_napi_en) in t7xx_ccmni_disable_napi()
82 napi_synchronize(ctlb->napi[i]); in t7xx_ccmni_disable_napi()
83 napi_disable(ctlb->napi[i]); in t7xx_ccmni_disable_napi()
86 ctlb->is_napi_en = false; in t7xx_ccmni_disable_napi()
92 struct t7xx_ccmni_ctrl *ccmni_ctl = ccmni->ctlb; in t7xx_ccmni_open()
106 struct t7xx_ccmni_ctrl *ccmni_ctl = ccmni->ctlb; in t7xx_ccmni_close()
120 struct t7xx_ccmni_ctrl *ctlb = ccmni->ctlb; in t7xx_ccmni_send_packet() local
125 if (t7xx_dpmaif_tx_send_skb(ctlb->hif_ctrl, txq_number, skb)) in t7xx_ccmni_send_packet()
169 static void t7xx_ccmni_start(struct t7xx_ccmni_ctrl *ctlb) in t7xx_ccmni_start() argument
174 for (i = 0; i < ctlb->nic_dev_num; i++) { in t7xx_ccmni_start()
175 ccmni = ctlb->ccmni_inst[i]; in t7xx_ccmni_start()
185 if (atomic_read(&ctlb->napi_usr_refcnt)) in t7xx_ccmni_start()
186 t7xx_ccmni_enable_napi(ctlb); in t7xx_ccmni_start()
189 static void t7xx_ccmni_pre_stop(struct t7xx_ccmni_ctrl *ctlb) in t7xx_ccmni_pre_stop() argument
194 for (i = 0; i < ctlb->nic_dev_num; i++) { in t7xx_ccmni_pre_stop()
195 ccmni = ctlb->ccmni_inst[i]; in t7xx_ccmni_pre_stop()
204 static void t7xx_ccmni_post_stop(struct t7xx_ccmni_ctrl *ctlb) in t7xx_ccmni_post_stop() argument
209 if (atomic_read(&ctlb->napi_usr_refcnt)) in t7xx_ccmni_post_stop()
210 t7xx_ccmni_disable_napi(ctlb); in t7xx_ccmni_post_stop()
212 for (i = 0; i < ctlb->nic_dev_num; i++) { in t7xx_ccmni_post_stop()
213 ccmni = ctlb->ccmni_inst[i]; in t7xx_ccmni_post_stop()
256 static int t7xx_init_netdev_napi(struct t7xx_ccmni_ctrl *ctlb) in t7xx_init_netdev_napi() argument
263 ctlb->dummy_dev = alloc_netdev_dummy(0); in t7xx_init_netdev_napi()
264 if (!ctlb->dummy_dev) in t7xx_init_netdev_napi()
267 atomic_set(&ctlb->napi_usr_refcnt, 0); in t7xx_init_netdev_napi()
268 ctlb->is_napi_en = false; in t7xx_init_netdev_napi()
271 ctlb->napi[i] = &ctlb->hif_ctrl->rxq[i].napi; in t7xx_init_netdev_napi()
272 netif_napi_add_weight(ctlb->dummy_dev, ctlb->napi[i], t7xx_dpmaif_napi_rx_poll, in t7xx_init_netdev_napi()
279 static void t7xx_uninit_netdev_napi(struct t7xx_ccmni_ctrl *ctlb) in t7xx_uninit_netdev_napi() argument
284 netif_napi_del(ctlb->napi[i]); in t7xx_uninit_netdev_napi()
285 ctlb->napi[i] = NULL; in t7xx_uninit_netdev_napi()
287 free_netdev(ctlb->dummy_dev); in t7xx_uninit_netdev_napi()
293 struct t7xx_ccmni_ctrl *ctlb = ctxt; in t7xx_ccmni_wwan_newlink() local
297 if (if_id >= ARRAY_SIZE(ctlb->ccmni_inst)) in t7xx_ccmni_wwan_newlink()
302 ccmni->ctlb = ctlb; in t7xx_ccmni_wwan_newlink()
305 ctlb->ccmni_inst[if_id] = ccmni; in t7xx_ccmni_wwan_newlink()
318 struct t7xx_ccmni_ctrl *ctlb = ctxt; in t7xx_ccmni_wwan_dellink() local
321 if (if_id >= ARRAY_SIZE(ctlb->ccmni_inst)) in t7xx_ccmni_wwan_dellink()
324 if (WARN_ON(ctlb->ccmni_inst[if_id] != ccmni)) in t7xx_ccmni_wwan_dellink()
337 static int t7xx_ccmni_register_wwan(struct t7xx_ccmni_ctrl *ctlb) in t7xx_ccmni_register_wwan() argument
339 struct device *dev = ctlb->hif_ctrl->dev; in t7xx_ccmni_register_wwan()
342 if (ctlb->wwan_is_registered) in t7xx_ccmni_register_wwan()
346 ret = wwan_register_ops(dev, &ccmni_wwan_ops, ctlb, IP_MUX_SESSION_DEFAULT); in t7xx_ccmni_register_wwan()
352 ctlb->wwan_is_registered = true; in t7xx_ccmni_register_wwan()
358 struct t7xx_ccmni_ctrl *ctlb = para; in t7xx_ccmni_md_state_callback() local
362 dev = ctlb->hif_ctrl->dev; in t7xx_ccmni_md_state_callback()
363 ctlb->md_sta = state; in t7xx_ccmni_md_state_callback()
367 ret = t7xx_ccmni_register_wwan(ctlb); in t7xx_ccmni_md_state_callback()
369 t7xx_ccmni_start(ctlb); in t7xx_ccmni_md_state_callback()
374 t7xx_ccmni_pre_stop(ctlb); in t7xx_ccmni_md_state_callback()
376 ret = t7xx_dpmaif_md_state_callback(ctlb->hif_ctrl, state); in t7xx_ccmni_md_state_callback()
380 t7xx_ccmni_post_stop(ctlb); in t7xx_ccmni_md_state_callback()
385 ret = t7xx_dpmaif_md_state_callback(ctlb->hif_ctrl, state); in t7xx_ccmni_md_state_callback()
400 struct t7xx_ccmni_ctrl *ctlb = t7xx_dev->ccmni_ctlb; in init_md_status_notifier() local
403 md_status_notifier = &ctlb->md_status_notify; in init_md_status_notifier()
406 md_status_notifier->data = ctlb; in init_md_status_notifier()
442 static void t7xx_ccmni_queue_tx_irq_notify(struct t7xx_ccmni_ctrl *ctlb, int qno) in t7xx_ccmni_queue_tx_irq_notify() argument
444 struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0]; in t7xx_ccmni_queue_tx_irq_notify()
454 static void t7xx_ccmni_queue_tx_full_notify(struct t7xx_ccmni_ctrl *ctlb, int qno) in t7xx_ccmni_queue_tx_full_notify() argument
456 struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0]; in t7xx_ccmni_queue_tx_full_notify()
469 struct t7xx_ccmni_ctrl *ctlb = t7xx_dev->ccmni_ctlb; in t7xx_ccmni_queue_state_notify() local
471 if (ctlb->md_sta != MD_STATE_READY) in t7xx_ccmni_queue_state_notify()
474 if (!ctlb->ccmni_inst[0]) { in t7xx_ccmni_queue_state_notify()
480 t7xx_ccmni_queue_tx_irq_notify(ctlb, qno); in t7xx_ccmni_queue_state_notify()
482 t7xx_ccmni_queue_tx_full_notify(ctlb, qno); in t7xx_ccmni_queue_state_notify()
488 struct t7xx_ccmni_ctrl *ctlb; in t7xx_ccmni_init() local
491 ctlb = devm_kzalloc(dev, sizeof(*ctlb), GFP_KERNEL); in t7xx_ccmni_init()
492 if (!ctlb) in t7xx_ccmni_init()
495 t7xx_dev->ccmni_ctlb = ctlb; in t7xx_ccmni_init()
496 ctlb->t7xx_dev = t7xx_dev; in t7xx_ccmni_init()
497 ctlb->callbacks.state_notify = t7xx_ccmni_queue_state_notify; in t7xx_ccmni_init()
498 ctlb->callbacks.recv_skb = t7xx_ccmni_recv_skb; in t7xx_ccmni_init()
499 ctlb->nic_dev_num = NIC_DEV_DEFAULT; in t7xx_ccmni_init()
501 ctlb->hif_ctrl = t7xx_dpmaif_hif_init(t7xx_dev, &ctlb->callbacks); in t7xx_ccmni_init()
502 if (!ctlb->hif_ctrl) in t7xx_ccmni_init()
505 ret = t7xx_init_netdev_napi(ctlb); in t7xx_ccmni_init()
507 t7xx_dpmaif_hif_exit(ctlb->hif_ctrl); in t7xx_ccmni_init()
517 struct t7xx_ccmni_ctrl *ctlb = t7xx_dev->ccmni_ctlb; in t7xx_ccmni_exit() local
519 t7xx_fsm_notifier_unregister(t7xx_dev->md, &ctlb->md_status_notify); in t7xx_ccmni_exit()
521 if (ctlb->wwan_is_registered) { in t7xx_ccmni_exit()
523 ctlb->wwan_is_registered = false; in t7xx_ccmni_exit()
526 t7xx_uninit_netdev_napi(ctlb); in t7xx_ccmni_exit()
527 t7xx_dpmaif_hif_exit(ctlb->hif_ctrl); in t7xx_ccmni_exit()