Message ID | HKXPR03MB07251A062B973A2059A6712C8BA00@HKXPR03MB0725.apcprd03.prod.outlook.com |
---|---|
State | Not Applicable |
Headers | show |
On 19 February 2016 at 02:35, <sourabh.bansal@wipro.com> wrote: > Hi Joe, > > Thanks for pointing out my mistake. Please find below updated one. > > > m 69e63a45e2773c124deb885bbc3d5deb3e032126 Mon Sep 17 00:00:00 2001 > From: soumyadeep chowdhury <soumyadeep.chowdhury@wipro.com> > Date: Fri, 19 Feb 2016 07:39:34 -0500 > Subject: [PATCH 4/4] Write the functions for dump-conntrack and > flush-conntrack > > Signed-off-by: Sourabh Bansal <sourabh.bansal@wipro.com> While the format of the patch looks closer to correct, I think my primary piece of feedback may have been misunderstood. What does this patch provide which isn't already available via the "ovs-appctl dpctl/{dump,flush}-conntrack" commands?
Hi Joe, These commands will work when we are running userspace conntrack (OVS+DPDK env). Existing commands dpctl/{dump-flush}-conntrack commands will not help here, as they are trying to get info of kernel based conntrack module. NOTE: This implementation is over <https://github.com/ddiproietto/ovs/tree/userconntrack_20151115 > branch which is implementing userspaced conntrack module. -----Original Message----- From: Joe Stringer [mailto:joe@ovn.org] Sent: Friday, February 19, 2016 11:48 PM To: Sourabh Bansal (NEP) <sourabh.bansal@wipro.com> Cc: Daniele Di Proietto <diproiettod@vmware.com>; ovs dev <dev@openvswitch.org>; Sanjeev Sharma (Cisco) <sanjeev.sharma15@wipro.com>; Soumyadeep Chowdhury (NEP) <soumyadeep.chowdhury@wipro.com> Subject: Re: [ovs-dev] <conntrack><dpif-netdev>: ovs-appctl dump and flush command for userspace conntrack On 19 February 2016 at 02:35, <sourabh.bansal@wipro.com> wrote: > Hi Joe, > > Thanks for pointing out my mistake. Please find below updated one. > > > m 69e63a45e2773c124deb885bbc3d5deb3e032126 Mon Sep 17 00:00:00 2001 > From: soumyadeep chowdhury <soumyadeep.chowdhury@wipro.com> > Date: Fri, 19 Feb 2016 07:39:34 -0500 > Subject: [PATCH 4/4] Write the functions for dump-conntrack and > flush-conntrack > > Signed-off-by: Sourabh Bansal <sourabh.bansal@wipro.com> While the format of the patch looks closer to correct, I think my primary piece of feedback may have been misunderstood. What does this patch provide which isn't already available via the "ovs-appctl dpctl/{dump,flush}-conntrack" commands? The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
Hi Joe, I rechecked and ovs-appctl dpctl/dump-conntrack command works fine for me. Actually I got confused with ovs-dpctl dump-conntrack command and thought that userspace dump conntrack is not available. Thanks for pointing it out. Withdrawing the patch. -----Original Message----- From: Sourabh Bansal (NEP) Sent: Monday, February 22, 2016 11:14 AM To: 'Joe Stringer' <joe@ovn.org> Cc: Daniele Di Proietto <diproiettod@vmware.com>; ovs dev <dev@openvswitch.org>; Sanjeev Sharma (Cisco) <sanjeev.sharma15@wipro.com>; Soumyadeep Chowdhury (NEP) <soumyadeep.chowdhury@wipro.com> Subject: RE: [ovs-dev] <conntrack><dpif-netdev>: ovs-appctl dump and flush command for userspace conntrack Hi Joe, These commands will work when we are running userspace conntrack (OVS+DPDK env). Existing commands dpctl/{dump-flush}-conntrack commands will not help here, as they are trying to get info of kernel based conntrack module. NOTE: This implementation is over <https://github.com/ddiproietto/ovs/tree/userconntrack_20151115 > branch which is implementing userspaced conntrack module. -----Original Message----- From: Joe Stringer [mailto:joe@ovn.org] Sent: Friday, February 19, 2016 11:48 PM To: Sourabh Bansal (NEP) <sourabh.bansal@wipro.com> Cc: Daniele Di Proietto <diproiettod@vmware.com>; ovs dev <dev@openvswitch.org>; Sanjeev Sharma (Cisco) <sanjeev.sharma15@wipro.com>; Soumyadeep Chowdhury (NEP) <soumyadeep.chowdhury@wipro.com> Subject: Re: [ovs-dev] <conntrack><dpif-netdev>: ovs-appctl dump and flush command for userspace conntrack On 19 February 2016 at 02:35, <sourabh.bansal@wipro.com> wrote: > Hi Joe, > > Thanks for pointing out my mistake. Please find below updated one. > > > m 69e63a45e2773c124deb885bbc3d5deb3e032126 Mon Sep 17 00:00:00 2001 > From: soumyadeep chowdhury <soumyadeep.chowdhury@wipro.com> > Date: Fri, 19 Feb 2016 07:39:34 -0500 > Subject: [PATCH 4/4] Write the functions for dump-conntrack and > flush-conntrack > > Signed-off-by: Sourabh Bansal <sourabh.bansal@wipro.com> While the format of the patch looks closer to correct, I think my primary piece of feedback may have been misunderstood. What does this patch provide which isn't already available via the "ovs-appctl dpctl/{dump,flush}-conntrack" commands? The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
diff --git a/ovs-userconntrack_20151115/lib/dpif-netdev.c b/ovs-userconntrack_20151115/lib/dpif-netdev.c index 340e37c..f950780 100644 --- a/ovs-userconntrack_20151115/lib/dpif-netdev.c +++ b/ovs-userconntrack_20151115/lib/dpif-netdev.c @@ -715,6 +715,84 @@ dpif_netdev_pmd_info(struct unixctl_conn *conn, int argc, const char *argv[], unixctl_command_reply(conn, ds_cstr(&reply)); ds_destroy(&reply); } + +/*This function will dump the entries present in conntrack table*/ +static void +dpif_netdev_dump_conntrack(struct unixctl_conn *conn, int argc, const char *argv[], + void *aux OVS_UNUSED) +{ + struct dp_netdev *dp = NULL; + struct ct_dpif_dump_state *dump; + struct ct_dpif_entry cte; + uint16_t *pzone = NULL; + struct dpif *dpif; + + ovs_mutex_lock(&dp_netdev_mutex); + + if (argc == 2) { + dp = shash_find_data(&dp_netdevs, argv[1]); + } else if (shash_count(&dp_netdevs) == 1) { + /* There's only one datapath */ + dp = shash_first(&dp_netdevs)->data; + } + + if (!dp) { + ovs_mutex_unlock(&dp_netdev_mutex); + unixctl_command_reply_error(conn, + "please specify an existing datapath"); + return; + } + ovs_mutex_unlock(&dp_netdev_mutex); + dpif = dp->dpif; + + int verbosity = 1; + int print_statistics = 0; + + struct ds s = DS_EMPTY_INITIALIZER; + + ct_dpif_dump_start(dpif, &dump, pzone); + while (!ct_dpif_dump_next(dump, &cte)) { + + ct_dpif_format_entry(&cte, &s, verbosity, + print_statistics); + ct_dpif_entry_uninit(&cte); + } + + unixctl_command_reply(conn, ds_cstr(&s)); + ds_destroy(&s); + + ct_dpif_dump_done(dump); + return; +} + +/*This function will flush the entries present in conntrack table*/ +static void +dpif_netdev_flush_conntrack(struct unixctl_conn *conn, int argc, const char *argv[], + void *aux OVS_UNUSED) +{ + struct dp_netdev *dp = NULL; + struct dpif *dpif; + uint16_t *pzone = NULL; + + ovs_mutex_lock(&dp_netdev_mutex); + if (argc == 2) { + dp = shash_find_data(&dp_netdevs, argv[1]); + } else if (shash_count(&dp_netdevs) == 1) { + dp = shash_first(&dp_netdevs)->data; + } + + ovs_mutex_unlock(&dp_netdev_mutex); + + struct ds s = DS_EMPTY_INITIALIZER; + + dpif = dp->dpif; + ct_dpif_flush(dpif,pzone); + + unixctl_command_reply(conn, ds_cstr(&s)); + ds_destroy(&s); + +} + static int