Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
0002 /* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */
0003 
0004 #ifndef _MLXFW_MFA2_TLV_MULTI_H
0005 #define _MLXFW_MFA2_TLV_MULTI_H
0006 
0007 #include "mlxfw_mfa2_tlv.h"
0008 #include "mlxfw_mfa2_format.h"
0009 #include "mlxfw_mfa2_file.h"
0010 
0011 const struct mlxfw_mfa2_tlv *
0012 mlxfw_mfa2_tlv_multi_child(const struct mlxfw_mfa2_file *mfa2_file,
0013                const struct mlxfw_mfa2_tlv_multi *multi);
0014 
0015 const struct mlxfw_mfa2_tlv *
0016 mlxfw_mfa2_tlv_next(const struct mlxfw_mfa2_file *mfa2_file,
0017             const struct mlxfw_mfa2_tlv *tlv);
0018 
0019 const struct mlxfw_mfa2_tlv *
0020 mlxfw_mfa2_tlv_advance(const struct mlxfw_mfa2_file *mfa2_file,
0021                const struct mlxfw_mfa2_tlv *from_tlv, u16 count);
0022 
0023 const struct mlxfw_mfa2_tlv *
0024 mlxfw_mfa2_tlv_multi_child_find(const struct mlxfw_mfa2_file *mfa2_file,
0025                 const struct mlxfw_mfa2_tlv_multi *multi,
0026                 enum mlxfw_mfa2_tlv_type type, u16 index);
0027 
0028 int mlxfw_mfa2_tlv_multi_child_count(const struct mlxfw_mfa2_file *mfa2_file,
0029                      const struct mlxfw_mfa2_tlv_multi *multi,
0030                      enum mlxfw_mfa2_tlv_type type,
0031                      u16 *p_count);
0032 
0033 #define mlxfw_mfa2_tlv_foreach(mfa2_file, tlv, idx, from_tlv, count) \
0034     for (idx = 0, tlv = from_tlv; idx < (count); \
0035          idx++, tlv = mlxfw_mfa2_tlv_next(mfa2_file, tlv))
0036 
0037 #define mlxfw_mfa2_tlv_multi_foreach(mfa2_file, tlv, idx, multi) \
0038     mlxfw_mfa2_tlv_foreach(mfa2_file, tlv, idx, \
0039                    mlxfw_mfa2_tlv_multi_child(mfa2_file, multi), \
0040                    be16_to_cpu(multi->num_extensions) + 1)
0041 #endif