add multicast/broadcast limit support via switch config ioctl
authorMugunthan V N <mugunthanvnm@ti.com>
Wed, 10 Dec 2014 10:10:57 +0000 (15:40 +0530)
committerMugunthan V N <mugunthanvnm@ti.com>
Tue, 13 Jan 2015 11:17:39 +0000 (16:47 +0530)
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
switch-config.c

index b2e1d84adea8ecdada5c62e3a182286b577b67a8..882c074e8400506fb8dd30ae1928ca71399d0c2b 100644 (file)
@@ -239,7 +239,7 @@ int cpsw_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
                return -1;                                      \
        }
 
-static char options[] = "?m:x:i:y:S:GUg:udn:V:sk:K:M:N:D:Y:z:Z:J:vPp:r:C";
+static char options[] = "?m:x:i:y:S:GUg:udn:V:sk:K:M:N:D:Y:z:Z:J:vPp:r:ClB:L:t";
 
 static struct option long_options[] =
        {
@@ -270,6 +270,11 @@ static struct option long_options[] =
 {"get-port-vlan",              no_argument             , 0, 'P'},
 {"set-port-vlan",              required_argument       , 0, 'p'},
 {"priority",                   required_argument       , 0, 'r'},
+{"cfi",                                no_argument             , 0, 'C'},
+{"rate-limit",                 no_argument             , 0, 'l'},
+{"bcast-limit",                        required_argument       , 0, 'B'},
+{"mcast-limit",                        required_argument       , 0, 'L'},
+{"direction",                  no_argument             , 0, 't'},
 {0, 0, 0, 0}
 };
 
@@ -521,6 +526,10 @@ void print_help(void)
                "switch-config -P,--get-port-vlan -n,--port <Port No 0-2>\n"
                "switch-config -p,--set-port-vlan <vid> -n,--port <Port No 0-2> "
                        "[-r,--priority <priority 0-7>] [-C,--cfi]\n"
+               "switch-config -l,--rate-limit -n,--port <Port No> "
+                       "-B,--bcast-limit <No of Packet 0-255> "
+                       "-L,--limit <No of Packet 0-255> "
+                       "[-t,--direction specify for Tx] ]\n"
                "switch-config -d,--dump\n"
                "\n"
                );
@@ -640,6 +649,11 @@ int main(int argc, char **argv)
                        cmd_struct.vid = atoi(optarg);
                break;
 
+               case 'l':
+                       SWITCH_CONFIG_COMMAND(cmd_struct.cmd,
+                               CONFIG_SWITCH_RATELIMIT);
+               break;
+
                /* Extended switch commands */
                case 'd':
                        extended_switch_config = EXTENDED_CONFIG_SWITCH_DUMP;
@@ -706,6 +720,18 @@ int main(int argc, char **argv)
                        cmd_struct.vlan_cfi = true;
                break;
 
+               case 'B':
+                       cmd_struct.bcast_rate_limit = atoi(optarg);
+               break;
+
+               case 'L':
+                       cmd_struct.mcast_rate_limit = atoi(optarg);
+               break;
+
+               case 't':
+                       cmd_struct.direction = true;
+               break;
+
                default:
                        print_help();
                        return 0;