Date: Fri, 19 Oct 2007 19:32:51 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 127793 for review Message-ID: <200710191932.l9JJWpxM077374@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=127793 Change 127793 by kmacy@kmacy_home:ethng on 2007/10/19 19:32:12 add iw_cxgb_iwch_cm.c to the build Affected files ... .. //depot/projects/ethng/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_iwch.h#2 edit .. //depot/projects/ethng/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_iwch_cm.c#1 add .. //depot/projects/ethng/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_iwch_cm.h#2 edit .. //depot/projects/ethng/src/sys/modules/cxgb/iw_cxgb/Makefile#2 edit Differences ... ==== //depot/projects/ethng/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_iwch.h#2 (text+ko) ==== @@ -97,11 +97,9 @@ struct cxio_rdev rdev; u32 device_cap_flags; struct iwch_rnic_attributes attr; -#ifdef notyet struct idr cqidr; struct idr qpidr; struct idr mmidr; -#endif struct mtx lock; TAILQ_ENTRY(iwch_dev) entry; }; @@ -125,7 +123,6 @@ return rhp->rdev.t3cdev_p->type == T3A; } -#ifdef notyet static inline struct iwch_cq *get_chp(struct iwch_dev *rhp, u32 cqid) { return idr_find(&rhp->cqidr, cqid); @@ -148,13 +145,13 @@ u32 newid; do { - if (!idr_pre_get(idr, GFP_KERNEL)) { + if (!idr_pre_get(idr, M_NOWAIT)) { return -ENOMEM; } - spin_lock_irq(&rhp->lock); + mtx_lock(&rhp->lock); ret = idr_get_new_above(idr, handle, id, &newid); BUG_ON(newid != id); - spin_unlock_irq(&rhp->lock); + mtx_unlock(&rhp->lock); } while (ret == -EAGAIN); return ret; @@ -162,11 +159,10 @@ static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id) { - spin_lock_irq(&rhp->lock); + mtx_lock(&rhp->lock); idr_remove(idr, id); - spin_unlock_irq(&rhp->lock); + mtx_unlock(&rhp->lock); } -#endif extern struct cxgb_client t3c_client; extern cxgb_cpl_handler_func t3c_handlers[NUM_CPL_CMDS]; ==== //depot/projects/ethng/src/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_iwch_cm.h#2 (text+ko) ==== @@ -3,6 +3,8 @@ #define _IWCH_CM_H_ #include <contrib/rdma/ib_verbs.h> #include <contrib/rdma/iw_cm.h> +#include <sys/refcount.h> +#include <sys/condvar.h> #define MPA_KEY_REQ "MPA ID Req Frame" @@ -17,14 +19,15 @@ #define put_ep(ep) { \ PDBG("put_ep (via %s:%u) ep %p refcnt %d\n", __FUNCTION__, __LINE__, \ - ep, atomic_read(&((ep)->kref.refcount))); \ - kref_put(&((ep)->kref), __free_ep); \ + ep, atomic_load_acq_int(&((ep)->refcount))); \ + if (refcount_release(&((ep)->refcount))) \ + __free_ep(ep); \ } #define get_ep(ep) { \ PDBG("get_ep (via %s:%u) ep %p, refcnt %d\n", __FUNCTION__, __LINE__, \ - ep, atomic_read(&((ep)->kref.refcount))); \ - kref_get(&((ep)->kref)); \ + ep, atomic_load_acq_int(&((ep)->refcount))); \ + refcount_acquire(&((ep)->refcount)); \ } struct mpa_message { @@ -115,14 +118,11 @@ struct iwch_qp *qp; struct t3cdev *tdev; enum iwch_ep_state state; -#ifdef notyet - struct kref kref; - wait_queue_head_t waitq; -#endif + u_int refcount; + struct cv waitq; spinlock_t lock; struct sockaddr_in local_addr; struct sockaddr_in remote_addr; - int rpl_done; int rpl_err; }; @@ -135,18 +135,14 @@ struct iwch_ep { struct iwch_ep_common com; struct iwch_ep *parent_ep; -#ifdef notyet - struct timer_list timer; -#endif + struct callout timer; unsigned int atid; u32 hwtid; u32 snd_seq; struct l2t_entry *l2t; - struct dst_entry *dst; - struct sk_buff *mpa_skb; -#ifdef notyet + struct rtentry *dst; + struct mbuf *mpa_mbuf; struct iwch_mpa_attributes mpa_attr; -#endif unsigned int mpa_pkt_len; u8 mpa_pkt[sizeof(struct mpa_message) + MPA_MAX_PRIVATE_DATA]; u8 tos; @@ -176,6 +172,22 @@ return wscale; } +static void +wait_event(struct cv *cv, struct mtx *lock) +{ + mtx_lock(lock); + cv_wait_unlock(cv, lock); +} + +static void +wake_up(struct cv *cv, struct mtx *lock) +{ + mtx_lock(lock); + cv_broadcast(cv); + mtx_unlock(lock); +} + + /* CM prototypes */ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); @@ -183,12 +195,10 @@ int iwch_destroy_listen(struct iw_cm_id *cm_id); int iwch_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len); int iwch_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); -int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp); +int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, int flags); int iwch_quiesce_tid(struct iwch_ep *ep); int iwch_resume_tid(struct iwch_ep *ep); -#ifdef notyet -void __free_ep(struct kref *kref); -#endif +void __free_ep(struct iwch_ep_common *ep); void iwch_rearp(struct iwch_ep *ep); int iwch_ep_redirect(void *ctx, struct rtentry *old, struct rtentry *new, struct l2t_entry *l2t); ==== //depot/projects/ethng/src/sys/modules/cxgb/iw_cxgb/Makefile#2 (text+ko) ==== @@ -4,7 +4,7 @@ .PATH: ${IW_CXGB} ${CXGB}/common ${CXGB}/ulp/iw_cxgb KMOD= iw_cxgb -SRCS= iw_cxgb_iwch.c bus_if.h device_if.h opt_sched.h pci_if.h +SRCS= iw_cxgb_iwch.c iw_cxgb_iwch_cm.c bus_if.h device_if.h opt_sched.h pci_if.h CFLAGS+= -DCONFIG_CHELSIO_T3_CORE -g -DCONFIG_DEFINED -I${CXGB} -DSMP .include <bsd.kmod.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710191932.l9JJWpxM077374>