]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: svc: create bidirectional routes on hotplug request
authorPerry Hung <perry@leaflabs.com>
Fri, 24 Jul 2015 23:02:32 +0000 (19:02 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 27 Jul 2015 21:13:04 +0000 (14:13 -0700)
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 <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/svc.c

index f3321296db8a711516e286aff64f67ecd4c13008..3d1808712598b5463c5616ed58fe64f02087d7e5 100644 (file)
@@ -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",