Lines Matching defs:ctlb

47 static void t7xx_ccmni_enable_napi(struct t7xx_ccmni_ctrl *ctlb)
52 ctrl = ctlb->hif_ctrl;
54 if (ctlb->is_napi_en)
68 napi_enable(ctlb->napi[i]);
69 napi_schedule(ctlb->napi[i]);
71 ctlb->is_napi_en = true;
74 static void t7xx_ccmni_disable_napi(struct t7xx_ccmni_ctrl *ctlb)
78 if (!ctlb->is_napi_en)
82 napi_synchronize(ctlb->napi[i]);
83 napi_disable(ctlb->napi[i]);
86 ctlb->is_napi_en = false;
92 struct t7xx_ccmni_ctrl *ccmni_ctl = ccmni->ctlb;
106 struct t7xx_ccmni_ctrl *ccmni_ctl = ccmni->ctlb;
120 struct t7xx_ccmni_ctrl *ctlb = ccmni->ctlb;
125 if (t7xx_dpmaif_tx_send_skb(ctlb->hif_ctrl, txq_number, skb))
169 static void t7xx_ccmni_start(struct t7xx_ccmni_ctrl *ctlb)
174 for (i = 0; i < ctlb->nic_dev_num; i++) {
175 ccmni = ctlb->ccmni_inst[i];
185 if (atomic_read(&ctlb->napi_usr_refcnt))
186 t7xx_ccmni_enable_napi(ctlb);
189 static void t7xx_ccmni_pre_stop(struct t7xx_ccmni_ctrl *ctlb)
194 for (i = 0; i < ctlb->nic_dev_num; i++) {
195 ccmni = ctlb->ccmni_inst[i];
204 static void t7xx_ccmni_post_stop(struct t7xx_ccmni_ctrl *ctlb)
209 if (atomic_read(&ctlb->napi_usr_refcnt))
210 t7xx_ccmni_disable_napi(ctlb);
212 for (i = 0; i < ctlb->nic_dev_num; i++) {
213 ccmni = ctlb->ccmni_inst[i];
256 static void t7xx_init_netdev_napi(struct t7xx_ccmni_ctrl *ctlb)
263 init_dummy_netdev(&ctlb->dummy_dev);
264 atomic_set(&ctlb->napi_usr_refcnt, 0);
265 ctlb->is_napi_en = false;
268 ctlb->napi[i] = &ctlb->hif_ctrl->rxq[i].napi;
269 netif_napi_add_weight(&ctlb->dummy_dev, ctlb->napi[i], t7xx_dpmaif_napi_rx_poll,
274 static void t7xx_uninit_netdev_napi(struct t7xx_ccmni_ctrl *ctlb)
279 netif_napi_del(ctlb->napi[i]);
280 ctlb->napi[i] = NULL;
287 struct t7xx_ccmni_ctrl *ctlb = ctxt;
291 if (if_id >= ARRAY_SIZE(ctlb->ccmni_inst))
296 ccmni->ctlb = ctlb;
299 ctlb->ccmni_inst[if_id] = ccmni;
312 struct t7xx_ccmni_ctrl *ctlb = ctxt;
315 if (if_id >= ARRAY_SIZE(ctlb->ccmni_inst))
318 if (WARN_ON(ctlb->ccmni_inst[if_id] != ccmni))
331 static int t7xx_ccmni_register_wwan(struct t7xx_ccmni_ctrl *ctlb)
333 struct device *dev = ctlb->hif_ctrl->dev;
336 if (ctlb->wwan_is_registered)
340 ret = wwan_register_ops(dev, &ccmni_wwan_ops, ctlb, IP_MUX_SESSION_DEFAULT);
346 ctlb->wwan_is_registered = true;
352 struct t7xx_ccmni_ctrl *ctlb = para;
356 dev = ctlb->hif_ctrl->dev;
357 ctlb->md_sta = state;
361 ret = t7xx_ccmni_register_wwan(ctlb);
363 t7xx_ccmni_start(ctlb);
368 t7xx_ccmni_pre_stop(ctlb);
370 ret = t7xx_dpmaif_md_state_callback(ctlb->hif_ctrl, state);
374 t7xx_ccmni_post_stop(ctlb);
379 ret = t7xx_dpmaif_md_state_callback(ctlb->hif_ctrl, state);
394 struct t7xx_ccmni_ctrl *ctlb = t7xx_dev->ccmni_ctlb;
397 md_status_notifier = &ctlb->md_status_notify;
400 md_status_notifier->data = ctlb;
436 static void t7xx_ccmni_queue_tx_irq_notify(struct t7xx_ccmni_ctrl *ctlb, int qno)
438 struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0];
448 static void t7xx_ccmni_queue_tx_full_notify(struct t7xx_ccmni_ctrl *ctlb, int qno)
450 struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0];
463 struct t7xx_ccmni_ctrl *ctlb = t7xx_dev->ccmni_ctlb;
465 if (ctlb->md_sta != MD_STATE_READY)
468 if (!ctlb->ccmni_inst[0]) {
474 t7xx_ccmni_queue_tx_irq_notify(ctlb, qno);
476 t7xx_ccmni_queue_tx_full_notify(ctlb, qno);
482 struct t7xx_ccmni_ctrl *ctlb;
484 ctlb = devm_kzalloc(dev, sizeof(*ctlb), GFP_KERNEL);
485 if (!ctlb)
488 t7xx_dev->ccmni_ctlb = ctlb;
489 ctlb->t7xx_dev = t7xx_dev;
490 ctlb->callbacks.state_notify = t7xx_ccmni_queue_state_notify;
491 ctlb->callbacks.recv_skb = t7xx_ccmni_recv_skb;
492 ctlb->nic_dev_num = NIC_DEV_DEFAULT;
494 ctlb->hif_ctrl = t7xx_dpmaif_hif_init(t7xx_dev, &ctlb->callbacks);
495 if (!ctlb->hif_ctrl)
498 t7xx_init_netdev_napi(ctlb);
505 struct t7xx_ccmni_ctrl *ctlb = t7xx_dev->ccmni_ctlb;
507 t7xx_fsm_notifier_unregister(t7xx_dev->md, &ctlb->md_status_notify);
509 if (ctlb->wwan_is_registered) {
511 ctlb->wwan_is_registered = false;
514 t7xx_uninit_netdev_napi(ctlb);
515 t7xx_dpmaif_hif_exit(ctlb->hif_ctrl);