Acked-by: Ethan Jackson <et...@nicira.com>
On Wed, Dec 11, 2013 at 9:10 AM, Joe Stringer <joestrin...@nicira.com> wrote:
> When dealing with a large number of ports, bundle_run() and
> bundle_wait() add significant unnecessary processing to the main run
> loop, even when there are no bonds and lacp is not configured. This
> patch skips such execution if it is unneeded, reducing CPU usage from
> about 25% to about 20% in a test environment of 5000 internal ports and
> 50 tunnel ports running bfd.
>
> Signed-off-by: Joe Stringer <joestrin...@nicira.com>
> ---
> v4: Rebase
> ---
>  ofproto/ofproto-dpif.c |   21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index a4334cc..3235891 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -488,6 +488,7 @@ struct ofproto_dpif {
>      struct hmap bundles;        /* Contains "struct ofbundle"s. */
>      struct mac_learning *ml;
>      bool has_bonded_bundles;
> +    bool lacp_enabled;
>      struct mbridge *mbridge;
>
>      /* Facets. */
> @@ -1254,6 +1255,7 @@ construct(struct ofproto *ofproto_)
>      ofproto->ml = mac_learning_create(MAC_ENTRY_DEFAULT_IDLE_TIME);
>      ofproto->mbridge = mbridge_create();
>      ofproto->has_bonded_bundles = false;
> +    ofproto->lacp_enabled = false;
>      ovs_mutex_init(&ofproto->stats_mutex);
>      ovs_mutex_init(&ofproto->vsp_mutex);
>
> @@ -1477,7 +1479,6 @@ static int
>  run(struct ofproto *ofproto_)
>  {
>      struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
> -    struct ofbundle *bundle;
>      uint64_t new_seq;
>      int error;
>
> @@ -1521,8 +1522,12 @@ run(struct ofproto *ofproto_)
>
>          ofproto->change_seq = new_seq;
>      }
> -    HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
> -        bundle_run(bundle);
> +    if (ofproto->lacp_enabled || ofproto->has_bonded_bundles) {
> +        struct ofbundle *bundle;
> +
> +        HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
> +            bundle_run(bundle);
> +        }
>      }
>
>      stp_run(ofproto);
> @@ -1562,7 +1567,6 @@ static void
>  wait(struct ofproto *ofproto_)
>  {
>      struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
> -    struct ofbundle *bundle;
>
>      if (ofproto_get_flow_restore_wait()) {
>          return;
> @@ -1574,8 +1578,12 @@ wait(struct ofproto *ofproto_)
>      if (ofproto->ipfix) {
>          dpif_ipfix_wait(ofproto->ipfix);
>      }
> -    HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
> -        bundle_wait(bundle);
> +    if (ofproto->lacp_enabled || ofproto->has_bonded_bundles) {
> +        struct ofbundle *bundle;
> +
> +        HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
> +            bundle_wait(bundle);
> +        }
>      }
>      if (ofproto->netflow) {
>          netflow_wait(ofproto->netflow);
> @@ -2477,6 +2485,7 @@ bundle_set(struct ofproto *ofproto_, void *aux,
>
>      /* LACP. */
>      if (s->lacp) {
> +        ofproto->lacp_enabled = true;
>          if (!bundle->lacp) {
>              ofproto->backer->need_revalidate = REV_RECONFIGURE;
>              bundle->lacp = lacp_create();
> --
> 1.7.9.5
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to