aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_bond.py
AgeCommit message (Expand)AuthorFilesLines
2020-02-05stats: fix state counter removalVladimir Isaev1-40/+41
2019-12-17ip: Protocol Independent IP NeighborsNeale Ranns1-3/+3
2019-11-15tests: Remove the unrequired VPP IP address/prefix class wrappersNeale Ranns1-2/+1
2019-11-05misc: Fix python scripts shebang lineRenato Botelho do Couto1-1/+1
2019-10-21bonding: tests support python3Ole Troan1-2/+2
2019-09-06bonding: add weight support for active-backup modeSteven Luong1-6/+3
2019-08-20api: Cleanup APIs interface.apiJakub Grajciar1-4/+4
2019-07-19bonding: add support for numa-only in lacp modeZhiyong Yang1-0/+1
2019-04-11Tests: Refactor tearDown show command logging, add lifecycle markers.Paul Vinciguerra1-2/+3
2019-04-10Tests Cleanup: Fix missing calls to setUpClass/tearDownClass.Paul Vinciguerra1-0/+4
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan1-4/+4
2019-03-15API: Cleanup APIs interface.apiJakub Grajciar1-4/+4
2019-03-11Tests: use self.assertNotIn().Paul Vinciguerra1-5/+5
2019-03-06test framework: vpp_papi_provider.py - further cleanupOle Troan1-3/+3
2018-12-18PAPI: Add MACAddress object wrapper for vl_api_mac_address_tOle Troan1-2/+2
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-1/+1
2018-05-25bond: performance harvestingSteven1-11/+3
2018-03-21bond: Add bonding driver and LACP protocolSteven1-0/+282
le.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
  Copyright (c) 2011 Cisco and/or its affiliates.

  * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

#include <vppinfra/mem.h>
#include <vppinfra/pool.h>

#ifdef __KERNEL__
#include <linux/unistd.h>
#else
#include <unistd.h>
#endif

int
main (int argc, char *argv[])
{
  int i;
  uword next;
  u32 last_len = 0;
  u32 *tp = 0;
  u32 *junk;

  clib_mem_init (0, 64ULL << 20);

  for (i = 0; i < 70; i++)
    {
      pool_get (tp, junk);
      if (vec_len (tp) > last_len)
	{
	  last_len = vec_len (tp);
	  fformat (stdout, "vec_len (tp) now %d\n", last_len);
	}
    }

  (void) junk;			/* compiler warning */

  pool_put_index (tp, 1);
  pool_put_index (tp, 65);

  for (i = 0; i < 70; i++)
    {
      int is_free;

      is_free = pool_is_free_index (tp, i);

      if (is_free == 0)
	{
	  if (i == 1 || i == 65)
	    clib_warning ("oops, free index %d reported busy", i);
	}
      else
	{
	  if (i != 1 && i != 65)
	    clib_warning ("oops, busy index %d reported free", i);
	}
    }

  fformat (stdout, "vec_len (tp) is %d\n", vec_len (tp));

  next = ~0;
  do
    {
      next = pool_next_index (tp, next);
      fformat (stdout, "next index %d\n", next);
    }
  while (next != ~0);

  /* *INDENT-OFF* */
  pool_foreach (junk, tp,
  ({
    int is_free;

    is_free = pool_is_free_index (tp, junk - tp);
      if (is_free == 0)
        {
          if (i == 1 || i == 65)
            clib_warning ("oops, free index %d reported busy", i);
        }
      else
        {
          if (i != 1 && i != 65)
            clib_warning ("oops, busy index %d reported free", i);
        }
  }));
  /* *INDENT-ON* */

  return 0;
}

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */