Lines Matching refs:iface
223 struct interface *iface = (struct interface *)p; in ksmbd_kthread_fn() local
227 mutex_lock(&iface->sock_release_lock); in ksmbd_kthread_fn()
228 if (!iface->ksmbd_socket) { in ksmbd_kthread_fn()
229 mutex_unlock(&iface->sock_release_lock); in ksmbd_kthread_fn()
232 ret = kernel_accept(iface->ksmbd_socket, &client_sk, in ksmbd_kthread_fn()
234 mutex_unlock(&iface->sock_release_lock); in ksmbd_kthread_fn()
263 static int ksmbd_tcp_run_kthread(struct interface *iface) in ksmbd_tcp_run_kthread() argument
268 kthread = kthread_run(ksmbd_kthread_fn, (void *)iface, "ksmbd-%s", in ksmbd_tcp_run_kthread()
269 iface->name); in ksmbd_tcp_run_kthread()
274 iface->ksmbd_kthread = kthread; in ksmbd_tcp_run_kthread()
392 static int create_socket(struct interface *iface) in create_socket() argument
426 KERNEL_SOCKPTR(iface->name), in create_socket()
427 strlen(iface->name)); in create_socket()
453 iface->ksmbd_socket = ksmbd_socket; in create_socket()
454 ret = ksmbd_tcp_run_kthread(iface); in create_socket()
459 iface->state = IFACE_STATE_CONFIGURED; in create_socket()
466 iface->ksmbd_socket = NULL; in create_socket()
474 struct interface *iface; in ksmbd_netdev_event() local
482 list_for_each_entry(iface, &iface_list, entry) { in ksmbd_netdev_event()
483 if (!strcmp(iface->name, netdev->name)) { in ksmbd_netdev_event()
485 if (iface->state != IFACE_STATE_DOWN) in ksmbd_netdev_event()
487 ret = create_socket(iface); in ksmbd_netdev_event()
494 iface = alloc_iface(kstrdup(netdev->name, GFP_KERNEL)); in ksmbd_netdev_event()
495 if (!iface) in ksmbd_netdev_event()
497 ret = create_socket(iface); in ksmbd_netdev_event()
503 list_for_each_entry(iface, &iface_list, entry) { in ksmbd_netdev_event()
504 if (!strcmp(iface->name, netdev->name) && in ksmbd_netdev_event()
505 iface->state == IFACE_STATE_CONFIGURED) { in ksmbd_netdev_event()
506 tcp_stop_kthread(iface->ksmbd_kthread); in ksmbd_netdev_event()
507 iface->ksmbd_kthread = NULL; in ksmbd_netdev_event()
508 mutex_lock(&iface->sock_release_lock); in ksmbd_netdev_event()
509 tcp_destroy_socket(iface->ksmbd_socket); in ksmbd_netdev_event()
510 iface->ksmbd_socket = NULL; in ksmbd_netdev_event()
511 mutex_unlock(&iface->sock_release_lock); in ksmbd_netdev_event()
513 iface->state = IFACE_STATE_DOWN; in ksmbd_netdev_event()
548 struct interface *iface, *tmp; in ksmbd_tcp_destroy() local
552 list_for_each_entry_safe(iface, tmp, &iface_list, entry) { in ksmbd_tcp_destroy()
553 list_del(&iface->entry); in ksmbd_tcp_destroy()
554 kfree(iface->name); in ksmbd_tcp_destroy()
555 kfree(iface); in ksmbd_tcp_destroy()
561 struct interface *iface; in alloc_iface() local
566 iface = kzalloc(sizeof(struct interface), GFP_KERNEL); in alloc_iface()
567 if (!iface) { in alloc_iface()
572 iface->name = ifname; in alloc_iface()
573 iface->state = IFACE_STATE_DOWN; in alloc_iface()
574 list_add(&iface->entry, &iface_list); in alloc_iface()
575 mutex_init(&iface->sock_release_lock); in alloc_iface()
576 return iface; in alloc_iface()