~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/tc-testing/tdc_multibatch.py

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/usr/bin/env python3
  2 # SPDX-License-Identifier: GPL-2.0
  3 """
  4 tdc_multibatch.py - a thin wrapper over tdc_batch.py to generate multiple batch
  5 files
  6 
  7 Copyright (C) 2019 Vlad Buslov <vladbu@mellanox.com>
  8 """
  9 
 10 import argparse
 11 import os
 12 
 13 parser = argparse.ArgumentParser(
 14     description='TC multiple batch file generator')
 15 parser.add_argument("device", help="device name")
 16 parser.add_argument("dir", help="where to put batch files")
 17 parser.add_argument(
 18     "num_filters", type=int, help="how many lines per batch file")
 19 parser.add_argument("num_files", type=int, help="how many batch files")
 20 parser.add_argument(
 21     "operation",
 22     choices=['add', 'del', 'replace'],
 23     help="operation to perform on filters")
 24 parser.add_argument(
 25     "-x",
 26     "--file_prefix",
 27     default="",
 28     help="prefix for generated batch file names")
 29 parser.add_argument(
 30     "-d",
 31     "--duplicate_handles",
 32     action="store_true",
 33     help="duplicate filter handle range in all files")
 34 parser.add_argument(
 35     "-a",
 36     "--handle_start",
 37     type=int,
 38     default=1,
 39     help="start handle range from (default: 1)")
 40 parser.add_argument(
 41     "-m",
 42     "--mac_prefix",
 43     type=int,
 44     default=0,
 45     choices=range(0, 256),
 46     help="add this value to third byte of source MAC address of flower filter"
 47     "(default: 0)")
 48 args = parser.parse_args()
 49 
 50 device = args.device
 51 dir = args.dir
 52 file_prefix = args.file_prefix + args.operation + "_"
 53 num_filters = args.num_filters
 54 num_files = args.num_files
 55 operation = args.operation
 56 duplicate_handles = args.duplicate_handles
 57 handle = args.handle_start
 58 mac_prefix = args.mac_prefix
 59 
 60 for i in range(num_files):
 61     file = dir + '/' + file_prefix + str(i)
 62     os.system("./tdc_batch.py -n {} -a {} -e {} -m {} {} {}".format(
 63         num_filters, handle, operation, i + mac_prefix, device, file))
 64     if not duplicate_handles:
 65         handle += num_filters

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php