ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 08 98 00 00 0a 10 08 06 00 00 00 f4 92 08 | .PNG........IHDR................ |
0020 | 9f 00 00 01 7c 69 43 43 50 49 43 43 20 50 72 6f 66 69 6c 65 00 00 28 91 63 60 60 2a 49 2c 28 c8 | ....|iCCPICC.Profile..(.c``*I,(. |
0040 | 61 61 60 60 c8 cd 2b 29 0a 72 77 52 88 88 8c 52 60 bf c3 c0 cd c0 c3 20 c4 60 c5 20 9e 98 5c 5c | aa``..+).rwR...R`........`....\\ |
0060 | e0 18 10 e0 c3 80 13 7c bb c6 c0 08 a2 2f eb 82 cc 4a f3 fc 79 d3 a6 b5 7c fe 16 36 af 99 72 56 | .......|...../...J..y...|..6..rV |
0080 | 25 3a b8 f5 81 01 77 4a 6a 71 32 03 03 23 07 90 9d 9c 52 9c 9c 0b 64 e7 00 d9 3a c9 05 45 25 40 | %:....wJjq2..#....R...d...:..E%@ |
00a0 | f6 0c 20 5b b7 bc a4 00 c4 3e 01 64 8b 14 01 1d 08 64 df 01 b1 d3 21 ec 0f 20 76 12 98 cd c4 02 | ...[.....>.d.....d....!...v..... |
00c0 | 56 13 12 e4 0c 64 4b 00 d9 02 49 10 b6 06 88 9d 0e 61 5b 80 d8 c9 19 89 29 40 b6 07 c8 2e 88 1b | V....dK...I......a[.....)@...... |
00e0 | c0 80 d3 c3 45 c1 dc c0 52 d7 91 80 bb 49 06 b9 39 a5 30 3b 40 a1 c5 93 9a 17 1a 0c 72 07 10 cb | ....E...R....I..9.0;@.......r... |
0100 | 30 78 30 b8 30 28 30 98 33 18 30 58 32 e8 32 38 96 a4 56 94 80 14 3a e7 17 54 16 65 a6 67 94 28 | 0x0.0(0.3.0X2.28..V...:..T.e.g.( |
0120 | 38 02 43 36 55 c1 39 3f b7 a0 b4 24 b5 48 47 c1 33 2f 59 4f 47 c1 c8 c0 d0 00 a4 0e 14 67 10 a3 | 8.C6U.9?...$.HG.3/YOG........g.. |
0140 | 3f 07 81 4d 67 14 3b 8f 10 cb 5f c8 c0 60 a9 cc c0 c0 dc 83 10 4b 9a c6 c0 b0 7d 0f 03 83 c4 29 | ?..Mg.;..._..`.......K....}....) |
0160 | 84 98 ca 3c 06 06 7e 6b 06 86 6d e7 0a 12 8b 12 e1 0e 67 fc c6 42 88 5f 9c 66 6c 04 61 f3 38 31 | ...<..~k..m.......g..B._.fl.a.81 |
0180 | 30 b0 de fb ff ff b3 1a 03 03 fb 24 06 86 bf 13 ff ff ff bd e8 ff ff bf 8b 81 f6 03 e3 ec 40 0e | 0..........$..................@. |
01a0 | 00 24 77 69/*
* Copyright (c) 2015 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.
*/
#ifndef __POLICE_INLINES_H__
#define __POLICE_INLINES_H__
#include <vnet/policer/police.h>
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#define IP4_NON_DSCP_BITS 0x03
#define IP4_DSCP_SHIFT 2
#define IP6_NON_DSCP_BITS 0xf03fffff
#define IP6_DSCP_SHIFT 22
static_always_inline void
vnet_policer_mark (vlib_buffer_t * b, u8 dscp)
{
ethernet_header_t *eh;
ip4_header_t *ip4h;
ip6_header_t *ip6h;
u16 type;
eh = (ethernet_header_t *) b->data;
type = clib_net_to_host_u16 (eh->type);
if (PREDICT_TRUE (type == ETHERNET_TYPE_IP4))
{
ip4h = (ip4_header_t *) & (b->data[sizeof (ethernet_header_t)]);;
ip4h->tos &= IP4_NON_DSCP_BITS;
ip4h->tos |= dscp << IP4_DSCP_SHIFT;
ip4h->checksum = ip4_header_checksum (ip4h);
}
else
{
if (PREDICT_TRUE (type == ETHERNET_TYPE_IP6))
{
ip6h = (ip6_header_t *) & (b->data[sizeof (ethernet_header_t)]);
ip6h->ip_version_traffic_class_and_flow_label &=
clib_host_to_net_u32 (IP6_NON_DSCP_BITS);
ip6h->ip_version_traffic_class_and_flow_label |=
clib_host_to_net_u32 (dscp << IP6_DSCP_SHIFT);
}
}
}
static_always_inline u8
vnet_policer_police (vlib_main_t * vm,
vlib_buffer_t * b,
u32 policer_index,
u64 time_in_policer_periods,
policer_result_e packet_color)
{
u8 act;
u32 len;
u32 col;
policer_read_response_type_st *pol;
vnet_policer_main_t *pm = &vnet_policer_main;
len = vlib_buffer_length_in_chain (vm, b);
pol = &pm->policers[policer_index];
col = vnet_police_packet (pol, len, packet_color, time_in_policer_periods);
act = pol->action[col];
if (PREDICT_TRUE (act == SSE2_QOS_ACTION_MARK_AND_TRANSMIT))
vnet_policer_mark (b, pol->mark_dscp[col]);
return act;
}
#endif // __POLICE_INLINES_H__
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|