{
    "content": [
        {
            "type": "text",
            "text": "# tc-gate(8) (man)\n\n**Summary:** gate - Stream Gate Action\n\n## Examples\n\n- `The  following  example  shows tc filter frames source ip match to the 192.168.0.20 will keep`\n- `the gate open for 200ms and limit the traffic to 8MB in this sched-entry. Then keep the traf‐`\n- `fic  gate  to  be close for 100ms.  Frames arrived at gate close state would be dropped. Then`\n- `the cycle would run the gate entries periodically. The schedule will start at instant  200.0s`\n- `using  the  reference  CLOCKTAI. The schedule is composed of two entries each of 300ms dura‐`\n- `tion.`\n- `# tc qdisc add dev eth0 ingress`\n- `# tc filter add dev eth0 parent ffff: protocol ip \\`\n- `flower skiphw srcip 192.168.0.20 \\`\n- `action gate index 2 clockid CLOCKTAI \\`\n- `base-time 200000000000ns \\`\n- `sched-entry open 200000000ns -1 8000000b \\`\n- `sched-entry close 100000000ns`\n- `Following commands is an example to filter a stream source mac match to the 10:00:80:00:00:00`\n- `icmp  frames  will  be  dropped  at any time with cycle 200ms.  With a default basetime 0 and`\n- `clockid is CLOCKTAI as default.`\n- `# tc qdisc add dev eth0 ingress`\n- `# tc filter add dev eth0 parent ffff:  protocol ip \\`\n- `flower ipproto icmp dstmac 10:00:80:00:00:00 \\`\n- `action gate index 12 sched-entry close 200000000ns`\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (1 lines) — 1 subsections\n  - tc  ...  action gate (8 lines)\n- **DESCRIPTION** (9 lines)\n- **PARAMETERS** (37 lines)\n- **EXAMPLES** (27 lines)\n- **AUTHORS** (5 lines)\n\n## Full Content\n\n### NAME\n\ngate - Stream Gate Action\n\n### SYNOPSIS\n\n#### tc  ...  action gate\n\n[ base-time BASETIME ] [ clockid CLOCKID ]\nsched-entry <gate state> <interval 1> [ <internal priority> <max octets> ]\nsched-entry <gate state> <interval 2> [ <internal priority> <max octets> ]\nsched-entry <gate state> <interval 3> [ <internal priority> <max octets> ]\n......\nsched-entry <gate state> <interval N> [ <internal priority> <max octets> ]\n\n### DESCRIPTION\n\nGATE  action  allows  specified  ingress  frames  can  be passed at specific time slot, or be\ndropped at specific time slot. Tc filter filters the ingress  frames,  then  tc  gate  action\nwould  specify  which  time  slot and how many bytes these frames can be passed to device and\nwhich time slot frames would be dropped.  Gate action also assign a base-time  to  tell  when\nthe  entry list start.  Then gate action would start to repeat the gate entry list cyclically\nat the start base-time.  For the software simulation, gate action requires  the  user  assign\nreference time clock type.\n\n### PARAMETERS\n\nbase-time\nSpecifies  the  instant in nanoseconds, defining the time when the schedule starts. If\n'base-time' is a time in the past, the schedule will start at\n\nbase-time + (N * cycle-time)\n\nwhere N is the smallest integer so the resulting time is greater than \"now\", and  \"cy‐\ncle-time\"  is  the  sum  of  all the intervals of the entries in the schedule. Without\nbase-time specified, will default to be 0.\n\n\nclockid\nSpecifies the clock to be used by qdisc's internal timer for measuring time and sched‐\nuling events. Not valid if gate action is used for offloading filter.  For example, tc\nfilter command with skipsw parameter.\n\n\nsched-entry\nThere may multiple sched-entry parameters in a single schedule. Each one has the  for‐\nmat:\n\nsched-entry <gate state> <interval> [ <internal priority> <max octets> ]\n\n<gate state> means gate states. 'open' keep gate open, 'close' keep gate close.\n<interval> means how much nano seconds for this time slot.\n<internal  priority>  means internal priority value. Present of the internal receiving\nqueue for this stream. \"-1\" means wildcard.  <internal priority> and <max octets>  can\nbe omit default to be \"-1\" which both\nvalue to be \"-1\" for this <sched-entry>.\n<max octets> means how many octets size could pass in this time slot. Dropped if over‐\nlimited. \"-1\" means wildcard. <max octets> can be omit default to be \"-1\" which  value\nto be \"-1\" for this <sched-entry>.\nNote  that  <internal priority> and <max octets> are nothing meaning for gate state is\n\"close\" in a \"sched-entry\". All frames are dropped  when  \"sched-entry\"  with  \"close\"\nstate.\n\n### EXAMPLES\n\nThe  following  example  shows tc filter frames source ip match to the 192.168.0.20 will keep\nthe gate open for 200ms and limit the traffic to 8MB in this sched-entry. Then keep the traf‐\nfic  gate  to  be close for 100ms.  Frames arrived at gate close state would be dropped. Then\nthe cycle would run the gate entries periodically. The schedule will start at instant  200.0s\nusing  the  reference  CLOCKTAI. The schedule is composed of two entries each of 300ms dura‐\ntion.\n\n# tc qdisc add dev eth0 ingress\n# tc filter add dev eth0 parent ffff: protocol ip \\\nflower skiphw srcip 192.168.0.20 \\\naction gate index 2 clockid CLOCKTAI \\\nbase-time 200000000000ns \\\nsched-entry open 200000000ns -1 8000000b \\\nsched-entry close 100000000ns\n\n\nFollowing commands is an example to filter a stream source mac match to the 10:00:80:00:00:00\nicmp  frames  will  be  dropped  at any time with cycle 200ms.  With a default basetime 0 and\nclockid is CLOCKTAI as default.\n\n# tc qdisc add dev eth0 ingress\n# tc filter add dev eth0 parent ffff:  protocol ip \\\nflower ipproto icmp dstmac 10:00:80:00:00:00 \\\naction gate index 12 sched-entry close 200000000ns\n\n### AUTHORS\n\nPo Liu <Po.Liu@nxp.com>\n\n\n\niproute2                                     12 Mar 2020                                     GATE(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "tc-gate",
        "section": "8",
        "mode": "man",
        "summary": "gate - Stream Gate Action",
        "synopsis": "",
        "flags": [],
        "examples": [
            "The  following  example  shows tc filter frames source ip match to the 192.168.0.20 will keep",
            "the gate open for 200ms and limit the traffic to 8MB in this sched-entry. Then keep the traf‐",
            "fic  gate  to  be close for 100ms.  Frames arrived at gate close state would be dropped. Then",
            "the cycle would run the gate entries periodically. The schedule will start at instant  200.0s",
            "using  the  reference  CLOCKTAI. The schedule is composed of two entries each of 300ms dura‐",
            "tion.",
            "# tc qdisc add dev eth0 ingress",
            "# tc filter add dev eth0 parent ffff: protocol ip \\",
            "flower skiphw srcip 192.168.0.20 \\",
            "action gate index 2 clockid CLOCKTAI \\",
            "base-time 200000000000ns \\",
            "sched-entry open 200000000ns -1 8000000b \\",
            "sched-entry close 100000000ns",
            "Following commands is an example to filter a stream source mac match to the 10:00:80:00:00:00",
            "icmp  frames  will  be  dropped  at any time with cycle 200ms.  With a default basetime 0 and",
            "clockid is CLOCKTAI as default.",
            "# tc qdisc add dev eth0 ingress",
            "# tc filter add dev eth0 parent ffff:  protocol ip \\",
            "flower ipproto icmp dstmac 10:00:80:00:00:00 \\",
            "action gate index 12 sched-entry close 200000000ns"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "tc  ...  action gate",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 37,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}