brintos

brintos / linux-shallow public Read only

0
0
Text · 1.5 KiB · 633284e Raw
42 lines · c
1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */2/* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */3 4#ifndef _MLXFW_MFA2_TLV_MULTI_H5#define _MLXFW_MFA2_TLV_MULTI_H6 7#include "mlxfw_mfa2_tlv.h"8#include "mlxfw_mfa2_format.h"9#include "mlxfw_mfa2_file.h"10 11const struct mlxfw_mfa2_tlv *12mlxfw_mfa2_tlv_multi_child(const struct mlxfw_mfa2_file *mfa2_file,13			   const struct mlxfw_mfa2_tlv_multi *multi);14 15const struct mlxfw_mfa2_tlv *16mlxfw_mfa2_tlv_next(const struct mlxfw_mfa2_file *mfa2_file,17		    const struct mlxfw_mfa2_tlv *tlv);18 19const struct mlxfw_mfa2_tlv *20mlxfw_mfa2_tlv_advance(const struct mlxfw_mfa2_file *mfa2_file,21		       const struct mlxfw_mfa2_tlv *from_tlv, u16 count);22 23const struct mlxfw_mfa2_tlv *24mlxfw_mfa2_tlv_multi_child_find(const struct mlxfw_mfa2_file *mfa2_file,25				const struct mlxfw_mfa2_tlv_multi *multi,26				enum mlxfw_mfa2_tlv_type type, u16 index);27 28int mlxfw_mfa2_tlv_multi_child_count(const struct mlxfw_mfa2_file *mfa2_file,29				     const struct mlxfw_mfa2_tlv_multi *multi,30				     enum mlxfw_mfa2_tlv_type type,31				     u16 *p_count);32 33#define mlxfw_mfa2_tlv_foreach(mfa2_file, tlv, idx, from_tlv, count) \34	for (idx = 0, tlv = from_tlv; idx < (count); \35	     idx++, tlv = mlxfw_mfa2_tlv_next(mfa2_file, tlv))36 37#define mlxfw_mfa2_tlv_multi_foreach(mfa2_file, tlv, idx, multi) \38	mlxfw_mfa2_tlv_foreach(mfa2_file, tlv, idx, \39			       mlxfw_mfa2_tlv_multi_child(mfa2_file, multi), \40			       be16_to_cpu(multi->num_extensions) + 1)41#endif42