Re: [ovs-dev] [PATCH v3] dpctl: Add new 'ct-bkts' command.
Thanks Darrell, I agree with all your suggestions. I'll rework and post a new version. -Antonio > -Original Message- > From: Darrell Ball [mailto:db...@vmware.com] > Sent: Friday, July 21, 2017 8:12 AM > To: Fischetti, Antonio <antonio.fische...@intel.com>; d...@openvswitch.org > Subject: Re: [ovs-dev] [PATCH v3] dpctl: Add new 'ct-bkts' command. > > I did some testing; display looks nice to me > > Other comments inline > > > 2017-07-21T06:38:33.215Z|00053|unixctl|DBG|received request dpctl/ct- > bkts["netdev@ovs-netdev","gt=0"], id=0 > > 2017-07-21T06:38:33.215Z|00054|dpctl|INFO|set_names=0 verbosity=0 > names=0 > > 2017-07-21T06:38:33.215Z|00055|dpctl|WARN|DARRELL gt 0 > > 2017-07-21T06:38:33.215Z|00056|dpctl|WARN|DARRELL name netdev@ovs-netdev > > 2017-07-21T06:38:33.215Z|00057|unixctl|DBG|replying with success, id=0: > "Total Buckets: 256 > > Current Connections: 1 > > > > +---+-+ > > | Buckets | Connections per Buckets | > > +---+-+ > >0.. 7 | ........ > >8.. 15 | ........ > > 16.. 23 | ........ > > 24.. 31 | ........ > > 32.. 39 | ........ > > 40.. 47 | ........ > > 48.. 55 | ........ > > 56.. 63 | ........ > > 64.. 71 | ........ > > 72.. 79 | ........ > > 80.. 87 | ........ > > 88.. 95 | ........ > > 96..103 | ........ > > 104..111 | ........ > > 112..119 | ........ > > 120..127 | ........ > > 128..135 | ........ > > 136..143 | ........ > > 144..151 | ........ > > 152..159 | ........ > > 160..167 | ........ > > 168..175 | 1....... > > 176..183 | ........ > > 184..191 | ........ > > 192..199 | ........ > > 200..207 | ........ > > 208..215 | ........ > > 216..223 | ........ > > 224..231 | ........ > > 232..239 | ........ > > 240..247 | ........ > > 248..255 | . . . .. ... > > -Original Message- > From: <ovs-dev-boun...@openvswitch.org> on behalf of > "antonio.fische...@intel.com" <antonio.fische...@intel.com> > Date: Tuesday, July 18, 2017 at 6:03 AM > To: "d...@openvswitch.org" <d...@openvswitch.org> > Subject: [ovs-dev] [PATCH v3] dpctl: Add new 'ct-bkts' command. > > From: Antonio Fischetti <antonio.fische...@intel.com> > > With the command: > ovs-appctl dpctl/ct-bkts > shows the number of connections per bucket. > > By using a threshold: > ovs-appctl dpctl/ct-bkts gt=N > for each bucket shows the number of connections when they > are greater than N. > > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com> > Signed-off-by: Bhanuprakash Bodireddy > <bhanuprakash.bodire...@intel.com> > Co-authored-by: Bhanuprakash Bodireddy > <bhanuprakash.bodire...@intel.com> > --- > lib/conntrack.c| 10 ++-- > lib/conntrack.h| 2 +- > lib/ct-dpif.c | 4 +- > lib/ct-dpif.h | 3 +- > lib/dpctl.c| 103 > - > lib/dpctl.man | 8 > lib/dpif-netdev.c | 4 +- > lib/dpif-netlink.c | 4 +- > lib/dpif-provider.h| 2 +- > lib/netlink-conntrack.c| 3 +- > lib/netlink-conntrack.h| 3 +- > tests/test-netlink-conntrack.c | 2 +- >
Re: [ovs-dev] [PATCH v3] dpctl: Add new 'ct-bkts' command.
I did some testing; display looks nice to me Other comments inline > 2017-07-21T06:38:33.215Z|00053|unixctl|DBG|received request > dpctl/ct-bkts["netdev@ovs-netdev","gt=0"], id=0 > 2017-07-21T06:38:33.215Z|00054|dpctl|INFO|set_names=0 verbosity=0 names=0 > 2017-07-21T06:38:33.215Z|00055|dpctl|WARN|DARRELL gt 0 > 2017-07-21T06:38:33.215Z|00056|dpctl|WARN|DARRELL name netdev@ovs-netdev > 2017-07-21T06:38:33.215Z|00057|unixctl|DBG|replying with success, id=0: > "Total Buckets: 256 > Current Connections: 1 > > +---+-+ > | Buckets | Connections per Buckets | > +---+-+ >0.. 7 | ........ >8.. 15 | ........ > 16.. 23 | ........ > 24.. 31 | ........ > 32.. 39 | ........ > 40.. 47 | ........ > 48.. 55 | ........ > 56.. 63 | ........ > 64.. 71 | ........ > 72.. 79 | ........ > 80.. 87 | ........ > 88.. 95 | ........ > 96..103 | ........ > 104..111 | ........ > 112..119 | ........ > 120..127 | ........ > 128..135 | ........ > 136..143 | ........ > 144..151 | ........ > 152..159 | ........ > 160..167 | ........ > 168..175 | 1....... > 176..183 | ........ > 184..191 | ........ > 192..199 | ........ > 200..207 | ........ > 208..215 | ........ > 216..223 | ........ > 224..231 | ........ > 232..239 | ........ > 240..247 | ........ > 248..255 | ........ -Original Message- From: <ovs-dev-boun...@openvswitch.org> on behalf of "antonio.fische...@intel.com" <antonio.fische...@intel.com> Date: Tuesday, July 18, 2017 at 6:03 AM To: "d...@openvswitch.org" <d...@openvswitch.org> Subject: [ovs-dev] [PATCH v3] dpctl: Add new 'ct-bkts' command. From: Antonio Fischetti <antonio.fische...@intel.com> With the command: ovs-appctl dpctl/ct-bkts shows the number of connections per bucket. By using a threshold: ovs-appctl dpctl/ct-bkts gt=N for each bucket shows the number of connections when they are greater than N. Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> Co-authored-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> --- lib/conntrack.c| 10 ++-- lib/conntrack.h| 2 +- lib/ct-dpif.c | 4 +- lib/ct-dpif.h | 3 +- lib/dpctl.c| 103 - lib/dpctl.man | 8 lib/dpif-netdev.c | 4 +- lib/dpif-netlink.c | 4 +- lib/dpif-provider.h| 2 +- lib/netlink-conntrack.c| 3 +- lib/netlink-conntrack.h| 3 +- tests/test-netlink-conntrack.c | 2 +- utilities/ovs-dpctl.c | 1 + 13 files changed, 132 insertions(+), 17 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index de46a6b..77ce4cc 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -1931,7 +1931,7 @@ conn_key_to_tuple(const struct conn_key *key, struct ct_dpif_tuple *tuple) static void conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry, - long long now) + long long now, int bkt) { struct ct_l4_proto *class; long long expiration; @@ -1954,11 +1954,12 @@ conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry, if (class->conn_get_protoinfo) { class->conn_get_protoinfo(conn, >protoinfo)
[ovs-dev] [PATCH v3] dpctl: Add new 'ct-bkts' command.
From: Antonio FischettiWith the command: ovs-appctl dpctl/ct-bkts shows the number of connections per bucket. By using a threshold: ovs-appctl dpctl/ct-bkts gt=N for each bucket shows the number of connections when they are greater than N. Signed-off-by: Antonio Fischetti Signed-off-by: Bhanuprakash Bodireddy Co-authored-by: Bhanuprakash Bodireddy --- lib/conntrack.c| 10 ++-- lib/conntrack.h| 2 +- lib/ct-dpif.c | 4 +- lib/ct-dpif.h | 3 +- lib/dpctl.c| 103 - lib/dpctl.man | 8 lib/dpif-netdev.c | 4 +- lib/dpif-netlink.c | 4 +- lib/dpif-provider.h| 2 +- lib/netlink-conntrack.c| 3 +- lib/netlink-conntrack.h| 3 +- tests/test-netlink-conntrack.c | 2 +- utilities/ovs-dpctl.c | 1 + 13 files changed, 132 insertions(+), 17 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index de46a6b..77ce4cc 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -1931,7 +1931,7 @@ conn_key_to_tuple(const struct conn_key *key, struct ct_dpif_tuple *tuple) static void conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry, - long long now) + long long now, int bkt) { struct ct_l4_proto *class; long long expiration; @@ -1954,11 +1954,12 @@ conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry, if (class->conn_get_protoinfo) { class->conn_get_protoinfo(conn, >protoinfo); } +entry->bkt = bkt; } int conntrack_dump_start(struct conntrack *ct, struct conntrack_dump *dump, - const uint16_t *pzone) + const uint16_t *pzone, uint32_t *ptot_bkts) { memset(dump, 0, sizeof(*dump)); if (pzone) { @@ -1966,6 +1967,9 @@ conntrack_dump_start(struct conntrack *ct, struct conntrack_dump *dump, dump->filter_zone = true; } dump->ct = ct; +if (ptot_bkts) { +*ptot_bkts = CONNTRACK_BUCKETS; +} return 0; } @@ -1991,7 +1995,7 @@ conntrack_dump_next(struct conntrack_dump *dump, struct ct_dpif_entry *entry) INIT_CONTAINER(conn, node, node); if ((!dump->filter_zone || conn->key.zone == dump->zone) && (conn->conn_type != CT_CONN_TYPE_UN_NAT)) { -conn_to_ct_dpif_entry(conn, entry, now); +conn_to_ct_dpif_entry(conn, entry, now, dump->bucket); break; } /* Else continue, until we find an entry in the appropriate zone diff --git a/lib/conntrack.h b/lib/conntrack.h index defde4c..bec37e6 100644 --- a/lib/conntrack.h +++ b/lib/conntrack.h @@ -108,7 +108,7 @@ struct conntrack_dump { struct ct_dpif_entry; int conntrack_dump_start(struct conntrack *, struct conntrack_dump *, - const uint16_t *pzone); + const uint16_t *pzone, uint32_t *); int conntrack_dump_next(struct conntrack_dump *, struct ct_dpif_entry *); int conntrack_dump_done(struct conntrack_dump *); diff --git a/lib/ct-dpif.c b/lib/ct-dpif.c index f8d2cf1..e3a7121 100644 --- a/lib/ct-dpif.c +++ b/lib/ct-dpif.c @@ -65,12 +65,12 @@ static const struct flags ct_dpif_status_flags[] = { * that represents the error. Otherwise it returns zero. */ int ct_dpif_dump_start(struct dpif *dpif, struct ct_dpif_dump_state **dump, - const uint16_t *zone) + const uint16_t *zone, uint32_t *ptot_bkts) { int err; err = (dpif->dpif_class->ct_dump_start - ? dpif->dpif_class->ct_dump_start(dpif, dump, zone) + ? dpif->dpif_class->ct_dump_start(dpif, dump, zone, ptot_bkts) : EOPNOTSUPP); if (!err) { diff --git a/lib/ct-dpif.h b/lib/ct-dpif.h index cd35f3e..dd2b174 100644 --- a/lib/ct-dpif.h +++ b/lib/ct-dpif.h @@ -169,6 +169,7 @@ struct ct_dpif_entry { /* Timeout for this entry in seconds */ uint32_t timeout; uint32_t mark; +uint32_t bkt; /* CT bucket number. */ }; enum { @@ -191,7 +192,7 @@ struct ct_dpif_dump_state { }; int ct_dpif_dump_start(struct dpif *, struct ct_dpif_dump_state **, - const uint16_t *zone); + const uint16_t *zone, uint32_t *); int ct_dpif_dump_next(struct ct_dpif_dump_state *, struct ct_dpif_entry *); int ct_dpif_dump_done(struct ct_dpif_dump_state *); int ct_dpif_flush(struct dpif *, const uint16_t *zone); diff --git a/lib/dpctl.c b/lib/dpctl.c index 6aa6c8e..fe8737a 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -1277,7 +1277,7 @@ dpctl_dump_conntrack(int argc, const char *argv[], return error; } -error = ct_dpif_dump_start(dpif, , pzone); +