On 30/05/2017 11:07, Simon Horman wrote:
On Sun, May 28, 2017 at 02:59:44PM +0300, Roi Dayan wrote:
Add tc module to expose tc operations to be used by other modules.
Move some tc related functions from netdev-linux.c to tc.c
This patch doesn't change any functionality.

Signed-off-by: Paul Blakey <[email protected]>
Signed-off-by: Roi Dayan <[email protected]>

Thanks, this looks good to me modulo the minor suggestion below.
I would be happy to apply it if someone provided a review.

...

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 4fc3f6b..7a0517b 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c

...

@@ -4643,44 +4634,6 @@ static double ticks_per_s;
  */
 static unsigned int buffer_hz;

-/* Returns tc handle 'major':'minor'. */
-static unsigned int
-tc_make_handle(unsigned int major, unsigned int minor)
-{
-    return TC_H_MAKE(major << 16, minor);
-}
-
-/* Returns the major number from 'handle'. */
-static unsigned int
-tc_get_major(unsigned int handle)
-{
-    return TC_H_MAJ(handle) >> 16;
-}
-
-/* Returns the minor number from 'handle'. */
-static unsigned int
-tc_get_minor(unsigned int handle)
-{
-    return TC_H_MIN(handle);
-}

...

diff --git a/lib/tc.c b/lib/tc.c
new file mode 100644
index 0000000..644f30c
--- /dev/null
+++ b/lib/tc.c
@@ -0,0 +1,114 @@

...

+VLOG_DEFINE_THIS_MODULE(tc);
+
+/* Returns tc handle 'major':'minor'. */
+unsigned int
+tc_make_handle(unsigned int major, unsigned int minor)
+{
+    return TC_H_MAKE(major << 16, minor);
+}
+
+/* Returns the major number from 'handle'. */
+unsigned int
+tc_get_major(unsigned int handle)
+{
+    return TC_H_MAJ(handle) >> 16;
+}
+
+/* Returns the minor number from 'handle'. */
+unsigned int
+tc_get_minor(unsigned int handle)
+{
+    return TC_H_MIN(handle);
+}

I think that some consideration should be given to a follow-up patch to
move the above functions to tc.h and making them static inline to avoid
function-call overhead.

...


ok
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to