2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
21 #define DRAIN_TIMEOUT __UINT64_C(6000000) // drain TX buffer every 2ms
22 #define TERM_TIMEOUT __UINT64_C(3000000000) // check if terminated every 1s
24 /* DRAIN_TIMEOUT should be smaller than TERM_TIMEOUT as TERM_TIMEOUT
25 is only checked after DRAIN_TIMEOUT */
26 #if TERM_TIMEOUT < DRAIN_TIMEOUT
27 #error TERM_TIMEOUT < DRAIN_TIMEOUT
31 #define IPv4_BYTES_FMT "%d.%d.%d.%d"
32 #define IPv4_BYTES(addr) \
33 addr[0], addr[1], addr[2], addr[3]
37 #define IPv6_BYTES_FMT "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x"
38 #define IPv6_BYTES(addr) \
39 addr[0], addr[1], addr[2], addr[3], \
40 addr[4], addr[5], addr[6], addr[7], \
41 addr[8], addr[9], addr[10], addr[11], \
42 addr[12], addr[13], addr[14], addr[15]
46 #define MAC_BYTES_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
48 #define MAC_BYTES(addr) \
54 /* assume cpu byte order is little endian */
55 #define PKT_TO_LUTQINQ(svlan, cvlan) ((((uint32_t)svlan) & 0x000F) << 4 | (((uint32_t)svlan) & 0xFF00) << 8 | (((uint32_t)cvlan) & 0xFF0F))
59 #endif /* _DEFINES_H_ */