Commit 2cf2f4f5 authored by Alexander Lobakin's avatar Alexander Lobakin Committed by David S. Miller

qed: reformat "qed_chain.h" a bit

Reformat structs and macros definitions a bit prior to making functional
changes.
Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1fa27f5
......@@ -77,14 +77,16 @@ struct addr_tbl_entry {
};
struct qed_chain {
/* fastpath portion of the chain - required for commands such
/* Fastpath portion of the chain - required for commands such
* as produce / consume.
*/
/* Point to next element to produce/consume */
void *p_prod_elem;
void *p_cons_elem;
/* Fastpath portions of the PBL [if exists] */
struct {
/* Table for keeping the virtual and physical addresses of the
* chain pages, respectively to the physical addresses
......@@ -144,24 +146,28 @@ struct qed_chain {
bool b_external_pbl;
};
#define QED_CHAIN_PBL_ENTRY_SIZE (8)
#define QED_CHAIN_PAGE_SIZE (0x1000)
#define ELEMS_PER_PAGE(elem_size) (QED_CHAIN_PAGE_SIZE / (elem_size))
#define QED_CHAIN_PBL_ENTRY_SIZE 8
#define QED_CHAIN_PAGE_SIZE 0x1000
#define ELEMS_PER_PAGE(elem_size) \
(QED_CHAIN_PAGE_SIZE / (elem_size))
#define UNUSABLE_ELEMS_PER_PAGE(elem_size, mode) \
(((mode) == QED_CHAIN_MODE_NEXT_PTR) ? \
(u8)(1 + ((sizeof(struct qed_chain_next) - 1) / \
(elem_size))) : 0)
(u8)(1 + ((sizeof(struct qed_chain_next) - 1) / (elem_size))) : \
0)
#define USABLE_ELEMS_PER_PAGE(elem_size, mode) \
((u32)(ELEMS_PER_PAGE(elem_size) - \
UNUSABLE_ELEMS_PER_PAGE(elem_size, mode)))
UNUSABLE_ELEMS_PER_PAGE((elem_size), (mode))))
#define QED_CHAIN_PAGE_CNT(elem_cnt, elem_size, mode) \
DIV_ROUND_UP(elem_cnt, USABLE_ELEMS_PER_PAGE(elem_size, mode))
DIV_ROUND_UP((elem_cnt), USABLE_ELEMS_PER_PAGE((elem_size), (mode)))
#define is_chain_u16(p) ((p)->cnt_type == QED_CHAIN_CNT_TYPE_U16)
#define is_chain_u32(p) ((p)->cnt_type == QED_CHAIN_CNT_TYPE_U32)
#define is_chain_u16(p) \
((p)->cnt_type == QED_CHAIN_CNT_TYPE_U16)
#define is_chain_u32(p) \
((p)->cnt_type == QED_CHAIN_CNT_TYPE_U32)
/* Accessors */
static inline u16 qed_chain_get_prod_idx(struct qed_chain *p_chain)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment