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

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
Loading
Loading
Loading
Loading
+66 −60
Original line number Diff line number Diff line
@@ -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)