From owner-p4-projects@FreeBSD.ORG Fri Oct 19 19:32:52 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D942116A468; Fri, 19 Oct 2007 19:32:51 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 744F816A41A for ; Fri, 19 Oct 2007 19:32:51 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5758B13C447 for ; Fri, 19 Oct 2007 19:32:51 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9JJWpZk077377 for ; Fri, 19 Oct 2007 19:32:51 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9JJWpxM077374 for perforce@freebsd.org; Fri, 19 Oct 2007 19:32:51 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 19 Oct 2007 19:32:51 GMT Message-Id: <200710191932.l9JJWpxM077374@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 127793 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2007 19:32:52 -0000 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 #include +#include +#include #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