Go to the source code of this file.
Defines | |
| #define | MLX_DECLARE_STRUCT(_structure) |
| Wrapper structure for pseudo_bit_t structures. | |
| #define | MLX_PSEUDO_STRUCT(_ptr) typeof ( *((_ptr)->u.dummy[0]) ) |
| Get pseudo_bit_t structure type from wrapper structure pointer. | |
| #define | MLX_BIT_OFFSET(_structure_st, _field) offsetof ( _structure_st, _field ) |
| Bit offset of a field within a pseudo_bit_t structure. | |
| #define | MLX_DWORD_OFFSET(_structure_st, _field) ( MLX_BIT_OFFSET ( _structure_st, _field ) / 32 ) |
| Dword offset of a field within a pseudo_bit_t structure. | |
| #define | MLX_DWORD_BIT_OFFSET(_structure_st, _index, _field) ( MLX_BIT_OFFSET ( _structure_st, _field ) - ( 32 * (_index) ) ) |
| Dword bit offset of a field within a pseudo_bit_t structure. | |
| #define | MLX_BIT_WIDTH(_structure_st, _field) sizeof ( ( ( _structure_st * ) NULL )->_field ) |
| Bit width of a field within a pseudo_bit_t structure. | |
| #define | MLX_BIT_MASK(_structure_st, _field) |
| Bit mask for a field within a pseudo_bit_t structure. | |
| #define | MLX_ASSEMBLE_1(_structure_st, _index, _field, _value) ( (_value) << MLX_DWORD_BIT_OFFSET ( _structure_st, _index, _field ) ) |
| #define | MLX_ASSEMBLE_2(_structure_st, _index, _field, _value,...) |
| #define | MLX_ASSEMBLE_3(_structure_st, _index, _field, _value,...) |
| #define | MLX_ASSEMBLE_4(_structure_st, _index, _field, _value,...) |
| #define | MLX_ASSEMBLE_5(_structure_st, _index, _field, _value,...) |
| #define | MLX_ASSEMBLE_6(_structure_st, _index, _field, _value,...) |
| #define | MLX_ASSEMBLE_7(_structure_st, _index, _field, _value,...) |
| #define | MLX_MASK_1(_structure_st, _index, _field) |
| #define | MLX_MASK_2(_structure_st, _index, _field,...) |
| #define | MLX_MASK_3(_structure_st, _index, _field,...) |
| #define | MLX_MASK_4(_structure_st, _index, _field,...) |
| #define | MLX_MASK_5(_structure_st, _index, _field,...) |
| #define | MLX_MASK_6(_structure_st, _index, _field,...) |
| #define | MLX_MASK_7(_structure_st, _index, _field,...) |
| #define | MLX_FILL(_ptr, _index, _assembled) |
| #define | MLX_FILL_1(_ptr, _index,...) |
| #define | MLX_FILL_2(_ptr, _index,...) |
| #define | MLX_FILL_3(_ptr, _index,...) |
| #define | MLX_FILL_4(_ptr, _index,...) |
| #define | MLX_FILL_5(_ptr, _index,...) |
| #define | MLX_FILL_6(_ptr, _index,...) |
| #define | MLX_FILL_7(_ptr, _index,...) |
| #define | MLX_SET(_ptr, _field, _value) |
| #define | MLX_GET(_ptr, _field) |
Typedefs | |
| typedef unsigned char | pseudo_bit_t |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
Definition in file mlx_bitops.h.
| #define MLX_DECLARE_STRUCT | ( | _structure | ) |
Value:
_structure { \
union { \
uint8_t bytes[ sizeof ( struct _structure ## _st ) / 8 ]; \
uint32_t dwords[ sizeof ( struct _structure ## _st ) / 32 ]; \
struct _structure ## _st *dummy[0]; \
} u; \
}
This structure provides a wrapper around the autogenerated pseudo_bit_t structures. It has the correct size, and also encapsulates type information about the underlying pseudo_bit_t structure, which allows the MLX_FILL etc. macros to work without requiring explicit type information.
Definition at line 43 of file mlx_bitops.h.
| #define MLX_PSEUDO_STRUCT | ( | _ptr | ) | typeof ( *((_ptr)->u.dummy[0]) ) |
Get pseudo_bit_t structure type from wrapper structure pointer.
Definition at line 53 of file mlx_bitops.h.
| #define MLX_BIT_OFFSET | ( | _structure_st, | |||
| _field | ) | offsetof ( _structure_st, _field ) |
| #define MLX_DWORD_OFFSET | ( | _structure_st, | |||
| _field | ) | ( MLX_BIT_OFFSET ( _structure_st, _field ) / 32 ) |
Dword offset of a field within a pseudo_bit_t structure.
Definition at line 61 of file mlx_bitops.h.
| #define MLX_DWORD_BIT_OFFSET | ( | _structure_st, | |||
| _index, | |||||
| _field | ) | ( MLX_BIT_OFFSET ( _structure_st, _field ) - ( 32 * (_index) ) ) |
Dword bit offset of a field within a pseudo_bit_t structure.
Yes, using mod-32 would work, but would lose the check for the error of specifying a mismatched field name and dword index.
Definition at line 69 of file mlx_bitops.h.
| #define MLX_BIT_WIDTH | ( | _structure_st, | |||
| _field | ) | sizeof ( ( ( _structure_st * ) NULL )->_field ) |
| #define MLX_BIT_MASK | ( | _structure_st, | |||
| _field | ) |
Value:
( ( ~( ( uint32_t ) 0 ) ) >> \ ( 32 - MLX_BIT_WIDTH ( _structure_st, _field ) ) )
Definition at line 77 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_1 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value | ) | ( (_value) << MLX_DWORD_BIT_OFFSET ( _structure_st, _index, _field ) ) |
Definition at line 86 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_2 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value, | |||||
| ... | ) |
Value:
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \ MLX_ASSEMBLE_1 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 89 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_3 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value, | |||||
| ... | ) |
Value:
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \ MLX_ASSEMBLE_2 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 93 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_4 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value, | |||||
| ... | ) |
Value:
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \ MLX_ASSEMBLE_3 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 97 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_5 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value, | |||||
| ... | ) |
Value:
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \ MLX_ASSEMBLE_4 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 101 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_6 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value, | |||||
| ... | ) |
Value:
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \ MLX_ASSEMBLE_5 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 105 of file mlx_bitops.h.
| #define MLX_ASSEMBLE_7 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| _value, | |||||
| ... | ) |
Value:
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \ MLX_ASSEMBLE_6 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 109 of file mlx_bitops.h.
| #define MLX_MASK_1 | ( | _structure_st, | |||
| _index, | |||||
| _field | ) |
Value:
( MLX_BIT_MASK ( _structure_st, _field ) << \ MLX_DWORD_BIT_OFFSET ( _structure_st, _index, _field ) )
Definition at line 118 of file mlx_bitops.h.
| #define MLX_MASK_2 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| ... | ) |
Value:
( MLX_MASK_1 ( _structure_st, _index, _field ) | \ MLX_MASK_1 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 122 of file mlx_bitops.h.
| #define MLX_MASK_3 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| ... | ) |
Value:
( MLX_MASK_1 ( _structure_st, _index, _field ) | \ MLX_MASK_2 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 126 of file mlx_bitops.h.
| #define MLX_MASK_4 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| ... | ) |
Value:
( MLX_MASK_1 ( _structure_st, _index, _field ) | \ MLX_MASK_3 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 130 of file mlx_bitops.h.
| #define MLX_MASK_5 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| ... | ) |
Value:
( MLX_MASK_1 ( _structure_st, _index, _field ) | \ MLX_MASK_4 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 134 of file mlx_bitops.h.
| #define MLX_MASK_6 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| ... | ) |
Value:
( MLX_MASK_1 ( _structure_st, _index, _field ) | \ MLX_MASK_5 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 138 of file mlx_bitops.h.
| #define MLX_MASK_7 | ( | _structure_st, | |||
| _index, | |||||
| _field, | |||||
| ... | ) |
Value:
( MLX_MASK_1 ( _structure_st, _index, _field ) | \ MLX_MASK_6 ( _structure_st, _index, __VA_ARGS__ ) )
Definition at line 142 of file mlx_bitops.h.
| #define MLX_FILL | ( | _ptr, | |||
| _index, | |||||
| _assembled | ) |
Value:
do { \ uint32_t *__ptr = &(_ptr)->u.dwords[(_index)]; \ uint32_t __assembled = (_assembled); \ *__ptr = cpu_to_be32 ( __assembled ); \ } while ( 0 )
Definition at line 151 of file mlx_bitops.h.
| #define MLX_FILL_1 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_1 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 158 of file mlx_bitops.h.
Referenced by arbel_alloc_icm(), arbel_cmd(), arbel_complete(), arbel_create_cq(), arbel_create_eq(), arbel_create_qp(), arbel_create_recv_wq(), arbel_create_send_wq(), arbel_destroy_cq(), arbel_destroy_eq(), arbel_destroy_qp(), arbel_modify_qp(), arbel_open(), arbel_poll_cq(), arbel_poll_eq(), arbel_post_recv(), arbel_post_send(), arbel_probe(), arbel_setup_mpt(), hermon_alloc_icm(), hermon_alloc_mtt(), hermon_cmd(), hermon_create_cq(), hermon_create_eq(), hermon_create_qp(), hermon_destroy_eq(), hermon_fill_mlx_send_wqe(), hermon_fill_rc_send_wqe(), hermon_fill_ud_send_wqe(), hermon_free_icm(), hermon_map_vpm(), hermon_mcast_attach(), hermon_modify_qp(), hermon_open(), hermon_poll_cq(), hermon_poll_eq(), hermon_post_recv(), hermon_post_send(), hermon_probe(), and hermon_setup_mpt().
| #define MLX_FILL_2 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_2 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 162 of file mlx_bitops.h.
Referenced by arbel_alloc_icm(), arbel_create_cq(), arbel_create_qp(), arbel_mcast_attach(), arbel_post_send(), arbel_start_firmware(), hermon_alloc_icm(), hermon_alloc_mtt(), hermon_create_cq(), hermon_create_qp(), hermon_fill_ud_send_wqe(), hermon_map_vpm(), hermon_modify_qp(), hermon_open(), and hermon_post_send().
| #define MLX_FILL_3 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_3 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 166 of file mlx_bitops.h.
Referenced by arbel_cmd(), arbel_create_qp(), arbel_open(), and arbel_post_send().
| #define MLX_FILL_4 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_4 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 170 of file mlx_bitops.h.
Referenced by arbel_post_send(), arbel_setup_mpt(), hermon_cmd(), and hermon_create_qp().
| #define MLX_FILL_5 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_5 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 174 of file mlx_bitops.h.
Referenced by hermon_fill_mlx_send_wqe().
| #define MLX_FILL_6 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_6 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 178 of file mlx_bitops.h.
Referenced by arbel_create_qp().
| #define MLX_FILL_7 | ( | _ptr, | |||
| _index, | |||||
| ... | ) |
Value:
MLX_FILL ( _ptr, _index, MLX_ASSEMBLE_7 ( MLX_PSEUDO_STRUCT ( _ptr ),\ _index, __VA_ARGS__ ) )
Definition at line 182 of file mlx_bitops.h.
Referenced by hermon_setup_mpt().
| #define MLX_SET | ( | _ptr, | |||
| _field, | |||||
| _value | ) |
Value:
do { \ unsigned int __index = \ MLX_DWORD_OFFSET ( MLX_PSEUDO_STRUCT ( _ptr ), _field ); \ uint32_t *__ptr = &(_ptr)->u.dwords[__index]; \ uint32_t __value = be32_to_cpu ( *__ptr ); \ __value &= ~( MLX_MASK_1 ( MLX_PSEUDO_STRUCT ( _ptr ), \ __index, _field ) ); \ __value |= MLX_ASSEMBLE_1 ( MLX_PSEUDO_STRUCT ( _ptr ), \ __index, _field, _value ); \ *__ptr = cpu_to_be32 ( __value ); \ } while ( 0 )
Definition at line 191 of file mlx_bitops.h.
Referenced by arbel_post_send().
| #define MLX_GET | ( | _ptr, | |||
| _field | ) |
Value:
( { \
unsigned int __index = \
MLX_DWORD_OFFSET ( MLX_PSEUDO_STRUCT ( _ptr ), _field ); \
uint32_t *__ptr = &(_ptr)->u.dwords[__index]; \
uint32_t __value = be32_to_cpu ( *__ptr ); \
__value >>= \
MLX_DWORD_BIT_OFFSET ( MLX_PSEUDO_STRUCT ( _ptr ), \
__index, _field ); \
__value &= \
MLX_BIT_MASK ( MLX_PSEUDO_STRUCT ( _ptr ), _field ); \
__value; \
} )
Definition at line 209 of file mlx_bitops.h.
Referenced by arbel_alloc_icm(), arbel_cmd(), arbel_cmd_wait(), arbel_complete(), arbel_event_port_state_change(), arbel_get_limits(), arbel_mcast_attach(), arbel_mcast_detach(), arbel_poll_cq(), arbel_poll_eq(), arbel_start_firmware(), hermon_alloc_icm(), hermon_cmd(), hermon_cmd_wait(), hermon_complete(), hermon_event_port_state_change(), hermon_get_cap(), hermon_mcast_attach(), hermon_mcast_detach(), hermon_poll_cq(), hermon_poll_eq(), hermon_sense_port_type(), and hermon_start_firmware().
| typedef unsigned char pseudo_bit_t |
Definition at line 32 of file mlx_bitops.h.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
1.5.7.1