11558Srgrimes/* SPDX-License-Identifier: BSD-3-Clause */
21558Srgrimes/*  Copyright (c) 2024, Intel Corporation
31558Srgrimes *  All rights reserved.
41558Srgrimes *
51558Srgrimes *  Redistribution and use in source and binary forms, with or without
61558Srgrimes *  modification, are permitted provided that the following conditions are met:
71558Srgrimes *
81558Srgrimes *   1. Redistributions of source code must retain the above copyright notice,
91558Srgrimes *      this list of conditions and the following disclaimer.
101558Srgrimes *
111558Srgrimes *   2. Redistributions in binary form must reproduce the above copyright
121558Srgrimes *      notice, this list of conditions and the following disclaimer in the
131558Srgrimes *      documentation and/or other materials provided with the distribution.
141558Srgrimes *
151558Srgrimes *   3. Neither the name of the Intel Corporation nor the names of its
161558Srgrimes *      contributors may be used to endorse or promote products derived from
171558Srgrimes *      this software without specific prior written permission.
181558Srgrimes *
191558Srgrimes *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
201558Srgrimes *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
211558Srgrimes *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
221558Srgrimes *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
231558Srgrimes *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241558Srgrimes *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251558Srgrimes *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261558Srgrimes *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271558Srgrimes *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281558Srgrimes *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291558Srgrimes *  POSSIBILITY OF SUCH DAMAGE.
301558Srgrimes */
3137906Scharnier
3223685Speter#ifndef _ICE_DEFS_H_
3337906Scharnier#define _ICE_DEFS_H_
3437906Scharnier
3550476Speter#define ETH_ALEN	6
361558Srgrimes
371558Srgrimes#define ETH_HEADER_LEN	14
381558Srgrimes
391558Srgrimes#define BIT(a) (1UL << (a))
401558Srgrimes#ifndef BIT_ULL
411558Srgrimes#define BIT_ULL(a) (1ULL << (a))
421558Srgrimes#endif /* !BIT_ULL */
431558Srgrimes
441558Srgrimes#define BITS_PER_BYTE	8
45103949Smike
461558Srgrimes#define _FORCE_
4778732Sdd
481558Srgrimes#define ICE_BYTES_PER_WORD	2
491558Srgrimes#define ICE_BYTES_PER_DWORD	4
501558Srgrimes#define ICE_MAX_TRAFFIC_CLASS	8
511558Srgrimes
521558Srgrimes#ifndef MIN_T
531558Srgrimes#define MIN_T(_t, _a, _b)	min((_t)(_a), (_t)(_b))
541558Srgrimes#endif /* !MIN_T */
551558Srgrimes
561558Srgrimes#define IS_ASCII(_ch)	((_ch) < 0x80)
571558Srgrimes
5892837Simp#define STRUCT_HACK_VAR_LEN
591558Srgrimes/**
6092806Sobrien * ice_struct_size - size of struct with C99 flexible array member
611558Srgrimes * @ptr: pointer to structure
621558Srgrimes * @field: flexible array member (last member of the structure)
631558Srgrimes * @num: number of elements of that flexible array member
6423685Speter */
651558Srgrimes#define ice_struct_size(ptr, field, num) \
661558Srgrimes	(sizeof(*(ptr)) + sizeof(*(ptr)->field) * (num))
671558Srgrimes
681558Srgrimes#define FLEX_ARRAY_SIZE(_ptr, _mem, cnt) ((cnt) * sizeof(_ptr->_mem[0]))
691558Srgrimes
701558Srgrimes#endif /* _ICE_DEFS_H_ */
711558Srgrimes