greybus: svc: add flags and traffic class parameter to connection create op
authorPerry Hung <perry@leaflabs.com>
Fri, 24 Jul 2015 23:02:34 +0000 (19:02 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 27 Jul 2015 21:13:10 +0000 (14:13 -0700)
The AP needs to be able to specify L4 CPort flags and traffic class
parameters on a connection-by-connection basis. Extend the connection
create operation to accept these. Since there's no policy to decide
these, fix them at TC0 with end-to-end-flow control, controlled segment
dropping, and CPort safety valve enabled.

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/greybus_protocols.h
drivers/staging/greybus/svc.c

index 5b97073f410039874253afca3d036dbd9a8bbd7b..e2d38dfe06b60f9740111968eaa0fb99f65e321c 100644 (file)
@@ -606,6 +606,8 @@ struct gb_svc_conn_create_request {
        __u16   cport1_id;
        __u8    intf2_id;
        __u16   cport2_id;
+       __u8    tc;
+       __u8    flags;
 };
 /* connection create response has no payload */
 
index b718a881a7e3555ac999d1f1b9b2c11836ed29f6..b94a84aca0d8369828d069bf3917dfd97c96532b 100644 (file)
@@ -9,6 +9,10 @@
 
 #include "greybus.h"
 
+#define CPORT_FLAGS_E2EFC       (1)
+#define CPORT_FLAGS_CSD_N       (2)
+#define CPORT_FLAGS_CSV_N       (4)
+
 struct gb_svc {
        struct gb_connection    *connection;
        u8                      version_major;
@@ -98,6 +102,12 @@ static int connection_create_operation(struct gb_svc *svc,
        request.cport1_id = cport1_id;
        request.intf2_id = intf2_id;
        request.cport2_id = cport2_id;
+       /*
+        * XXX: fix connections paramaters to TC0 and all CPort flags
+        * for now.
+        */
+       request.tc = 0;
+       request.flags = CPORT_FLAGS_CSV_N | CPORT_FLAGS_E2EFC;
 
        return gb_operation_sync(svc->connection, GB_SVC_TYPE_CONN_CREATE,
                                 &request, sizeof(request), NULL, 0);