Lines Matching refs:ecm

374 static void ecm_do_notify(struct f_ecm *ecm)  in ecm_do_notify()  argument
376 struct usb_request *req = ecm->notify_req; in ecm_do_notify()
378 struct usb_composite_dev *cdev = ecm->port.func.config->cdev; in ecm_do_notify()
387 switch (ecm->notify_state) { in ecm_do_notify()
393 if (ecm->is_open) in ecm_do_notify()
401 ecm->is_open ? "true" : "false"); in ecm_do_notify()
402 ecm->notify_state = ECM_NOTIFY_SPEED; in ecm_do_notify()
417 ecm->notify_state = ECM_NOTIFY_NONE; in ecm_do_notify()
421 event->wIndex = cpu_to_le16(ecm->ctrl_id); in ecm_do_notify()
423 ecm->notify_req = NULL; in ecm_do_notify()
424 status = usb_ep_queue(ecm->notify, req, GFP_ATOMIC); in ecm_do_notify()
426 ecm->notify_req = req; in ecm_do_notify()
431 static void ecm_notify(struct f_ecm *ecm) in ecm_notify() argument
438 ecm->notify_state = ECM_NOTIFY_CONNECT; in ecm_notify()
439 ecm_do_notify(ecm); in ecm_notify()
444 struct f_ecm *ecm = req->context; in ecm_notify_complete() local
445 struct usb_composite_dev *cdev = ecm->port.func.config->cdev; in ecm_notify_complete()
454 ecm->notify_state = ECM_NOTIFY_NONE; in ecm_notify_complete()
461 ecm->notify_req = req; in ecm_notify_complete()
462 ecm_do_notify(ecm); in ecm_notify_complete()
467 struct f_ecm *ecm = func_to_ecm(f); in ecm_setup() local
484 if (w_length != 0 || w_index != ecm->ctrl_id) in ecm_setup()
491 ecm->port.cdc_filter = w_value; in ecm_setup()
532 struct f_ecm *ecm = func_to_ecm(f); in ecm_set_alt() local
536 if (intf == ecm->ctrl_id) { in ecm_set_alt()
541 usb_ep_disable(ecm->notify); in ecm_set_alt()
542 if (!(ecm->notify->desc)) { in ecm_set_alt()
544 if (config_ep_by_speed(cdev->gadget, f, ecm->notify)) in ecm_set_alt()
547 usb_ep_enable(ecm->notify); in ecm_set_alt()
550 } else if (intf == ecm->data_id) { in ecm_set_alt()
554 if (ecm->port.in_ep->enabled) { in ecm_set_alt()
556 gether_disconnect(&ecm->port); in ecm_set_alt()
559 if (!ecm->port.in_ep->desc || in ecm_set_alt()
560 !ecm->port.out_ep->desc) { in ecm_set_alt()
563 ecm->port.in_ep) || in ecm_set_alt()
565 ecm->port.out_ep)) { in ecm_set_alt()
566 ecm->port.in_ep->desc = NULL; in ecm_set_alt()
567 ecm->port.out_ep->desc = NULL; in ecm_set_alt()
581 ecm->port.is_zlp_ok = in ecm_set_alt()
583 ecm->port.cdc_filter = DEFAULT_FILTER; in ecm_set_alt()
585 net = gether_connect(&ecm->port); in ecm_set_alt()
596 ecm_notify(ecm); in ecm_set_alt()
610 struct f_ecm *ecm = func_to_ecm(f); in ecm_get_alt() local
612 if (intf == ecm->ctrl_id) in ecm_get_alt()
614 return ecm->port.in_ep->enabled ? 1 : 0; in ecm_get_alt()
619 struct f_ecm *ecm = func_to_ecm(f); in ecm_disable() local
624 if (ecm->port.in_ep->enabled) in ecm_disable()
625 gether_disconnect(&ecm->port); in ecm_disable()
627 usb_ep_disable(ecm->notify); in ecm_disable()
628 ecm->notify->desc = NULL; in ecm_disable()
653 struct f_ecm *ecm = func_to_ecm(&geth->func); in ecm_open() local
655 DBG(ecm->port.func.config->cdev, "%s\n", __func__); in ecm_open()
657 ecm->is_open = true; in ecm_open()
658 ecm_notify(ecm); in ecm_open()
663 struct f_ecm *ecm = func_to_ecm(&geth->func); in ecm_close() local
665 DBG(ecm->port.func.config->cdev, "%s\n", __func__); in ecm_close()
667 ecm->is_open = false; in ecm_close()
668 ecm_notify(ecm); in ecm_close()
679 struct f_ecm *ecm = func_to_ecm(f); in ecm_bind() local
708 ecm_string_defs[1].s = ecm->ethaddr; in ecm_bind()
723 ecm->ctrl_id = status; in ecm_bind()
732 ecm->data_id = status; in ecm_bind()
744 ecm->port.in_ep = ep; in ecm_bind()
749 ecm->port.out_ep = ep; in ecm_bind()
758 ecm->notify = ep; in ecm_bind()
763 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL); in ecm_bind()
764 if (!ecm->notify_req) in ecm_bind()
766 ecm->notify_req->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL); in ecm_bind()
767 if (!ecm->notify_req->buf) in ecm_bind()
769 ecm->notify_req->context = ecm; in ecm_bind()
770 ecm->notify_req->complete = ecm_notify_complete; in ecm_bind()
796 ecm->port.open = ecm_open; in ecm_bind()
797 ecm->port.close = ecm_close; in ecm_bind()
802 ecm->port.in_ep->name, ecm->port.out_ep->name, in ecm_bind()
803 ecm->notify->name); in ecm_bind()
807 if (ecm->notify_req) { in ecm_bind()
808 kfree(ecm->notify_req->buf); in ecm_bind()
809 usb_ep_free_request(ecm->notify, ecm->notify_req); in ecm_bind()
824 USB_ETHERNET_CONFIGFS_ITEM(ecm);
827 USB_ETHERNET_CONFIGFS_ITEM_ATTR_DEV_ADDR(ecm);
830 USB_ETHERNET_CONFIGFS_ITEM_ATTR_HOST_ADDR(ecm);
833 USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(ecm);
836 USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(ecm);
887 struct f_ecm *ecm; in ecm_free() local
890 ecm = func_to_ecm(f); in ecm_free()
892 kfree(ecm); in ecm_free()
900 struct f_ecm *ecm = func_to_ecm(f); in ecm_unbind() local
906 kfree(ecm->notify_req->buf); in ecm_unbind()
907 usb_ep_free_request(ecm->notify, ecm->notify_req); in ecm_unbind()
912 struct f_ecm *ecm; in ecm_alloc() local
917 ecm = kzalloc(sizeof(*ecm), GFP_KERNEL); in ecm_alloc()
918 if (!ecm) in ecm_alloc()
926 status = gether_get_host_addr_cdc(opts->net, ecm->ethaddr, in ecm_alloc()
927 sizeof(ecm->ethaddr)); in ecm_alloc()
929 kfree(ecm); in ecm_alloc()
934 ecm->port.ioport = netdev_priv(opts->net); in ecm_alloc()
936 ecm->port.cdc_filter = DEFAULT_FILTER; in ecm_alloc()
938 ecm->port.func.name = "cdc_ethernet"; in ecm_alloc()
940 ecm->port.func.bind = ecm_bind; in ecm_alloc()
941 ecm->port.func.unbind = ecm_unbind; in ecm_alloc()
942 ecm->port.func.set_alt = ecm_set_alt; in ecm_alloc()
943 ecm->port.func.get_alt = ecm_get_alt; in ecm_alloc()
944 ecm->port.func.setup = ecm_setup; in ecm_alloc()
945 ecm->port.func.disable = ecm_disable; in ecm_alloc()
946 ecm->port.func.free_func = ecm_free; in ecm_alloc()
948 return &ecm->port.func; in ecm_alloc()
951 DECLARE_USB_FUNCTION_INIT(ecm, ecm_alloc_inst, ecm_alloc);