iw_cxgbe.h (316122) | iw_cxgbe.h (318798) |
---|---|
1/* 2 * Copyright (c) 2009-2013, 2016 Chelsio, Inc. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 14 unchanged lines hidden (view full) --- 23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 * SOFTWARE. 30 * | 1/* 2 * Copyright (c) 2009-2013, 2016 Chelsio, Inc. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: --- 14 unchanged lines hidden (view full) --- 23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 * SOFTWARE. 30 * |
31 * $FreeBSD: stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h 316122 2017-03-29 02:20:07Z np $ | 31 * $FreeBSD: stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h 318798 2017-05-24 18:14:57Z np $ |
32 */ 33#ifndef __IW_CXGB4_H__ 34#define __IW_CXGB4_H__ 35 36#include <linux/list.h> 37#include <linux/spinlock.h> 38#include <linux/idr.h> 39#include <linux/completion.h> --- 112 unchanged lines hidden (view full) --- 152 return rdev->flags & T4_FATAL_ERROR; 153} 154 155static inline int c4iw_num_stags(struct c4iw_rdev *rdev) 156{ 157 return (int)(rdev->adap->vres.stag.size >> 5); 158} 159 | 32 */ 33#ifndef __IW_CXGB4_H__ 34#define __IW_CXGB4_H__ 35 36#include <linux/list.h> 37#include <linux/spinlock.h> 38#include <linux/idr.h> 39#include <linux/completion.h> --- 112 unchanged lines hidden (view full) --- 152 return rdev->flags & T4_FATAL_ERROR; 153} 154 155static inline int c4iw_num_stags(struct c4iw_rdev *rdev) 156{ 157 return (int)(rdev->adap->vres.stag.size >> 5); 158} 159 |
160#define C4IW_WR_TO (10*HZ) | 160#define C4IW_WR_TO (60*HZ) |
161 162struct c4iw_wr_wait { 163 int ret; | 161 162struct c4iw_wr_wait { 163 int ret; |
164 atomic_t completion; | 164 struct completion completion; |
165}; 166 167static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp) 168{ 169 wr_waitp->ret = 0; | 165}; 166 167static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp) 168{ 169 wr_waitp->ret = 0; |
170 atomic_set(&wr_waitp->completion, 0); | 170 init_completion(&wr_waitp->completion); |
171} 172 173static inline void c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret) 174{ 175 wr_waitp->ret = ret; | 171} 172 173static inline void c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret) 174{ 175 wr_waitp->ret = ret; |
176 atomic_set(&wr_waitp->completion, 1); 177 wakeup(wr_waitp); | 176 complete(&wr_waitp->completion); |
178} 179 180static inline int 181c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp, | 177} 178 179static inline int 180c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp, |
182 u32 hwtid, u32 qpid, const char *func) | 181 u32 hwtid, u32 qpid, const char *func) |
183{ 184 struct adapter *sc = rdev->adap; 185 unsigned to = C4IW_WR_TO; | 182{ 183 struct adapter *sc = rdev->adap; 184 unsigned to = C4IW_WR_TO; |
185 int ret; 186 int timedout = 0; 187 struct timeval t1, t2; |
|
186 | 188 |
187 while (!atomic_read(&wr_waitp->completion)) { 188 tsleep(wr_waitp, 0, "c4iw_wait", to); 189 if (SIGPENDING(curthread)) { 190 printf("%s - Device %s not responding - " 191 "tid %u qpid %u\n", func, 192 device_get_nameunit(sc->dev), hwtid, qpid); 193 if (c4iw_fatal_error(rdev)) { 194 wr_waitp->ret = -EIO; 195 break; 196 } 197 to = to << 2; 198 } 199 } | 189 if (c4iw_fatal_error(rdev)) { 190 wr_waitp->ret = -EIO; 191 goto out; 192 } 193 194 getmicrotime(&t1); 195 do { 196 ret = wait_for_completion_timeout(&wr_waitp->completion, to); 197 if (!ret) { 198 getmicrotime(&t2); 199 timevalsub(&t2, &t1); 200 printf("%s - Device %s not responding after %ld.%06ld " 201 "seconds - tid %u qpid %u\n", func, 202 device_get_nameunit(sc->dev), t2.tv_sec, t2.tv_usec, 203 hwtid, qpid); 204 if (c4iw_fatal_error(rdev)) { 205 wr_waitp->ret = -EIO; 206 break; 207 } 208 to = to << 2; 209 timedout = 1; 210 } 211 } while (!ret); 212 213out: 214 if (timedout) { 215 getmicrotime(&t2); 216 timevalsub(&t2, &t1); 217 printf("%s - Device %s reply after %ld.%06ld seconds - " 218 "tid %u qpid %u\n", func, device_get_nameunit(sc->dev), 219 t2.tv_sec, t2.tv_usec, hwtid, qpid); 220 } |
200 if (wr_waitp->ret) | 221 if (wr_waitp->ret) |
201 CTR4(KTR_IW_CXGBE, "%s: FW reply %d tid %u qpid %u", 202 device_get_nameunit(sc->dev), wr_waitp->ret, hwtid, qpid); | 222 CTR4(KTR_IW_CXGBE, "%p: FW reply %d tid %u qpid %u", sc, 223 wr_waitp->ret, hwtid, qpid); |
203 return (wr_waitp->ret); 204} 205 206struct c4iw_dev { 207 struct ib_device ibdev; 208 struct c4iw_rdev rdev; 209 u32 device_cap_flags; 210 struct idr cqidr; --- 731 unchanged lines hidden --- | 224 return (wr_waitp->ret); 225} 226 227struct c4iw_dev { 228 struct ib_device ibdev; 229 struct c4iw_rdev rdev; 230 u32 device_cap_flags; 231 struct idr cqidr; --- 731 unchanged lines hidden --- |