Commit 2b540355 authored by Adrian Bunk's avatar Adrian Bunk Committed by Roland Dreier

RDMA/cxgb3: cleanups

- don't mark static functions in C files as inline - gcc should know
  best whether inlining makes sense
- never compile the unused cxio_dbg.c
- make the following needlessly global functions static:
  - cxio_hal.c: cxio_hal_clear_qp_ctx()
  - iwch_provider.c: iwch_get_qp()
- remove the following unused global functions:
  - cxio_hal.c: cxio_allocate_stag()
  - cxio_resource.: cxio_hal_get_rhdl()
  - cxio_resource.: cxio_hal_put_rhdl()
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Acked-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 1836854f
...@@ -8,5 +8,4 @@ iw_cxgb3-y := iwch_cm.o iwch_ev.o iwch_cq.o iwch_qp.o iwch_mem.o \ ...@@ -8,5 +8,4 @@ iw_cxgb3-y := iwch_cm.o iwch_ev.o iwch_cq.o iwch_qp.o iwch_mem.o \
ifdef CONFIG_INFINIBAND_CXGB3_DEBUG ifdef CONFIG_INFINIBAND_CXGB3_DEBUG
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
iw_cxgb3-y += cxio_dbg.o
endif endif
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
static LIST_HEAD(rdev_list); static LIST_HEAD(rdev_list);
static cxio_hal_ev_callback_func_t cxio_ev_cb = NULL; static cxio_hal_ev_callback_func_t cxio_ev_cb = NULL;
static inline struct cxio_rdev *cxio_hal_find_rdev_by_name(char *dev_name) static struct cxio_rdev *cxio_hal_find_rdev_by_name(char *dev_name)
{ {
struct cxio_rdev *rdev; struct cxio_rdev *rdev;
...@@ -55,8 +55,7 @@ static inline struct cxio_rdev *cxio_hal_find_rdev_by_name(char *dev_name) ...@@ -55,8 +55,7 @@ static inline struct cxio_rdev *cxio_hal_find_rdev_by_name(char *dev_name)
return NULL; return NULL;
} }
static inline struct cxio_rdev *cxio_hal_find_rdev_by_t3cdev(struct t3cdev static struct cxio_rdev *cxio_hal_find_rdev_by_t3cdev(struct t3cdev *tdev)
*tdev)
{ {
struct cxio_rdev *rdev; struct cxio_rdev *rdev;
...@@ -118,7 +117,7 @@ int cxio_hal_cq_op(struct cxio_rdev *rdev_p, struct t3_cq *cq, ...@@ -118,7 +117,7 @@ int cxio_hal_cq_op(struct cxio_rdev *rdev_p, struct t3_cq *cq,
return 0; return 0;
} }
static inline int cxio_hal_clear_cq_ctx(struct cxio_rdev *rdev_p, u32 cqid) static int cxio_hal_clear_cq_ctx(struct cxio_rdev *rdev_p, u32 cqid)
{ {
struct rdma_cq_setup setup; struct rdma_cq_setup setup;
setup.id = cqid; setup.id = cqid;
...@@ -130,7 +129,7 @@ static inline int cxio_hal_clear_cq_ctx(struct cxio_rdev *rdev_p, u32 cqid) ...@@ -130,7 +129,7 @@ static inline int cxio_hal_clear_cq_ctx(struct cxio_rdev *rdev_p, u32 cqid)
return (rdev_p->t3cdev_p->ctl(rdev_p->t3cdev_p, RDMA_CQ_SETUP, &setup)); return (rdev_p->t3cdev_p->ctl(rdev_p->t3cdev_p, RDMA_CQ_SETUP, &setup));
} }
int cxio_hal_clear_qp_ctx(struct cxio_rdev *rdev_p, u32 qpid) static int cxio_hal_clear_qp_ctx(struct cxio_rdev *rdev_p, u32 qpid)
{ {
u64 sge_cmd; u64 sge_cmd;
struct t3_modify_qp_wr *wqe; struct t3_modify_qp_wr *wqe;
...@@ -425,7 +424,7 @@ void cxio_flush_hw_cq(struct t3_cq *cq) ...@@ -425,7 +424,7 @@ void cxio_flush_hw_cq(struct t3_cq *cq)
} }
} }
static inline int cqe_completes_wr(struct t3_cqe *cqe, struct t3_wq *wq) static int cqe_completes_wr(struct t3_cqe *cqe, struct t3_wq *wq)
{ {
if (CQE_OPCODE(*cqe) == T3_TERMINATE) if (CQE_OPCODE(*cqe) == T3_TERMINATE)
return 0; return 0;
...@@ -760,17 +759,6 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry, ...@@ -760,17 +759,6 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry,
return err; return err;
} }
/* IN : stag key, pdid, pbl_size
* Out: stag index, actaul pbl_size, and pbl_addr allocated.
*/
int cxio_allocate_stag(struct cxio_rdev *rdev_p, u32 * stag, u32 pdid,
enum tpt_mem_perm perm, u32 * pbl_size, u32 * pbl_addr)
{
*stag = T3_STAG_UNSET;
return (__cxio_tpt_op(rdev_p, 0, stag, 0, pdid, TPT_NON_SHARED_MR,
perm, 0, 0ULL, 0, 0, NULL, pbl_size, pbl_addr));
}
int cxio_register_phys_mem(struct cxio_rdev *rdev_p, u32 *stag, u32 pdid, int cxio_register_phys_mem(struct cxio_rdev *rdev_p, u32 *stag, u32 pdid,
enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len,
u8 page_size, __be64 *pbl, u32 *pbl_size, u8 page_size, __be64 *pbl, u32 *pbl_size,
...@@ -1029,7 +1017,7 @@ void __exit cxio_hal_exit(void) ...@@ -1029,7 +1017,7 @@ void __exit cxio_hal_exit(void)
cxio_hal_destroy_rhdl_resource(); cxio_hal_destroy_rhdl_resource();
} }
static inline void flush_completed_wrs(struct t3_wq *wq, struct t3_cq *cq) static void flush_completed_wrs(struct t3_wq *wq, struct t3_cq *cq)
{ {
struct t3_swsq *sqp; struct t3_swsq *sqp;
__u32 ptr = wq->sq_rptr; __u32 ptr = wq->sq_rptr;
...@@ -1058,9 +1046,8 @@ static inline void flush_completed_wrs(struct t3_wq *wq, struct t3_cq *cq) ...@@ -1058,9 +1046,8 @@ static inline void flush_completed_wrs(struct t3_wq *wq, struct t3_cq *cq)
break; break;
} }
static inline void create_read_req_cqe(struct t3_wq *wq, static void create_read_req_cqe(struct t3_wq *wq, struct t3_cqe *hw_cqe,
struct t3_cqe *hw_cqe, struct t3_cqe *read_cqe)
struct t3_cqe *read_cqe)
{ {
read_cqe->u.scqe.wrid_hi = wq->oldest_read->sq_wptr; read_cqe->u.scqe.wrid_hi = wq->oldest_read->sq_wptr;
read_cqe->len = wq->oldest_read->read_len; read_cqe->len = wq->oldest_read->read_len;
...@@ -1073,7 +1060,7 @@ static inline void create_read_req_cqe(struct t3_wq *wq, ...@@ -1073,7 +1060,7 @@ static inline void create_read_req_cqe(struct t3_wq *wq,
/* /*
* Return a ptr to the next read wr in the SWSQ or NULL. * Return a ptr to the next read wr in the SWSQ or NULL.
*/ */
static inline void advance_oldest_read(struct t3_wq *wq) static void advance_oldest_read(struct t3_wq *wq)
{ {
u32 rptr = wq->oldest_read - wq->sq + 1; u32 rptr = wq->oldest_read - wq->sq + 1;
......
...@@ -143,7 +143,6 @@ int cxio_rdev_open(struct cxio_rdev *rdev); ...@@ -143,7 +143,6 @@ int cxio_rdev_open(struct cxio_rdev *rdev);
void cxio_rdev_close(struct cxio_rdev *rdev); void cxio_rdev_close(struct cxio_rdev *rdev);
int cxio_hal_cq_op(struct cxio_rdev *rdev, struct t3_cq *cq, int cxio_hal_cq_op(struct cxio_rdev *rdev, struct t3_cq *cq,
enum t3_cq_opcode op, u32 credit); enum t3_cq_opcode op, u32 credit);
int cxio_hal_clear_qp_ctx(struct cxio_rdev *rdev, u32 qpid);
int cxio_create_cq(struct cxio_rdev *rdev, struct t3_cq *cq); int cxio_create_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
int cxio_destroy_cq(struct cxio_rdev *rdev, struct t3_cq *cq); int cxio_destroy_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
int cxio_resize_cq(struct cxio_rdev *rdev, struct t3_cq *cq); int cxio_resize_cq(struct cxio_rdev *rdev, struct t3_cq *cq);
...@@ -154,8 +153,6 @@ int cxio_create_qp(struct cxio_rdev *rdev, u32 kernel_domain, struct t3_wq *wq, ...@@ -154,8 +153,6 @@ int cxio_create_qp(struct cxio_rdev *rdev, u32 kernel_domain, struct t3_wq *wq,
int cxio_destroy_qp(struct cxio_rdev *rdev, struct t3_wq *wq, int cxio_destroy_qp(struct cxio_rdev *rdev, struct t3_wq *wq,
struct cxio_ucontext *uctx); struct cxio_ucontext *uctx);
int cxio_peek_cq(struct t3_wq *wr, struct t3_cq *cq, int opcode); int cxio_peek_cq(struct t3_wq *wr, struct t3_cq *cq, int opcode);
int cxio_allocate_stag(struct cxio_rdev *rdev, u32 * stag, u32 pdid,
enum tpt_mem_perm perm, u32 * pbl_size, u32 * pbl_addr);
int cxio_register_phys_mem(struct cxio_rdev *rdev, u32 * stag, u32 pdid, int cxio_register_phys_mem(struct cxio_rdev *rdev, u32 * stag, u32 pdid,
enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len,
u8 page_size, __be64 *pbl, u32 *pbl_size, u8 page_size, __be64 *pbl, u32 *pbl_size,
...@@ -171,8 +168,6 @@ int cxio_deallocate_window(struct cxio_rdev *rdev, u32 stag); ...@@ -171,8 +168,6 @@ int cxio_deallocate_window(struct cxio_rdev *rdev, u32 stag);
int cxio_rdma_init(struct cxio_rdev *rdev, struct t3_rdma_init_attr *attr); int cxio_rdma_init(struct cxio_rdev *rdev, struct t3_rdma_init_attr *attr);
void cxio_register_ev_cb(cxio_hal_ev_callback_func_t ev_cb); void cxio_register_ev_cb(cxio_hal_ev_callback_func_t ev_cb);
void cxio_unregister_ev_cb(cxio_hal_ev_callback_func_t ev_cb); void cxio_unregister_ev_cb(cxio_hal_ev_callback_func_t ev_cb);
u32 cxio_hal_get_rhdl(void);
void cxio_hal_put_rhdl(u32 rhdl);
u32 cxio_hal_get_pdid(struct cxio_hal_resource *rscp); u32 cxio_hal_get_pdid(struct cxio_hal_resource *rscp);
void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid); void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid);
int __init cxio_hal_init(void); int __init cxio_hal_init(void);
......
...@@ -179,7 +179,7 @@ int cxio_hal_init_resource(struct cxio_rdev *rdev_p, ...@@ -179,7 +179,7 @@ int cxio_hal_init_resource(struct cxio_rdev *rdev_p,
/* /*
* returns 0 if no resource available * returns 0 if no resource available
*/ */
static inline u32 cxio_hal_get_resource(struct kfifo *fifo) static u32 cxio_hal_get_resource(struct kfifo *fifo)
{ {
u32 entry; u32 entry;
if (kfifo_get(fifo, (unsigned char *) &entry, sizeof(u32))) if (kfifo_get(fifo, (unsigned char *) &entry, sizeof(u32)))
...@@ -188,21 +188,11 @@ static inline u32 cxio_hal_get_resource(struct kfifo *fifo) ...@@ -188,21 +188,11 @@ static inline u32 cxio_hal_get_resource(struct kfifo *fifo)
return 0; /* fifo emptry */ return 0; /* fifo emptry */
} }
static inline void cxio_hal_put_resource(struct kfifo *fifo, u32 entry) static void cxio_hal_put_resource(struct kfifo *fifo, u32 entry)
{ {
BUG_ON(kfifo_put(fifo, (unsigned char *) &entry, sizeof(u32)) == 0); BUG_ON(kfifo_put(fifo, (unsigned char *) &entry, sizeof(u32)) == 0);
} }
u32 cxio_hal_get_rhdl(void)
{
return cxio_hal_get_resource(rhdl_fifo);
}
void cxio_hal_put_rhdl(u32 rhdl)
{
cxio_hal_put_resource(rhdl_fifo, rhdl);
}
u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp) u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp)
{ {
return cxio_hal_get_resource(rscp->tpt_fifo); return cxio_hal_get_resource(rscp->tpt_fifo);
......
...@@ -209,8 +209,7 @@ static enum iwch_ep_state state_read(struct iwch_ep_common *epc) ...@@ -209,8 +209,7 @@ static enum iwch_ep_state state_read(struct iwch_ep_common *epc)
return state; return state;
} }
static inline void __state_set(struct iwch_ep_common *epc, static void __state_set(struct iwch_ep_common *epc, enum iwch_ep_state new)
enum iwch_ep_state new)
{ {
epc->state = new; epc->state = new;
} }
...@@ -1459,7 +1458,7 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) ...@@ -1459,7 +1458,7 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
/* /*
* Returns whether an ABORT_REQ_RSS message is a negative advice. * Returns whether an ABORT_REQ_RSS message is a negative advice.
*/ */
static inline int is_neg_adv_abort(unsigned int status) static int is_neg_adv_abort(unsigned int status)
{ {
return status == CPL_ERR_RTX_NEG_ADVICE || return status == CPL_ERR_RTX_NEG_ADVICE ||
status == CPL_ERR_PERSIST_NEG_ADVICE; status == CPL_ERR_PERSIST_NEG_ADVICE;
......
...@@ -948,7 +948,7 @@ void iwch_qp_rem_ref(struct ib_qp *qp) ...@@ -948,7 +948,7 @@ void iwch_qp_rem_ref(struct ib_qp *qp)
wake_up(&(to_iwch_qp(qp)->wait)); wake_up(&(to_iwch_qp(qp)->wait));
} }
struct ib_qp *iwch_get_qp(struct ib_device *dev, int qpn) static struct ib_qp *iwch_get_qp(struct ib_device *dev, int qpn)
{ {
PDBG("%s ib_dev %p qpn 0x%x\n", __FUNCTION__, dev, qpn); PDBG("%s ib_dev %p qpn 0x%x\n", __FUNCTION__, dev, qpn);
return (struct ib_qp *)get_qhp(to_iwch_dev(dev), qpn); return (struct ib_qp *)get_qhp(to_iwch_dev(dev), qpn);
......
...@@ -178,7 +178,6 @@ static inline struct iwch_qp *to_iwch_qp(struct ib_qp *ibqp) ...@@ -178,7 +178,6 @@ static inline struct iwch_qp *to_iwch_qp(struct ib_qp *ibqp)
void iwch_qp_add_ref(struct ib_qp *qp); void iwch_qp_add_ref(struct ib_qp *qp);
void iwch_qp_rem_ref(struct ib_qp *qp); void iwch_qp_rem_ref(struct ib_qp *qp);
struct ib_qp *iwch_get_qp(struct ib_device *dev, int qpn);
struct iwch_ucontext { struct iwch_ucontext {
struct ib_ucontext ibucontext; struct ib_ucontext ibucontext;
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
#define NO_SUPPORT -1 #define NO_SUPPORT -1
static inline int iwch_build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr, static int iwch_build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr,
u8 * flit_cnt) u8 * flit_cnt)
{ {
int i; int i;
u32 plen; u32 plen;
...@@ -96,8 +96,8 @@ static inline int iwch_build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr, ...@@ -96,8 +96,8 @@ static inline int iwch_build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr,
return 0; return 0;
} }
static inline int iwch_build_rdma_write(union t3_wr *wqe, struct ib_send_wr *wr, static int iwch_build_rdma_write(union t3_wr *wqe, struct ib_send_wr *wr,
u8 *flit_cnt) u8 *flit_cnt)
{ {
int i; int i;
u32 plen; u32 plen;
...@@ -137,8 +137,8 @@ static inline int iwch_build_rdma_write(union t3_wr *wqe, struct ib_send_wr *wr, ...@@ -137,8 +137,8 @@ static inline int iwch_build_rdma_write(union t3_wr *wqe, struct ib_send_wr *wr,
return 0; return 0;
} }
static inline int iwch_build_rdma_read(union t3_wr *wqe, struct ib_send_wr *wr, static int iwch_build_rdma_read(union t3_wr *wqe, struct ib_send_wr *wr,
u8 *flit_cnt) u8 *flit_cnt)
{ {
if (wr->num_sge > 1) if (wr->num_sge > 1)
return -EINVAL; return -EINVAL;
...@@ -158,9 +158,8 @@ static inline int iwch_build_rdma_read(union t3_wr *wqe, struct ib_send_wr *wr, ...@@ -158,9 +158,8 @@ static inline int iwch_build_rdma_read(union t3_wr *wqe, struct ib_send_wr *wr,
/* /*
* TBD: this is going to be moved to firmware. Missing pdid/qpid check for now. * TBD: this is going to be moved to firmware. Missing pdid/qpid check for now.
*/ */
static inline int iwch_sgl2pbl_map(struct iwch_dev *rhp, static int iwch_sgl2pbl_map(struct iwch_dev *rhp, struct ib_sge *sg_list,
struct ib_sge *sg_list, u32 num_sgle, u32 num_sgle, u32 * pbl_addr, u8 * page_size)
u32 * pbl_addr, u8 * page_size)
{ {
int i; int i;
struct iwch_mr *mhp; struct iwch_mr *mhp;
...@@ -206,9 +205,8 @@ static inline int iwch_sgl2pbl_map(struct iwch_dev *rhp, ...@@ -206,9 +205,8 @@ static inline int iwch_sgl2pbl_map(struct iwch_dev *rhp,
return 0; return 0;
} }
static inline int iwch_build_rdma_recv(struct iwch_dev *rhp, static int iwch_build_rdma_recv(struct iwch_dev *rhp, union t3_wr *wqe,
union t3_wr *wqe, struct ib_recv_wr *wr)
struct ib_recv_wr *wr)
{ {
int i, err = 0; int i, err = 0;
u32 pbl_addr[4]; u32 pbl_addr[4];
...@@ -473,8 +471,7 @@ int iwch_bind_mw(struct ib_qp *qp, ...@@ -473,8 +471,7 @@ int iwch_bind_mw(struct ib_qp *qp,
return err; return err;
} }
static inline void build_term_codes(int t3err, u8 *layer_type, u8 *ecode, static void build_term_codes(int t3err, u8 *layer_type, u8 *ecode, int tagged)
int tagged)
{ {
switch (t3err) { switch (t3err) {
case TPT_ERR_STAG: case TPT_ERR_STAG:
...@@ -672,7 +669,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag) ...@@ -672,7 +669,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag)
spin_lock_irqsave(&qhp->lock, *flag); spin_lock_irqsave(&qhp->lock, *flag);
} }
static inline void flush_qp(struct iwch_qp *qhp, unsigned long *flag) static void flush_qp(struct iwch_qp *qhp, unsigned long *flag)
{ {
if (t3b_device(qhp->rhp)) if (t3b_device(qhp->rhp))
cxio_set_wq_in_error(&qhp->wq); cxio_set_wq_in_error(&qhp->wq);
...@@ -684,7 +681,7 @@ static inline void flush_qp(struct iwch_qp *qhp, unsigned long *flag) ...@@ -684,7 +681,7 @@ static inline void flush_qp(struct iwch_qp *qhp, unsigned long *flag)
/* /*
* Return non zero if at least one RECV was pre-posted. * Return non zero if at least one RECV was pre-posted.
*/ */
static inline int rqes_posted(struct iwch_qp *qhp) static int rqes_posted(struct iwch_qp *qhp)
{ {
return fw_riwrh_opcode((struct fw_riwrh *)qhp->wq.queue) == T3_WR_RCV; return fw_riwrh_opcode((struct fw_riwrh *)qhp->wq.queue) == T3_WR_RCV;
} }
......
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