Re: [ovs-dev] [PATCH V10 02/33] tc: Introduce tc module

2017-06-12 Thread Roi Dayan



On 08/06/2017 17:30, Simon Horman wrote:

On Thu, Jun 08, 2017 at 02:46:19PM +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 
Co-authored-by: Roi Dayan 


Hi Roi,

as your name appears in the From field (as the author) I think
that Paul's name rather than yours should be in the Co-authored-by tag.
If you agree please consider responding to this email with the correct tag.


Signed-off-by: Roi Dayan 
Acked-by: Joe Stringer 
Acked-by: Flavio Leitner 


...



Hi,

In this case Paul should be the author as he did most of the work in
this new module while I did some updates afterwards.
The author change is maybe because of the work of splitting the commit.
Does this block? should I submit again with fixed author?
or replying with a tag should suffice?

From: Paul Blakey 

Thanks,
Roi
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH V10 02/33] tc: Introduce tc module

2017-06-08 Thread Simon Horman
On Thu, Jun 08, 2017 at 02:46:19PM +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 
> Co-authored-by: Roi Dayan 

Hi Roi,

as your name appears in the From field (as the author) I think
that Paul's name rather than yours should be in the Co-authored-by tag.
If you agree please consider responding to this email with the correct tag.

> Signed-off-by: Roi Dayan 
> Acked-by: Joe Stringer 
> Acked-by: Flavio Leitner 

...
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH V10 02/33] tc: Introduce tc module

2017-06-08 Thread Roi Dayan
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 
Co-authored-by: Roi Dayan 
Signed-off-by: Roi Dayan 
Acked-by: Joe Stringer 
Acked-by: Flavio Leitner 
---
 lib/automake.mk|   4 +-
 lib/netdev-linux.c | 100 +-
 lib/tc.c   | 114 +
 lib/tc.h   |  33 
 4 files changed, 151 insertions(+), 100 deletions(-)
 create mode 100644 lib/tc.c
 create mode 100644 lib/tc.h

diff --git a/lib/automake.mk b/lib/automake.mk
index f5baba2..0ac4708 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -368,7 +368,9 @@ lib_libopenvswitch_la_SOURCES += \
lib/rtnetlink.c \
lib/rtnetlink.h \
lib/route-table.c \
-   lib/route-table.h
+   lib/route-table.h \
+   lib/tc.c \
+   lib/tc.h
 endif
 
 if DPDK_NETDEV
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index d794453..c8145c6 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -29,9 +29,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -70,6 +67,7 @@
 #include "openvswitch/shash.h"
 #include "socket-util.h"
 #include "sset.h"
+#include "tc.h"
 #include "timer.h"
 #include "unaligned.h"
 #include "openvswitch/vlog.h"
@@ -434,22 +432,14 @@ static const struct tc_ops *const tcs[] = {
 NULL
 };
 
-static unsigned int tc_make_handle(unsigned int major, unsigned int minor);
-static unsigned int tc_get_major(unsigned int handle);
-static unsigned int tc_get_minor(unsigned int handle);
-
 static unsigned int tc_ticks_to_bytes(unsigned int rate, unsigned int ticks);
 static unsigned int tc_bytes_to_ticks(unsigned int rate, unsigned int size);
 static unsigned int tc_buffer_per_jiffy(unsigned int rate);
 
-static struct tcmsg *tc_make_request(int ifindex, int type,
- unsigned int flags, struct ofpbuf *);
 static struct tcmsg *netdev_linux_tc_make_request(const struct netdev *,
   int type,
   unsigned int flags,
   struct ofpbuf *);
-static int tc_transact(struct ofpbuf *request, struct ofpbuf **replyp);
-static int tc_add_del_ingress_qdisc(int ifindex, bool add);
 static int tc_add_policer(struct netdev *,
   uint32_t kbits_rate, uint32_t kbits_burst);
 
@@ -4657,44 +4647,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);
-}
-
-static struct tcmsg *
-tc_make_request(int ifindex, int type, unsigned int flags,
-struct ofpbuf *request)
-{
-struct tcmsg *tcmsg;
-
-ofpbuf_init(request, 512);
-nl_msg_put_nlmsghdr(request, sizeof *tcmsg, type, NLM_F_REQUEST | flags);
-tcmsg = ofpbuf_put_zeros(request, sizeof *tcmsg);
-tcmsg->tcm_family = AF_UNSPEC;
-tcmsg->tcm_ifindex = ifindex;
-/* Caller should fill in tcmsg->tcm_handle. */
-/* Caller should fill in tcmsg->tcm_parent. */
-
-return tcmsg;
-}
-
 static struct tcmsg *
 netdev_linux_tc_make_request(const struct netdev *netdev, int type,
  unsigned int flags, struct ofpbuf *request)
@@ -4710,56 +4662,6 @@ netdev_linux_tc_make_request(const struct netdev 
*netdev, int type,
 return tc_make_request(ifindex, type, flags, request);
 }
 
-static int
-tc_transact(struct ofpbuf *request, struct ofpbuf **replyp)
-{
-int error = nl_transact(NETLINK_ROUTE, request, replyp);
-ofpbuf_uninit(request);
-return error;
-}
-
-/* Adds or deletes a root ingress qdisc on 'netdev'.  We use this for
- * policing configuration.
- *
- * This function is equivalent to running the following when 'add' is true:
- * /sbin/tc qdisc add dev  handle : ingress
- *
- * This function is equivalent to running the following when 'add' is false:
- * /sbin/tc qdisc del dev  handle : ingress
- *
- * The configuration and stats may be seen with the following command:
- * /sbin/tc -s qdisc show dev 
- *
- * Returns 0 if successful, otherwise a positive errno value.
- */
-static int
-tc_add_del_ingress_qdisc(int ifindex, bool add)
-{
-struct ofpbuf request;
-struct tcmsg *tcmsg;
-int error;
-int type = add ? RTM_NEWQDISC : RTM_DELQDISC;
-int flags = add ? NLM_F_EXCL | NLM_F_CREATE : 0;
-
-tcmsg = t