From: Perry Hung Date: Fri, 24 Jul 2015 23:02:32 +0000 (-0400) Subject: greybus: svc: create bidirectional routes on hotplug request X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1321 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5d6896d24a7bf557816677abdac225074576f8a3;p=karo-tx-linux.git greybus: svc: create bidirectional routes on hotplug request Upon receiving a hotplug request, we need to prepare the routing table to allow packets to flow between the AP interface and the newly detected interface. Tested-by: Viresh Kumar Reviewed-by: Viresh Kumar Signed-off-by: Perry Hung Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index f3321296db8a..3d1808712598 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -309,6 +309,25 @@ static int gb_svc_intf_hotplug_recv(struct gb_operation *op) goto ida_put; } + /* + * Create a two-way route between the AP and the new interface + */ + ret = route_create_operation(svc, hd->endo->ap_intf_id, + GB_DEVICE_ID_AP, intf_id, device_id); + if (ret) { + dev_err(dev, "%s: Route create operation failed, interface %hhu device_id %hhu (%d)\n", + __func__, intf_id, device_id, ret); + goto ida_put; + } + + ret = route_create_operation(svc, intf_id, device_id, + hd->endo->ap_intf_id, GB_DEVICE_ID_AP); + if (ret) { + dev_err(dev, "%s: Route create operation failed, interface %hhu device_id %hhu (%d)\n", + __func__, intf_id, device_id, ret); + goto ida_put; + } + ret = gb_interface_init(intf, device_id); if (ret) { dev_err(dev, "%s: Failed to initialize interface, interface %hhu device_id %hhu (%d)\n",