You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'rdma-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull InfiniBand/RDMA changes from Roland Dreier: - Updates to the qib low-level driver - First chunk of changes for SR-IOV support for mlx4 IB - RDMA CM support for IPv6-only binding - Other misc cleanups and fixes Fix up some add-add conflicts in include/linux/mlx4/device.h and drivers/net/ethernet/mellanox/mlx4/main.c * tag 'rdma-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (30 commits) IB/qib: checkpatch fixes IB/qib: Add congestion control agent implementation IB/qib: Reduce sdma_lock contention IB/qib: Fix an incorrect log message IB/qib: Fix QP RCU sparse warnings mlx4: Put physical GID and P_Key table sizes in mlx4_phys_caps struct and paravirtualize them mlx4_core: Allow guests to have IB ports mlx4_core: Implement mechanism for reserved Q_Keys net/mlx4_core: Free ICM table in case of error IB/cm: Destroy idr as part of the module init error flow mlx4_core: Remove double function declarations IB/mlx4: Fill the masked_atomic_cap attribute in query device IB/mthca: Fill in sq_sig_type in query QP IB/mthca: Warning about event for non-existent QPs should show event type IB/qib: Fix sparse RCU warnings in qib_keys.c net/mlx4_core: Initialize IB port capabilities for all slaves mlx4: Use port management change event instead of smp_snoop IB/qib: RCU locking for MR validation IB/qib: Avoid returning EBUSY from MR deregister IB/qib: Fix UC MR refs for immediate operations ...
This commit is contained in:
@@ -548,8 +548,8 @@ static void send_mpa_req(struct c4iw_ep *ep, struct sk_buff *skb,
|
||||
}
|
||||
|
||||
if (mpa_rev_to_use == 2) {
|
||||
mpa->private_data_size +=
|
||||
htons(sizeof(struct mpa_v2_conn_params));
|
||||
mpa->private_data_size = htons(ntohs(mpa->private_data_size) +
|
||||
sizeof (struct mpa_v2_conn_params));
|
||||
mpa_v2_params.ird = htons((u16)ep->ird);
|
||||
mpa_v2_params.ord = htons((u16)ep->ord);
|
||||
|
||||
@@ -635,8 +635,8 @@ static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen)
|
||||
|
||||
if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) {
|
||||
mpa->flags |= MPA_ENHANCED_RDMA_CONN;
|
||||
mpa->private_data_size +=
|
||||
htons(sizeof(struct mpa_v2_conn_params));
|
||||
mpa->private_data_size = htons(ntohs(mpa->private_data_size) +
|
||||
sizeof (struct mpa_v2_conn_params));
|
||||
mpa_v2_params.ird = htons(((u16)ep->ird) |
|
||||
(peer2peer ? MPA_V2_PEER2PEER_MODEL :
|
||||
0));
|
||||
@@ -715,8 +715,8 @@ static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen)
|
||||
|
||||
if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) {
|
||||
mpa->flags |= MPA_ENHANCED_RDMA_CONN;
|
||||
mpa->private_data_size +=
|
||||
htons(sizeof(struct mpa_v2_conn_params));
|
||||
mpa->private_data_size = htons(ntohs(mpa->private_data_size) +
|
||||
sizeof (struct mpa_v2_conn_params));
|
||||
mpa_v2_params.ird = htons((u16)ep->ird);
|
||||
mpa_v2_params.ord = htons((u16)ep->ord);
|
||||
if (peer2peer && (ep->mpa_attr.p2p_type !=
|
||||
|
||||
@@ -147,47 +147,51 @@ static void update_sm_ah(struct mlx4_ib_dev *dev, u8 port_num, u16 lid, u8 sl)
|
||||
}
|
||||
|
||||
/*
|
||||
* Snoop SM MADs for port info and P_Key table sets, so we can
|
||||
* synthesize LID change and P_Key change events.
|
||||
* Snoop SM MADs for port info, GUID info, and P_Key table sets, so we can
|
||||
* synthesize LID change, Client-Rereg, GID change, and P_Key change events.
|
||||
*/
|
||||
static void smp_snoop(struct ib_device *ibdev, u8 port_num, struct ib_mad *mad,
|
||||
u16 prev_lid)
|
||||
u16 prev_lid)
|
||||
{
|
||||
struct ib_event event;
|
||||
struct ib_port_info *pinfo;
|
||||
u16 lid;
|
||||
|
||||
struct mlx4_ib_dev *dev = to_mdev(ibdev);
|
||||
if ((mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED ||
|
||||
mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) &&
|
||||
mad->mad_hdr.method == IB_MGMT_METHOD_SET) {
|
||||
if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO) {
|
||||
struct ib_port_info *pinfo =
|
||||
(struct ib_port_info *) ((struct ib_smp *) mad)->data;
|
||||
u16 lid = be16_to_cpu(pinfo->lid);
|
||||
mad->mad_hdr.method == IB_MGMT_METHOD_SET)
|
||||
switch (mad->mad_hdr.attr_id) {
|
||||
case IB_SMP_ATTR_PORT_INFO:
|
||||
pinfo = (struct ib_port_info *) ((struct ib_smp *) mad)->data;
|
||||
lid = be16_to_cpu(pinfo->lid);
|
||||
|
||||
update_sm_ah(to_mdev(ibdev), port_num,
|
||||
update_sm_ah(dev, port_num,
|
||||
be16_to_cpu(pinfo->sm_lid),
|
||||
pinfo->neighbormtu_mastersmsl & 0xf);
|
||||
|
||||
event.device = ibdev;
|
||||
event.element.port_num = port_num;
|
||||
if (pinfo->clientrereg_resv_subnetto & 0x80)
|
||||
mlx4_ib_dispatch_event(dev, port_num,
|
||||
IB_EVENT_CLIENT_REREGISTER);
|
||||
|
||||
if (pinfo->clientrereg_resv_subnetto & 0x80) {
|
||||
event.event = IB_EVENT_CLIENT_REREGISTER;
|
||||
ib_dispatch_event(&event);
|
||||
}
|
||||
if (prev_lid != lid)
|
||||
mlx4_ib_dispatch_event(dev, port_num,
|
||||
IB_EVENT_LID_CHANGE);
|
||||
break;
|
||||
|
||||
if (prev_lid != lid) {
|
||||
event.event = IB_EVENT_LID_CHANGE;
|
||||
ib_dispatch_event(&event);
|
||||
}
|
||||
case IB_SMP_ATTR_PKEY_TABLE:
|
||||
mlx4_ib_dispatch_event(dev, port_num,
|
||||
IB_EVENT_PKEY_CHANGE);
|
||||
break;
|
||||
|
||||
case IB_SMP_ATTR_GUID_INFO:
|
||||
/* paravirtualized master's guid is guid 0 -- does not change */
|
||||
if (!mlx4_is_master(dev->dev))
|
||||
mlx4_ib_dispatch_event(dev, port_num,
|
||||
IB_EVENT_GID_CHANGE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (mad->mad_hdr.attr_id == IB_SMP_ATTR_PKEY_TABLE) {
|
||||
event.device = ibdev;
|
||||
event.event = IB_EVENT_PKEY_CHANGE;
|
||||
event.element.port_num = port_num;
|
||||
ib_dispatch_event(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_desc_override(struct ib_device *dev,
|
||||
@@ -242,6 +246,25 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
int err;
|
||||
struct ib_port_attr pattr;
|
||||
|
||||
if (in_wc && in_wc->qp->qp_num) {
|
||||
pr_debug("received MAD: slid:%d sqpn:%d "
|
||||
"dlid_bits:%d dqpn:%d wc_flags:0x%x, cls %x, mtd %x, atr %x\n",
|
||||
in_wc->slid, in_wc->src_qp,
|
||||
in_wc->dlid_path_bits,
|
||||
in_wc->qp->qp_num,
|
||||
in_wc->wc_flags,
|
||||
in_mad->mad_hdr.mgmt_class, in_mad->mad_hdr.method,
|
||||
be16_to_cpu(in_mad->mad_hdr.attr_id));
|
||||
if (in_wc->wc_flags & IB_WC_GRH) {
|
||||
pr_debug("sgid_hi:0x%016llx sgid_lo:0x%016llx\n",
|
||||
be64_to_cpu(in_grh->sgid.global.subnet_prefix),
|
||||
be64_to_cpu(in_grh->sgid.global.interface_id));
|
||||
pr_debug("dgid_hi:0x%016llx dgid_lo:0x%016llx\n",
|
||||
be64_to_cpu(in_grh->dgid.global.subnet_prefix),
|
||||
be64_to_cpu(in_grh->dgid.global.interface_id));
|
||||
}
|
||||
}
|
||||
|
||||
slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE);
|
||||
|
||||
if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && slid == 0) {
|
||||
@@ -286,7 +309,8 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
|
||||
return IB_MAD_RESULT_FAILURE;
|
||||
|
||||
if (!out_mad->mad_hdr.status) {
|
||||
smp_snoop(ibdev, port_num, in_mad, prev_lid);
|
||||
if (!(to_mdev(ibdev)->dev->caps.flags & MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV))
|
||||
smp_snoop(ibdev, port_num, in_mad, prev_lid);
|
||||
node_desc_override(ibdev, out_mad);
|
||||
}
|
||||
|
||||
@@ -427,3 +451,64 @@ void mlx4_ib_mad_cleanup(struct mlx4_ib_dev *dev)
|
||||
ib_destroy_ah(dev->sm_ah[p]);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_port_mgmt_change_event(struct work_struct *work)
|
||||
{
|
||||
struct ib_event_work *ew = container_of(work, struct ib_event_work, work);
|
||||
struct mlx4_ib_dev *dev = ew->ib_dev;
|
||||
struct mlx4_eqe *eqe = &(ew->ib_eqe);
|
||||
u8 port = eqe->event.port_mgmt_change.port;
|
||||
u32 changed_attr;
|
||||
|
||||
switch (eqe->subtype) {
|
||||
case MLX4_DEV_PMC_SUBTYPE_PORT_INFO:
|
||||
changed_attr = be32_to_cpu(eqe->event.port_mgmt_change.params.port_info.changed_attr);
|
||||
|
||||
/* Update the SM ah - This should be done before handling
|
||||
the other changed attributes so that MADs can be sent to the SM */
|
||||
if (changed_attr & MSTR_SM_CHANGE_MASK) {
|
||||
u16 lid = be16_to_cpu(eqe->event.port_mgmt_change.params.port_info.mstr_sm_lid);
|
||||
u8 sl = eqe->event.port_mgmt_change.params.port_info.mstr_sm_sl & 0xf;
|
||||
update_sm_ah(dev, port, lid, sl);
|
||||
}
|
||||
|
||||
/* Check if it is a lid change event */
|
||||
if (changed_attr & MLX4_EQ_PORT_INFO_LID_CHANGE_MASK)
|
||||
mlx4_ib_dispatch_event(dev, port, IB_EVENT_LID_CHANGE);
|
||||
|
||||
/* Generate GUID changed event */
|
||||
if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK)
|
||||
mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE);
|
||||
|
||||
if (changed_attr & MLX4_EQ_PORT_INFO_CLIENT_REREG_MASK)
|
||||
mlx4_ib_dispatch_event(dev, port,
|
||||
IB_EVENT_CLIENT_REREGISTER);
|
||||
break;
|
||||
|
||||
case MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE:
|
||||
mlx4_ib_dispatch_event(dev, port, IB_EVENT_PKEY_CHANGE);
|
||||
break;
|
||||
case MLX4_DEV_PMC_SUBTYPE_GUID_INFO:
|
||||
/* paravirtualized master's guid is guid 0 -- does not change */
|
||||
if (!mlx4_is_master(dev->dev))
|
||||
mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE);
|
||||
break;
|
||||
default:
|
||||
pr_warn("Unsupported subtype 0x%x for "
|
||||
"Port Management Change event\n", eqe->subtype);
|
||||
}
|
||||
|
||||
kfree(ew);
|
||||
}
|
||||
|
||||
void mlx4_ib_dispatch_event(struct mlx4_ib_dev *dev, u8 port_num,
|
||||
enum ib_event_type type)
|
||||
{
|
||||
struct ib_event event;
|
||||
|
||||
event.device = &dev->ib_dev;
|
||||
event.element.port_num = port_num;
|
||||
event.event = type;
|
||||
|
||||
ib_dispatch_event(&event);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "mlx4_ib.h"
|
||||
#include "user.h"
|
||||
|
||||
#define DRV_NAME "mlx4_ib"
|
||||
#define DRV_NAME MLX4_IB_DRV_NAME
|
||||
#define DRV_VERSION "1.0"
|
||||
#define DRV_RELDATE "April 4, 2008"
|
||||
|
||||
@@ -157,7 +157,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
||||
props->local_ca_ack_delay = dev->dev->caps.local_ca_ack_delay;
|
||||
props->atomic_cap = dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_ATOMIC ?
|
||||
IB_ATOMIC_HCA : IB_ATOMIC_NONE;
|
||||
props->masked_atomic_cap = IB_ATOMIC_HCA;
|
||||
props->masked_atomic_cap = props->atomic_cap;
|
||||
props->max_pkeys = dev->dev->caps.pkey_table_len[1];
|
||||
props->max_mcast_grp = dev->dev->caps.num_mgms + dev->dev->caps.num_amgms;
|
||||
props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm;
|
||||
@@ -946,7 +946,6 @@ static void update_gids_task(struct work_struct *work)
|
||||
union ib_gid *gids;
|
||||
int err;
|
||||
struct mlx4_dev *dev = gw->dev->dev;
|
||||
struct ib_event event;
|
||||
|
||||
mailbox = mlx4_alloc_cmd_mailbox(dev);
|
||||
if (IS_ERR(mailbox)) {
|
||||
@@ -964,10 +963,7 @@ static void update_gids_task(struct work_struct *work)
|
||||
pr_warn("set port command failed\n");
|
||||
else {
|
||||
memcpy(gw->dev->iboe.gid_table[gw->port - 1], gw->gids, sizeof gw->gids);
|
||||
event.device = &gw->dev->ib_dev;
|
||||
event.element.port_num = gw->port;
|
||||
event.event = IB_EVENT_GID_CHANGE;
|
||||
ib_dispatch_event(&event);
|
||||
mlx4_ib_dispatch_event(gw->dev, gw->port, IB_EVENT_GID_CHANGE);
|
||||
}
|
||||
|
||||
mlx4_free_cmd_mailbox(dev, mailbox);
|
||||
@@ -1432,10 +1428,18 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr)
|
||||
}
|
||||
|
||||
static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
|
||||
enum mlx4_dev_event event, int port)
|
||||
enum mlx4_dev_event event, unsigned long param)
|
||||
{
|
||||
struct ib_event ibev;
|
||||
struct mlx4_ib_dev *ibdev = to_mdev((struct ib_device *) ibdev_ptr);
|
||||
struct mlx4_eqe *eqe = NULL;
|
||||
struct ib_event_work *ew;
|
||||
int port = 0;
|
||||
|
||||
if (event == MLX4_DEV_EVENT_PORT_MGMT_CHANGE)
|
||||
eqe = (struct mlx4_eqe *)param;
|
||||
else
|
||||
port = (u8)param;
|
||||
|
||||
if (port > ibdev->num_ports)
|
||||
return;
|
||||
@@ -1454,6 +1458,19 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
|
||||
ibev.event = IB_EVENT_DEVICE_FATAL;
|
||||
break;
|
||||
|
||||
case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:
|
||||
ew = kmalloc(sizeof *ew, GFP_ATOMIC);
|
||||
if (!ew) {
|
||||
pr_err("failed to allocate memory for events work\n");
|
||||
break;
|
||||
}
|
||||
|
||||
INIT_WORK(&ew->work, handle_port_mgmt_change_event);
|
||||
memcpy(&ew->ib_eqe, eqe, sizeof *eqe);
|
||||
ew->ib_dev = ibdev;
|
||||
handle_port_mgmt_change_event(&ew->work);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,16 @@
|
||||
#include <linux/mlx4/device.h>
|
||||
#include <linux/mlx4/doorbell.h>
|
||||
|
||||
#define MLX4_IB_DRV_NAME "mlx4_ib"
|
||||
|
||||
#ifdef pr_fmt
|
||||
#undef pr_fmt
|
||||
#endif
|
||||
#define pr_fmt(fmt) "<" MLX4_IB_DRV_NAME "> %s: " fmt, __func__
|
||||
|
||||
#define mlx4_ib_warn(ibdev, format, arg...) \
|
||||
dev_warn((ibdev)->dma_device, MLX4_IB_DRV_NAME ": " format, ## arg)
|
||||
|
||||
enum {
|
||||
MLX4_IB_SQ_MIN_WQE_SHIFT = 6,
|
||||
MLX4_IB_MAX_HEADROOM = 2048
|
||||
@@ -215,6 +225,12 @@ struct mlx4_ib_dev {
|
||||
int eq_added;
|
||||
};
|
||||
|
||||
struct ib_event_work {
|
||||
struct work_struct work;
|
||||
struct mlx4_ib_dev *ib_dev;
|
||||
struct mlx4_eqe ib_eqe;
|
||||
};
|
||||
|
||||
static inline struct mlx4_ib_dev *to_mdev(struct ib_device *ibdev)
|
||||
{
|
||||
return container_of(ibdev, struct mlx4_ib_dev, ib_dev);
|
||||
@@ -372,4 +388,7 @@ static inline int mlx4_ib_ah_grh_present(struct mlx4_ib_ah *ah)
|
||||
int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp,
|
||||
union ib_gid *gid);
|
||||
|
||||
void mlx4_ib_dispatch_event(struct mlx4_ib_dev *dev, u8 port_num,
|
||||
enum ib_event_type type);
|
||||
|
||||
#endif /* MLX4_IB_H */
|
||||
|
||||
@@ -1336,11 +1336,21 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state;
|
||||
new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state;
|
||||
|
||||
if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask))
|
||||
if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) {
|
||||
pr_debug("qpn 0x%x: invalid attribute mask specified "
|
||||
"for transition %d to %d. qp_type %d,"
|
||||
" attr_mask 0x%x\n",
|
||||
ibqp->qp_num, cur_state, new_state,
|
||||
ibqp->qp_type, attr_mask);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((attr_mask & IB_QP_PORT) &&
|
||||
(attr->port_num == 0 || attr->port_num > dev->dev->caps.num_ports)) {
|
||||
pr_debug("qpn 0x%x: invalid port number (%d) specified "
|
||||
"for transition %d to %d. qp_type %d\n",
|
||||
ibqp->qp_num, attr->port_num, cur_state,
|
||||
new_state, ibqp->qp_type);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1351,17 +1361,30 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||
|
||||
if (attr_mask & IB_QP_PKEY_INDEX) {
|
||||
int p = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
|
||||
if (attr->pkey_index >= dev->dev->caps.pkey_table_len[p])
|
||||
if (attr->pkey_index >= dev->dev->caps.pkey_table_len[p]) {
|
||||
pr_debug("qpn 0x%x: invalid pkey index (%d) specified "
|
||||
"for transition %d to %d. qp_type %d\n",
|
||||
ibqp->qp_num, attr->pkey_index, cur_state,
|
||||
new_state, ibqp->qp_type);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC &&
|
||||
attr->max_rd_atomic > dev->dev->caps.max_qp_init_rdma) {
|
||||
pr_debug("qpn 0x%x: max_rd_atomic (%d) too large. "
|
||||
"Transition %d to %d. qp_type %d\n",
|
||||
ibqp->qp_num, attr->max_rd_atomic, cur_state,
|
||||
new_state, ibqp->qp_type);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC &&
|
||||
attr->max_dest_rd_atomic > dev->dev->caps.max_qp_dest_rdma) {
|
||||
pr_debug("qpn 0x%x: max_dest_rd_atomic (%d) too large. "
|
||||
"Transition %d to %d. qp_type %d\n",
|
||||
ibqp->qp_num, attr->max_dest_rd_atomic, cur_state,
|
||||
new_state, ibqp->qp_type);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,8 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
|
||||
spin_unlock(&dev->qp_table.lock);
|
||||
|
||||
if (!qp) {
|
||||
mthca_warn(dev, "Async event for bogus QP %08x\n", qpn);
|
||||
mthca_warn(dev, "Async event %d for bogus QP %08x\n",
|
||||
event_type, qpn);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -501,6 +502,7 @@ done:
|
||||
qp_attr->cap.max_inline_data = qp->max_inline_data;
|
||||
|
||||
qp_init_attr->cap = qp_attr->cap;
|
||||
qp_init_attr->sq_sig_type = qp->sq_policy;
|
||||
|
||||
out_mailbox:
|
||||
mthca_free_mailbox(dev, mailbox);
|
||||
|
||||
@@ -202,8 +202,7 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) || \
|
||||
defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6) || IS_ENABLED(CONFIG_VLAN_8021Q)
|
||||
|
||||
static int ocrdma_inet6addr_event(struct notifier_block *notifier,
|
||||
unsigned long event, void *ptr)
|
||||
@@ -549,7 +548,7 @@ static struct ocrdma_driver ocrdma_drv = {
|
||||
|
||||
static void ocrdma_unregister_inet6addr_notifier(void)
|
||||
{
|
||||
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
unregister_inet6addr_notifier(&ocrdma_inet6addr_notifier);
|
||||
#endif
|
||||
}
|
||||
@@ -558,7 +557,7 @@ static int __init ocrdma_init_module(void)
|
||||
{
|
||||
int status;
|
||||
|
||||
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
status = register_inet6addr_notifier(&ocrdma_inet6addr_notifier);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
@@ -97,7 +97,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr)
|
||||
min(dev->attr.max_ord_per_qp, dev->attr.max_ird_per_qp);
|
||||
attr->max_qp_init_rd_atom = dev->attr.max_ord_per_qp;
|
||||
attr->max_srq = (dev->attr.max_qp - 1);
|
||||
attr->max_srq_sge = attr->max_srq_sge;
|
||||
attr->max_srq_sge = dev->attr.max_srq_sge;
|
||||
attr->max_srq_wr = dev->attr.max_rqe;
|
||||
attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay;
|
||||
attr->max_fast_reg_page_list_len = 0;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef _QIB_KERNEL_H
|
||||
#define _QIB_KERNEL_H
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
@@ -519,6 +519,7 @@ struct qib_pportdata {
|
||||
struct qib_devdata *dd;
|
||||
struct qib_chippport_specific *cpspec; /* chip-specific per-port */
|
||||
struct kobject pport_kobj;
|
||||
struct kobject pport_cc_kobj;
|
||||
struct kobject sl2vl_kobj;
|
||||
struct kobject diagc_kobj;
|
||||
|
||||
@@ -544,6 +545,7 @@ struct qib_pportdata {
|
||||
|
||||
/* read mostly */
|
||||
struct qib_sdma_desc *sdma_descq;
|
||||
struct workqueue_struct *qib_wq;
|
||||
struct qib_sdma_state sdma_state;
|
||||
dma_addr_t sdma_descq_phys;
|
||||
volatile __le64 *sdma_head_dma; /* DMA'ed by chip */
|
||||
@@ -637,6 +639,39 @@ struct qib_pportdata {
|
||||
struct timer_list led_override_timer;
|
||||
struct xmit_wait cong_stats;
|
||||
struct timer_list symerr_clear_timer;
|
||||
|
||||
/* Synchronize access between driver writes and sysfs reads */
|
||||
spinlock_t cc_shadow_lock
|
||||
____cacheline_aligned_in_smp;
|
||||
|
||||
/* Shadow copy of the congestion control table */
|
||||
struct cc_table_shadow *ccti_entries_shadow;
|
||||
|
||||
/* Shadow copy of the congestion control entries */
|
||||
struct ib_cc_congestion_setting_attr_shadow *congestion_entries_shadow;
|
||||
|
||||
/* List of congestion control table entries */
|
||||
struct ib_cc_table_entry_shadow *ccti_entries;
|
||||
|
||||
/* 16 congestion entries with each entry corresponding to a SL */
|
||||
struct ib_cc_congestion_entry_shadow *congestion_entries;
|
||||
|
||||
/* Total number of congestion control table entries */
|
||||
u16 total_cct_entry;
|
||||
|
||||
/* Bit map identifying service level */
|
||||
u16 cc_sl_control_map;
|
||||
|
||||
/* maximum congestion control table index */
|
||||
u16 ccti_limit;
|
||||
|
||||
/* CA's max number of 64 entry units in the congestion control table */
|
||||
u8 cc_max_table_entries;
|
||||
|
||||
/* Maximum number of congestion control entries that the agent expects
|
||||
* the manager to send.
|
||||
*/
|
||||
u8 cc_supported_table_entries;
|
||||
};
|
||||
|
||||
/* Observers. Not to be taken lightly, possibly not to ship. */
|
||||
@@ -1077,6 +1112,7 @@ extern u32 qib_cpulist_count;
|
||||
extern unsigned long *qib_cpulist;
|
||||
|
||||
extern unsigned qib_wc_pat;
|
||||
extern unsigned qib_cc_table_size;
|
||||
int qib_init(struct qib_devdata *, int);
|
||||
int init_chip_wc_pat(struct qib_devdata *dd, u32);
|
||||
int qib_enable_wc(struct qib_devdata *dd);
|
||||
@@ -1267,6 +1303,11 @@ int qib_sdma_verbs_send(struct qib_pportdata *, struct qib_sge_state *,
|
||||
/* ppd->sdma_lock should be locked before calling this. */
|
||||
int qib_sdma_make_progress(struct qib_pportdata *dd);
|
||||
|
||||
static inline int qib_sdma_empty(const struct qib_pportdata *ppd)
|
||||
{
|
||||
return ppd->sdma_descq_added == ppd->sdma_descq_removed;
|
||||
}
|
||||
|
||||
/* must be called under qib_sdma_lock */
|
||||
static inline u16 qib_sdma_descq_freecnt(const struct qib_pportdata *ppd)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2010 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
@@ -53,6 +53,9 @@
|
||||
#include "qib.h"
|
||||
#include "qib_common.h"
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) QIB_DRV_NAME ": " fmt
|
||||
|
||||
/*
|
||||
* Each client that opens the diag device must read then write
|
||||
* offset 0, to prevent lossage from random cat or od. diag_state
|
||||
@@ -598,8 +601,8 @@ static ssize_t qib_diagpkt_write(struct file *fp,
|
||||
}
|
||||
tmpbuf = vmalloc(plen);
|
||||
if (!tmpbuf) {
|
||||
qib_devinfo(dd->pcidev, "Unable to allocate tmp buffer, "
|
||||
"failing\n");
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Unable to allocate tmp buffer, failing\n");
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
@@ -693,7 +696,7 @@ int qib_register_observer(struct qib_devdata *dd,
|
||||
ret = -ENOMEM;
|
||||
olp = vmalloc(sizeof *olp);
|
||||
if (!olp) {
|
||||
printk(KERN_ERR QIB_DRV_NAME ": vmalloc for observer failed\n");
|
||||
pr_err("vmalloc for observer failed\n");
|
||||
goto bail;
|
||||
}
|
||||
if (olp) {
|
||||
|
||||
@@ -764,8 +764,9 @@ int qib_reset_device(int unit)
|
||||
qib_devinfo(dd->pcidev, "Reset on unit %u requested\n", unit);
|
||||
|
||||
if (!dd->kregbase || !(dd->flags & QIB_PRESENT)) {
|
||||
qib_devinfo(dd->pcidev, "Invalid unit number %u or "
|
||||
"not initialized or not present\n", unit);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Invalid unit number %u or not initialized or not present\n",
|
||||
unit);
|
||||
ret = -ENXIO;
|
||||
goto bail;
|
||||
}
|
||||
@@ -802,11 +803,13 @@ int qib_reset_device(int unit)
|
||||
else
|
||||
ret = -EAGAIN;
|
||||
if (ret)
|
||||
qib_dev_err(dd, "Reinitialize unit %u after "
|
||||
"reset failed with %d\n", unit, ret);
|
||||
qib_dev_err(dd,
|
||||
"Reinitialize unit %u after reset failed with %d\n",
|
||||
unit, ret);
|
||||
else
|
||||
qib_devinfo(dd->pcidev, "Reinitialized unit %u after "
|
||||
"resetting\n", unit);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Reinitialized unit %u after resetting\n",
|
||||
unit);
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
@@ -160,10 +161,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
|
||||
if (oguid > bguid[7]) {
|
||||
if (bguid[6] == 0xff) {
|
||||
if (bguid[5] == 0xff) {
|
||||
qib_dev_err(dd, "Can't set %s GUID"
|
||||
" from base, wraps to"
|
||||
" OUI!\n",
|
||||
qib_get_unit_name(t));
|
||||
qib_dev_err(dd,
|
||||
"Can't set %s GUID from base, wraps to OUI!\n",
|
||||
qib_get_unit_name(t));
|
||||
dd->base_guid = 0;
|
||||
goto bail;
|
||||
}
|
||||
@@ -182,8 +182,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
|
||||
len = sizeof(struct qib_flash);
|
||||
buf = vmalloc(len);
|
||||
if (!buf) {
|
||||
qib_dev_err(dd, "Couldn't allocate memory to read %u "
|
||||
"bytes from eeprom for GUID\n", len);
|
||||
qib_dev_err(dd,
|
||||
"Couldn't allocate memory to read %u bytes from eeprom for GUID\n",
|
||||
len);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -201,23 +202,25 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
|
||||
|
||||
csum = flash_csum(ifp, 0);
|
||||
if (csum != ifp->if_csum) {
|
||||
qib_devinfo(dd->pcidev, "Bad I2C flash checksum: "
|
||||
"0x%x, not 0x%x\n", csum, ifp->if_csum);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Bad I2C flash checksum: 0x%x, not 0x%x\n",
|
||||
csum, ifp->if_csum);
|
||||
goto done;
|
||||
}
|
||||
if (*(__be64 *) ifp->if_guid == cpu_to_be64(0) ||
|
||||
*(__be64 *) ifp->if_guid == ~cpu_to_be64(0)) {
|
||||
qib_dev_err(dd, "Invalid GUID %llx from flash; ignoring\n",
|
||||
*(unsigned long long *) ifp->if_guid);
|
||||
qib_dev_err(dd,
|
||||
"Invalid GUID %llx from flash; ignoring\n",
|
||||
*(unsigned long long *) ifp->if_guid);
|
||||
/* don't allow GUID if all 0 or all 1's */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* complain, but allow it */
|
||||
if (*(u64 *) ifp->if_guid == 0x100007511000000ULL)
|
||||
qib_devinfo(dd->pcidev, "Warning, GUID %llx is "
|
||||
"default, probably not correct!\n",
|
||||
*(unsigned long long *) ifp->if_guid);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Warning, GUID %llx is default, probably not correct!\n",
|
||||
*(unsigned long long *) ifp->if_guid);
|
||||
|
||||
bguid = ifp->if_guid;
|
||||
if (!bguid[0] && !bguid[1] && !bguid[2]) {
|
||||
@@ -260,8 +263,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
|
||||
memcpy(dd->serial, ifp->if_serial,
|
||||
sizeof ifp->if_serial);
|
||||
if (!strstr(ifp->if_comment, "Tested successfully"))
|
||||
qib_dev_err(dd, "Board SN %s did not pass functional "
|
||||
"test: %s\n", dd->serial, ifp->if_comment);
|
||||
qib_dev_err(dd,
|
||||
"Board SN %s did not pass functional test: %s\n",
|
||||
dd->serial, ifp->if_comment);
|
||||
|
||||
memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT);
|
||||
/*
|
||||
@@ -323,8 +327,9 @@ int qib_update_eeprom_log(struct qib_devdata *dd)
|
||||
buf = vmalloc(len);
|
||||
ret = 1;
|
||||
if (!buf) {
|
||||
qib_dev_err(dd, "Couldn't allocate memory to read %u "
|
||||
"bytes from eeprom for logging\n", len);
|
||||
qib_dev_err(dd,
|
||||
"Couldn't allocate memory to read %u bytes from eeprom for logging\n",
|
||||
len);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
@@ -49,6 +49,9 @@
|
||||
#include "qib_common.h"
|
||||
#include "qib_user_sdma.h"
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) QIB_DRV_NAME ": " fmt
|
||||
|
||||
static int qib_open(struct inode *, struct file *);
|
||||
static int qib_close(struct inode *, struct file *);
|
||||
static ssize_t qib_write(struct file *, const char __user *, size_t, loff_t *);
|
||||
@@ -315,8 +318,9 @@ static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp,
|
||||
}
|
||||
if (cnt > tidcnt) {
|
||||
/* make sure it all fits in tid_pg_list */
|
||||
qib_devinfo(dd->pcidev, "Process tried to allocate %u "
|
||||
"TIDs, only trying max (%u)\n", cnt, tidcnt);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Process tried to allocate %u TIDs, only trying max (%u)\n",
|
||||
cnt, tidcnt);
|
||||
cnt = tidcnt;
|
||||
}
|
||||
pagep = (struct page **) rcd->tid_pg_list;
|
||||
@@ -750,9 +754,9 @@ static int qib_mmap_mem(struct vm_area_struct *vma, struct qib_ctxtdata *rcd,
|
||||
ret = remap_pfn_range(vma, vma->vm_start, pfn,
|
||||
len, vma->vm_page_prot);
|
||||
if (ret)
|
||||
qib_devinfo(dd->pcidev, "%s ctxt%u mmap of %lx, %x "
|
||||
"bytes failed: %d\n", what, rcd->ctxt,
|
||||
pfn, len, ret);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"%s ctxt%u mmap of %lx, %x bytes failed: %d\n",
|
||||
what, rcd->ctxt, pfn, len, ret);
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
@@ -771,8 +775,9 @@ static int mmap_ureg(struct vm_area_struct *vma, struct qib_devdata *dd,
|
||||
*/
|
||||
sz = dd->flags & QIB_HAS_HDRSUPP ? 2 * PAGE_SIZE : PAGE_SIZE;
|
||||
if ((vma->vm_end - vma->vm_start) > sz) {
|
||||
qib_devinfo(dd->pcidev, "FAIL mmap userreg: reqlen "
|
||||
"%lx > PAGE\n", vma->vm_end - vma->vm_start);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"FAIL mmap userreg: reqlen %lx > PAGE\n",
|
||||
vma->vm_end - vma->vm_start);
|
||||
ret = -EFAULT;
|
||||
} else {
|
||||
phys = dd->physaddr + ureg;
|
||||
@@ -802,8 +807,8 @@ static int mmap_piobufs(struct vm_area_struct *vma,
|
||||
* for it.
|
||||
*/
|
||||
if ((vma->vm_end - vma->vm_start) > (piocnt * dd->palign)) {
|
||||
qib_devinfo(dd->pcidev, "FAIL mmap piobufs: "
|
||||
"reqlen %lx > PAGE\n",
|
||||
qib_devinfo(dd->pcidev,
|
||||
"FAIL mmap piobufs: reqlen %lx > PAGE\n",
|
||||
vma->vm_end - vma->vm_start);
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
@@ -847,8 +852,8 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma,
|
||||
size = rcd->rcvegrbuf_size;
|
||||
total_size = rcd->rcvegrbuf_chunks * size;
|
||||
if ((vma->vm_end - vma->vm_start) > total_size) {
|
||||
qib_devinfo(dd->pcidev, "FAIL on egr bufs: "
|
||||
"reqlen %lx > actual %lx\n",
|
||||
qib_devinfo(dd->pcidev,
|
||||
"FAIL on egr bufs: reqlen %lx > actual %lx\n",
|
||||
vma->vm_end - vma->vm_start,
|
||||
(unsigned long) total_size);
|
||||
ret = -EINVAL;
|
||||
@@ -856,8 +861,9 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma,
|
||||
}
|
||||
|
||||
if (vma->vm_flags & VM_WRITE) {
|
||||
qib_devinfo(dd->pcidev, "Can't map eager buffers as "
|
||||
"writable (flags=%lx)\n", vma->vm_flags);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Can't map eager buffers as writable (flags=%lx)\n",
|
||||
vma->vm_flags);
|
||||
ret = -EPERM;
|
||||
goto bail;
|
||||
}
|
||||
@@ -1270,8 +1276,8 @@ static int setup_ctxt(struct qib_pportdata *ppd, int ctxt,
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!rcd || !ptmp) {
|
||||
qib_dev_err(dd, "Unable to allocate ctxtdata "
|
||||
"memory, failing open\n");
|
||||
qib_dev_err(dd,
|
||||
"Unable to allocate ctxtdata memory, failing open\n");
|
||||
ret = -ENOMEM;
|
||||
goto bailerr;
|
||||
}
|
||||
@@ -1560,10 +1566,10 @@ done_chk_sdma:
|
||||
} else if (weight == 1 &&
|
||||
test_bit(cpumask_first(tsk_cpus_allowed(current)),
|
||||
qib_cpulist))
|
||||
qib_devinfo(dd->pcidev, "%s PID %u affinity "
|
||||
"set to cpu %d; already allocated\n",
|
||||
current->comm, current->pid,
|
||||
cpumask_first(tsk_cpus_allowed(current)));
|
||||
qib_devinfo(dd->pcidev,
|
||||
"%s PID %u affinity set to cpu %d; already allocated\n",
|
||||
current->comm, current->pid,
|
||||
cpumask_first(tsk_cpus_allowed(current)));
|
||||
}
|
||||
|
||||
mutex_unlock(&qib_mutex);
|
||||
@@ -2185,8 +2191,7 @@ int qib_cdev_init(int minor, const char *name,
|
||||
|
||||
cdev = cdev_alloc();
|
||||
if (!cdev) {
|
||||
printk(KERN_ERR QIB_DRV_NAME
|
||||
": Could not allocate cdev for minor %d, %s\n",
|
||||
pr_err("Could not allocate cdev for minor %d, %s\n",
|
||||
minor, name);
|
||||
ret = -ENOMEM;
|
||||
goto done;
|
||||
@@ -2198,8 +2203,7 @@ int qib_cdev_init(int minor, const char *name,
|
||||
|
||||
ret = cdev_add(cdev, dev, 1);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR QIB_DRV_NAME
|
||||
": Could not add cdev for minor %d, %s (err %d)\n",
|
||||
pr_err("Could not add cdev for minor %d, %s (err %d)\n",
|
||||
minor, name, -ret);
|
||||
goto err_cdev;
|
||||
}
|
||||
@@ -2209,8 +2213,7 @@ int qib_cdev_init(int minor, const char *name,
|
||||
goto done;
|
||||
ret = PTR_ERR(device);
|
||||
device = NULL;
|
||||
printk(KERN_ERR QIB_DRV_NAME ": Could not create "
|
||||
"device for minor %d, %s (err %d)\n",
|
||||
pr_err("Could not create device for minor %d, %s (err %d)\n",
|
||||
minor, name, -ret);
|
||||
err_cdev:
|
||||
cdev_del(cdev);
|
||||
@@ -2245,16 +2248,14 @@ int __init qib_dev_init(void)
|
||||
|
||||
ret = alloc_chrdev_region(&qib_dev, 0, QIB_NMINORS, QIB_DRV_NAME);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR QIB_DRV_NAME ": Could not allocate "
|
||||
"chrdev region (err %d)\n", -ret);
|
||||
pr_err("Could not allocate chrdev region (err %d)\n", -ret);
|
||||
goto done;
|
||||
}
|
||||
|
||||
qib_class = class_create(THIS_MODULE, "ipath");
|
||||
if (IS_ERR(qib_class)) {
|
||||
ret = PTR_ERR(qib_class);
|
||||
printk(KERN_ERR QIB_DRV_NAME ": Could not create "
|
||||
"device class (err %d)\n", -ret);
|
||||
pr_err("Could not create device class (err %d)\n", -ret);
|
||||
unregister_chrdev_region(qib_dev, QIB_NMINORS);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
@@ -382,7 +383,7 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
|
||||
ret = create_file(unit, S_IFDIR|S_IRUGO|S_IXUGO, sb->s_root, &dir,
|
||||
&simple_dir_operations, dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s) failed: %d\n", unit, ret);
|
||||
pr_err("create_file(%s) failed: %d\n", unit, ret);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -390,21 +391,21 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
|
||||
ret = create_file("counters", S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&cntr_ops[0], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/counters) failed: %d\n",
|
||||
pr_err("create_file(%s/counters) failed: %d\n",
|
||||
unit, ret);
|
||||
goto bail;
|
||||
}
|
||||
ret = create_file("counter_names", S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&cntr_ops[1], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/counter_names) failed: %d\n",
|
||||
pr_err("create_file(%s/counter_names) failed: %d\n",
|
||||
unit, ret);
|
||||
goto bail;
|
||||
}
|
||||
ret = create_file("portcounter_names", S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&portcntr_ops[0], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/%s) failed: %d\n",
|
||||
pr_err("create_file(%s/%s) failed: %d\n",
|
||||
unit, "portcounter_names", ret);
|
||||
goto bail;
|
||||
}
|
||||
@@ -416,7 +417,7 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
|
||||
ret = create_file(fname, S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&portcntr_ops[i], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/%s) failed: %d\n",
|
||||
pr_err("create_file(%s/%s) failed: %d\n",
|
||||
unit, fname, ret);
|
||||
goto bail;
|
||||
}
|
||||
@@ -426,7 +427,7 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
|
||||
ret = create_file(fname, S_IFREG|S_IRUGO, dir, &tmp,
|
||||
&qsfp_ops[i - 1], dd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "create_file(%s/%s) failed: %d\n",
|
||||
pr_err("create_file(%s/%s) failed: %d\n",
|
||||
unit, fname, ret);
|
||||
goto bail;
|
||||
}
|
||||
@@ -435,7 +436,7 @@ static int add_cntr_files(struct super_block *sb, struct qib_devdata *dd)
|
||||
ret = create_file("flash", S_IFREG|S_IWUSR|S_IRUGO, dir, &tmp,
|
||||
&flash_ops, dd);
|
||||
if (ret)
|
||||
printk(KERN_ERR "create_file(%s/flash) failed: %d\n",
|
||||
pr_err("create_file(%s/flash) failed: %d\n",
|
||||
unit, ret);
|
||||
bail:
|
||||
return ret;
|
||||
@@ -486,7 +487,7 @@ static int remove_device_files(struct super_block *sb,
|
||||
|
||||
if (IS_ERR(dir)) {
|
||||
ret = PTR_ERR(dir);
|
||||
printk(KERN_ERR "Lookup of %s failed\n", unit);
|
||||
pr_err("Lookup of %s failed\n", unit);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -532,7 +533,7 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
|
||||
ret = simple_fill_super(sb, QIBFS_MAGIC, files);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "simple_fill_super failed: %d\n", ret);
|
||||
pr_err("simple_fill_super failed: %d\n", ret);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
||||
@@ -753,8 +753,8 @@ static void qib_handle_6120_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
if (!hwerrs)
|
||||
return;
|
||||
if (hwerrs == ~0ULL) {
|
||||
qib_dev_err(dd, "Read of hardware error status failed "
|
||||
"(all bits set); ignoring\n");
|
||||
qib_dev_err(dd,
|
||||
"Read of hardware error status failed (all bits set); ignoring\n");
|
||||
return;
|
||||
}
|
||||
qib_stats.sps_hwerrs++;
|
||||
@@ -779,13 +779,14 @@ static void qib_handle_6120_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
* or it's occurred within the last 5 seconds.
|
||||
*/
|
||||
if (hwerrs & ~(TXE_PIO_PARITY | RXEMEMPARITYERR_EAGERTID))
|
||||
qib_devinfo(dd->pcidev, "Hardware error: hwerr=0x%llx "
|
||||
"(cleared)\n", (unsigned long long) hwerrs);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Hardware error: hwerr=0x%llx (cleared)\n",
|
||||
(unsigned long long) hwerrs);
|
||||
|
||||
if (hwerrs & ~IB_HWE_BITSEXTANT)
|
||||
qib_dev_err(dd, "hwerror interrupt with unknown errors "
|
||||
"%llx set\n", (unsigned long long)
|
||||
(hwerrs & ~IB_HWE_BITSEXTANT));
|
||||
qib_dev_err(dd,
|
||||
"hwerror interrupt with unknown errors %llx set\n",
|
||||
(unsigned long long)(hwerrs & ~IB_HWE_BITSEXTANT));
|
||||
|
||||
ctrl = qib_read_kreg32(dd, kr_control);
|
||||
if ((ctrl & QLOGIC_IB_C_FREEZEMODE) && !dd->diag_client) {
|
||||
@@ -815,8 +816,9 @@ static void qib_handle_6120_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
|
||||
if (hwerrs & HWE_MASK(PowerOnBISTFailed)) {
|
||||
isfatal = 1;
|
||||
strlcat(msg, "[Memory BIST test failed, InfiniPath hardware"
|
||||
" unusable]", msgl);
|
||||
strlcat(msg,
|
||||
"[Memory BIST test failed, InfiniPath hardware unusable]",
|
||||
msgl);
|
||||
/* ignore from now on, so disable until driver reloaded */
|
||||
dd->cspec->hwerrmask &= ~HWE_MASK(PowerOnBISTFailed);
|
||||
qib_write_kreg(dd, kr_hwerrmask, dd->cspec->hwerrmask);
|
||||
@@ -868,8 +870,9 @@ static void qib_handle_6120_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
*msg = 0; /* recovered from all of them */
|
||||
|
||||
if (isfatal && !dd->diag_client) {
|
||||
qib_dev_err(dd, "Fatal Hardware Error, no longer"
|
||||
" usable, SN %.16s\n", dd->serial);
|
||||
qib_dev_err(dd,
|
||||
"Fatal Hardware Error, no longer usable, SN %.16s\n",
|
||||
dd->serial);
|
||||
/*
|
||||
* for /sys status file and user programs to print; if no
|
||||
* trailing brace is copied, we'll know it was truncated.
|
||||
@@ -1017,9 +1020,9 @@ static void handle_6120_errors(struct qib_devdata *dd, u64 errs)
|
||||
qib_inc_eeprom_err(dd, log_idx, 1);
|
||||
|
||||
if (errs & ~IB_E_BITSEXTANT)
|
||||
qib_dev_err(dd, "error interrupt with unknown errors "
|
||||
"%llx set\n",
|
||||
(unsigned long long) (errs & ~IB_E_BITSEXTANT));
|
||||
qib_dev_err(dd,
|
||||
"error interrupt with unknown errors %llx set\n",
|
||||
(unsigned long long) (errs & ~IB_E_BITSEXTANT));
|
||||
|
||||
if (errs & E_SUM_ERRS) {
|
||||
qib_disarm_6120_senderrbufs(ppd);
|
||||
@@ -1089,8 +1092,8 @@ static void handle_6120_errors(struct qib_devdata *dd, u64 errs)
|
||||
}
|
||||
|
||||
if (errs & ERR_MASK(ResetNegated)) {
|
||||
qib_dev_err(dd, "Got reset, requires re-init "
|
||||
"(unload and reload driver)\n");
|
||||
qib_dev_err(dd,
|
||||
"Got reset, requires re-init (unload and reload driver)\n");
|
||||
dd->flags &= ~QIB_INITTED; /* needs re-init */
|
||||
/* mark as having had error */
|
||||
*dd->devstatusp |= QIB_STATUS_HWERROR;
|
||||
@@ -1541,8 +1544,9 @@ static noinline void unlikely_6120_intr(struct qib_devdata *dd, u64 istat)
|
||||
qib_stats.sps_errints++;
|
||||
estat = qib_read_kreg64(dd, kr_errstatus);
|
||||
if (!estat)
|
||||
qib_devinfo(dd->pcidev, "error interrupt (%Lx), "
|
||||
"but no error bits set!\n", istat);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"error interrupt (%Lx), but no error bits set!\n",
|
||||
istat);
|
||||
handle_6120_errors(dd, estat);
|
||||
}
|
||||
|
||||
@@ -1715,16 +1719,16 @@ static void qib_setup_6120_interrupt(struct qib_devdata *dd)
|
||||
}
|
||||
|
||||
if (!dd->cspec->irq)
|
||||
qib_dev_err(dd, "irq is 0, BIOS error? Interrupts won't "
|
||||
"work\n");
|
||||
qib_dev_err(dd,
|
||||
"irq is 0, BIOS error? Interrupts won't work\n");
|
||||
else {
|
||||
int ret;
|
||||
ret = request_irq(dd->cspec->irq, qib_6120intr, 0,
|
||||
QIB_DRV_NAME, dd);
|
||||
if (ret)
|
||||
qib_dev_err(dd, "Couldn't setup interrupt "
|
||||
"(irq=%d): %d\n", dd->cspec->irq,
|
||||
ret);
|
||||
qib_dev_err(dd,
|
||||
"Couldn't setup interrupt (irq=%d): %d\n",
|
||||
dd->cspec->irq, ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1759,8 +1763,9 @@ static void pe_boardname(struct qib_devdata *dd)
|
||||
snprintf(dd->boardname, namelen, "%s", n);
|
||||
|
||||
if (dd->majrev != 4 || !dd->minrev || dd->minrev > 2)
|
||||
qib_dev_err(dd, "Unsupported InfiniPath hardware revision "
|
||||
"%u.%u!\n", dd->majrev, dd->minrev);
|
||||
qib_dev_err(dd,
|
||||
"Unsupported InfiniPath hardware revision %u.%u!\n",
|
||||
dd->majrev, dd->minrev);
|
||||
|
||||
snprintf(dd->boardversion, sizeof(dd->boardversion),
|
||||
"ChipABI %u.%u, %s, InfiniPath%u %u.%u, SW Compat %u\n",
|
||||
@@ -1833,8 +1838,8 @@ static int qib_6120_setup_reset(struct qib_devdata *dd)
|
||||
bail:
|
||||
if (ret) {
|
||||
if (qib_pcie_params(dd, dd->lbus_width, NULL, NULL))
|
||||
qib_dev_err(dd, "Reset failed to setup PCIe or "
|
||||
"interrupts; continuing anyway\n");
|
||||
qib_dev_err(dd,
|
||||
"Reset failed to setup PCIe or interrupts; continuing anyway\n");
|
||||
/* clear the reset error, init error/hwerror mask */
|
||||
qib_6120_init_hwerrors(dd);
|
||||
/* for Rev2 error interrupts; nop for rev 1 */
|
||||
@@ -1876,8 +1881,9 @@ static void qib_6120_put_tid(struct qib_devdata *dd, u64 __iomem *tidptr,
|
||||
}
|
||||
pa >>= 11;
|
||||
if (pa & ~QLOGIC_IB_RT_ADDR_MASK) {
|
||||
qib_dev_err(dd, "Physical page address 0x%lx "
|
||||
"larger than supported\n", pa);
|
||||
qib_dev_err(dd,
|
||||
"Physical page address 0x%lx larger than supported\n",
|
||||
pa);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1941,8 +1947,9 @@ static void qib_6120_put_tid_2(struct qib_devdata *dd, u64 __iomem *tidptr,
|
||||
}
|
||||
pa >>= 11;
|
||||
if (pa & ~QLOGIC_IB_RT_ADDR_MASK) {
|
||||
qib_dev_err(dd, "Physical page address 0x%lx "
|
||||
"larger than supported\n", pa);
|
||||
qib_dev_err(dd,
|
||||
"Physical page address 0x%lx larger than supported\n",
|
||||
pa);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2928,8 +2935,9 @@ static int qib_6120_set_loopback(struct qib_pportdata *ppd, const char *what)
|
||||
ppd->dd->unit, ppd->port);
|
||||
} else if (!strncmp(what, "off", 3)) {
|
||||
ppd->dd->cspec->ibcctrl &= ~SYM_MASK(IBCCtrl, Loopback);
|
||||
qib_devinfo(ppd->dd->pcidev, "Disabling IB%u:%u IBC loopback "
|
||||
"(normal)\n", ppd->dd->unit, ppd->port);
|
||||
qib_devinfo(ppd->dd->pcidev,
|
||||
"Disabling IB%u:%u IBC loopback (normal)\n",
|
||||
ppd->dd->unit, ppd->port);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
if (!ret) {
|
||||
@@ -3186,11 +3194,10 @@ static int qib_late_6120_initreg(struct qib_devdata *dd)
|
||||
qib_write_kreg(dd, kr_sendpioavailaddr, dd->pioavailregs_phys);
|
||||
val = qib_read_kreg64(dd, kr_sendpioavailaddr);
|
||||
if (val != dd->pioavailregs_phys) {
|
||||
qib_dev_err(dd, "Catastrophic software error, "
|
||||
"SendPIOAvailAddr written as %lx, "
|
||||
"read back as %llx\n",
|
||||
(unsigned long) dd->pioavailregs_phys,
|
||||
(unsigned long long) val);
|
||||
qib_dev_err(dd,
|
||||
"Catastrophic software error, SendPIOAvailAddr written as %lx, read back as %llx\n",
|
||||
(unsigned long) dd->pioavailregs_phys,
|
||||
(unsigned long long) val);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
return ret;
|
||||
@@ -3218,8 +3225,8 @@ static int init_6120_variables(struct qib_devdata *dd)
|
||||
dd->revision = readq(&dd->kregbase[kr_revision]);
|
||||
|
||||
if ((dd->revision & 0xffffffffU) == 0xffffffffU) {
|
||||
qib_dev_err(dd, "Revision register read failure, "
|
||||
"giving up initialization\n");
|
||||
qib_dev_err(dd,
|
||||
"Revision register read failure, giving up initialization\n");
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
@@ -3551,8 +3558,8 @@ struct qib_devdata *qib_init_iba6120_funcs(struct pci_dev *pdev,
|
||||
goto bail;
|
||||
|
||||
if (qib_pcie_params(dd, 8, NULL, NULL))
|
||||
qib_dev_err(dd, "Failed to setup PCIe or interrupts; "
|
||||
"continuing anyway\n");
|
||||
qib_dev_err(dd,
|
||||
"Failed to setup PCIe or interrupts; continuing anyway\n");
|
||||
dd->cspec->irq = pdev->irq; /* save IRQ */
|
||||
|
||||
/* clear diagctrl register, in case diags were running and crashed */
|
||||
|
||||
@@ -1111,9 +1111,9 @@ static void handle_7220_errors(struct qib_devdata *dd, u64 errs)
|
||||
sdma_7220_errors(ppd, errs);
|
||||
|
||||
if (errs & ~IB_E_BITSEXTANT)
|
||||
qib_dev_err(dd, "error interrupt with unknown errors "
|
||||
"%llx set\n", (unsigned long long)
|
||||
(errs & ~IB_E_BITSEXTANT));
|
||||
qib_dev_err(dd,
|
||||
"error interrupt with unknown errors %llx set\n",
|
||||
(unsigned long long) (errs & ~IB_E_BITSEXTANT));
|
||||
|
||||
if (errs & E_SUM_ERRS) {
|
||||
qib_disarm_7220_senderrbufs(ppd);
|
||||
@@ -1192,8 +1192,8 @@ static void handle_7220_errors(struct qib_devdata *dd, u64 errs)
|
||||
}
|
||||
|
||||
if (errs & ERR_MASK(ResetNegated)) {
|
||||
qib_dev_err(dd, "Got reset, requires re-init "
|
||||
"(unload and reload driver)\n");
|
||||
qib_dev_err(dd,
|
||||
"Got reset, requires re-init (unload and reload driver)\n");
|
||||
dd->flags &= ~QIB_INITTED; /* needs re-init */
|
||||
/* mark as having had error */
|
||||
*dd->devstatusp |= QIB_STATUS_HWERROR;
|
||||
@@ -1305,8 +1305,8 @@ static void qib_7220_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
if (!hwerrs)
|
||||
goto bail;
|
||||
if (hwerrs == ~0ULL) {
|
||||
qib_dev_err(dd, "Read of hardware error status failed "
|
||||
"(all bits set); ignoring\n");
|
||||
qib_dev_err(dd,
|
||||
"Read of hardware error status failed (all bits set); ignoring\n");
|
||||
goto bail;
|
||||
}
|
||||
qib_stats.sps_hwerrs++;
|
||||
@@ -1329,13 +1329,14 @@ static void qib_7220_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
qib_inc_eeprom_err(dd, log_idx, 1);
|
||||
if (hwerrs & ~(TXEMEMPARITYERR_PIOBUF | TXEMEMPARITYERR_PIOPBC |
|
||||
RXE_PARITY))
|
||||
qib_devinfo(dd->pcidev, "Hardware error: hwerr=0x%llx "
|
||||
"(cleared)\n", (unsigned long long) hwerrs);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Hardware error: hwerr=0x%llx (cleared)\n",
|
||||
(unsigned long long) hwerrs);
|
||||
|
||||
if (hwerrs & ~IB_HWE_BITSEXTANT)
|
||||
qib_dev_err(dd, "hwerror interrupt with unknown errors "
|
||||
"%llx set\n", (unsigned long long)
|
||||
(hwerrs & ~IB_HWE_BITSEXTANT));
|
||||
qib_dev_err(dd,
|
||||
"hwerror interrupt with unknown errors %llx set\n",
|
||||
(unsigned long long) (hwerrs & ~IB_HWE_BITSEXTANT));
|
||||
|
||||
if (hwerrs & QLOGIC_IB_HWE_IB_UC_MEMORYPARITYERR)
|
||||
qib_sd7220_clr_ibpar(dd);
|
||||
@@ -1362,8 +1363,9 @@ static void qib_7220_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
|
||||
if (hwerrs & HWE_MASK(PowerOnBISTFailed)) {
|
||||
isfatal = 1;
|
||||
strlcat(msg, "[Memory BIST test failed, "
|
||||
"InfiniPath hardware unusable]", msgl);
|
||||
strlcat(msg,
|
||||
"[Memory BIST test failed, InfiniPath hardware unusable]",
|
||||
msgl);
|
||||
/* ignore from now on, so disable until driver reloaded */
|
||||
dd->cspec->hwerrmask &= ~HWE_MASK(PowerOnBISTFailed);
|
||||
qib_write_kreg(dd, kr_hwerrmask, dd->cspec->hwerrmask);
|
||||
@@ -1409,8 +1411,9 @@ static void qib_7220_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
qib_dev_err(dd, "%s hardware error\n", msg);
|
||||
|
||||
if (isfatal && !dd->diag_client) {
|
||||
qib_dev_err(dd, "Fatal Hardware Error, no longer"
|
||||
" usable, SN %.16s\n", dd->serial);
|
||||
qib_dev_err(dd,
|
||||
"Fatal Hardware Error, no longer usable, SN %.16s\n",
|
||||
dd->serial);
|
||||
/*
|
||||
* For /sys status file and user programs to print; if no
|
||||
* trailing brace is copied, we'll know it was truncated.
|
||||
@@ -1918,8 +1921,9 @@ static noinline void unlikely_7220_intr(struct qib_devdata *dd, u64 istat)
|
||||
qib_stats.sps_errints++;
|
||||
estat = qib_read_kreg64(dd, kr_errstatus);
|
||||
if (!estat)
|
||||
qib_devinfo(dd->pcidev, "error interrupt (%Lx), "
|
||||
"but no error bits set!\n", istat);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"error interrupt (%Lx), but no error bits set!\n",
|
||||
istat);
|
||||
else
|
||||
handle_7220_errors(dd, estat);
|
||||
}
|
||||
@@ -2023,17 +2027,18 @@ bail:
|
||||
static void qib_setup_7220_interrupt(struct qib_devdata *dd)
|
||||
{
|
||||
if (!dd->cspec->irq)
|
||||
qib_dev_err(dd, "irq is 0, BIOS error? Interrupts won't "
|
||||
"work\n");
|
||||
qib_dev_err(dd,
|
||||
"irq is 0, BIOS error? Interrupts won't work\n");
|
||||
else {
|
||||
int ret = request_irq(dd->cspec->irq, qib_7220intr,
|
||||
dd->msi_lo ? 0 : IRQF_SHARED,
|
||||
QIB_DRV_NAME, dd);
|
||||
|
||||
if (ret)
|
||||
qib_dev_err(dd, "Couldn't setup %s interrupt "
|
||||
"(irq=%d): %d\n", dd->msi_lo ?
|
||||
"MSI" : "INTx", dd->cspec->irq, ret);
|
||||
qib_dev_err(dd,
|
||||
"Couldn't setup %s interrupt (irq=%d): %d\n",
|
||||
dd->msi_lo ? "MSI" : "INTx",
|
||||
dd->cspec->irq, ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2072,9 +2077,9 @@ static void qib_7220_boardname(struct qib_devdata *dd)
|
||||
snprintf(dd->boardname, namelen, "%s", n);
|
||||
|
||||
if (dd->majrev != 5 || !dd->minrev || dd->minrev > 2)
|
||||
qib_dev_err(dd, "Unsupported InfiniPath hardware "
|
||||
"revision %u.%u!\n",
|
||||
dd->majrev, dd->minrev);
|
||||
qib_dev_err(dd,
|
||||
"Unsupported InfiniPath hardware revision %u.%u!\n",
|
||||
dd->majrev, dd->minrev);
|
||||
|
||||
snprintf(dd->boardversion, sizeof(dd->boardversion),
|
||||
"ChipABI %u.%u, %s, InfiniPath%u %u.%u, SW Compat %u\n",
|
||||
@@ -2146,8 +2151,8 @@ static int qib_setup_7220_reset(struct qib_devdata *dd)
|
||||
bail:
|
||||
if (ret) {
|
||||
if (qib_pcie_params(dd, dd->lbus_width, NULL, NULL))
|
||||
qib_dev_err(dd, "Reset failed to setup PCIe or "
|
||||
"interrupts; continuing anyway\n");
|
||||
qib_dev_err(dd,
|
||||
"Reset failed to setup PCIe or interrupts; continuing anyway\n");
|
||||
|
||||
/* hold IBC in reset, no sends, etc till later */
|
||||
qib_write_kreg(dd, kr_control, 0ULL);
|
||||
@@ -2187,8 +2192,9 @@ static void qib_7220_put_tid(struct qib_devdata *dd, u64 __iomem *tidptr,
|
||||
return;
|
||||
}
|
||||
if (chippa >= (1UL << IBA7220_TID_SZ_SHIFT)) {
|
||||
qib_dev_err(dd, "Physical page address 0x%lx "
|
||||
"larger than supported\n", pa);
|
||||
qib_dev_err(dd,
|
||||
"Physical page address 0x%lx larger than supported\n",
|
||||
pa);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2706,8 +2712,9 @@ static int qib_7220_set_loopback(struct qib_pportdata *ppd, const char *what)
|
||||
ppd->cpspec->ibcctrl &= ~SYM_MASK(IBCCtrl, Loopback);
|
||||
/* enable heart beat again */
|
||||
val = IBA7220_IBC_HRTBT_MASK << IBA7220_IBC_HRTBT_SHIFT;
|
||||
qib_devinfo(ppd->dd->pcidev, "Disabling IB%u:%u IBC loopback "
|
||||
"(normal)\n", ppd->dd->unit, ppd->port);
|
||||
qib_devinfo(ppd->dd->pcidev,
|
||||
"Disabling IB%u:%u IBC loopback (normal)\n",
|
||||
ppd->dd->unit, ppd->port);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
if (!ret) {
|
||||
@@ -3307,8 +3314,8 @@ static int qib_7220_intr_fallback(struct qib_devdata *dd)
|
||||
if (!dd->msi_lo)
|
||||
return 0;
|
||||
|
||||
qib_devinfo(dd->pcidev, "MSI interrupt not detected,"
|
||||
" trying INTx interrupts\n");
|
||||
qib_devinfo(dd->pcidev,
|
||||
"MSI interrupt not detected, trying INTx interrupts\n");
|
||||
qib_7220_free_irq(dd);
|
||||
qib_enable_intx(dd->pcidev);
|
||||
/*
|
||||
@@ -3980,11 +3987,10 @@ static int qib_late_7220_initreg(struct qib_devdata *dd)
|
||||
qib_write_kreg(dd, kr_sendpioavailaddr, dd->pioavailregs_phys);
|
||||
val = qib_read_kreg64(dd, kr_sendpioavailaddr);
|
||||
if (val != dd->pioavailregs_phys) {
|
||||
qib_dev_err(dd, "Catastrophic software error, "
|
||||
"SendPIOAvailAddr written as %lx, "
|
||||
"read back as %llx\n",
|
||||
(unsigned long) dd->pioavailregs_phys,
|
||||
(unsigned long long) val);
|
||||
qib_dev_err(dd,
|
||||
"Catastrophic software error, SendPIOAvailAddr written as %lx, read back as %llx\n",
|
||||
(unsigned long) dd->pioavailregs_phys,
|
||||
(unsigned long long) val);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
qib_register_observer(dd, &sendctrl_observer);
|
||||
@@ -4014,8 +4020,8 @@ static int qib_init_7220_variables(struct qib_devdata *dd)
|
||||
dd->revision = readq(&dd->kregbase[kr_revision]);
|
||||
|
||||
if ((dd->revision & 0xffffffffU) == 0xffffffffU) {
|
||||
qib_dev_err(dd, "Revision register read failure, "
|
||||
"giving up initialization\n");
|
||||
qib_dev_err(dd,
|
||||
"Revision register read failure, giving up initialization\n");
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
@@ -4613,8 +4619,8 @@ struct qib_devdata *qib_init_iba7220_funcs(struct pci_dev *pdev,
|
||||
break;
|
||||
}
|
||||
if (qib_pcie_params(dd, minwidth, NULL, NULL))
|
||||
qib_dev_err(dd, "Failed to setup PCIe or interrupts; "
|
||||
"continuing anyway\n");
|
||||
qib_dev_err(dd,
|
||||
"Failed to setup PCIe or interrupts; continuing anyway\n");
|
||||
|
||||
/* save IRQ for possible later use */
|
||||
dd->cspec->irq = pdev->irq;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2008 - 2012 QLogic Corporation. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
@@ -49,6 +50,10 @@
|
||||
#include "qib_qsfp.h"
|
||||
|
||||
#include "qib_mad.h"
|
||||
#include "qib_verbs.h"
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) QIB_DRV_NAME " " fmt
|
||||
|
||||
static void qib_setup_7322_setextled(struct qib_pportdata *, u32);
|
||||
static void qib_7322_handle_hwerrors(struct qib_devdata *, char *, size_t);
|
||||
@@ -1575,8 +1580,8 @@ static noinline void handle_7322_errors(struct qib_devdata *dd)
|
||||
qib_stats.sps_errints++;
|
||||
errs = qib_read_kreg64(dd, kr_errstatus);
|
||||
if (!errs) {
|
||||
qib_devinfo(dd->pcidev, "device error interrupt, "
|
||||
"but no error bits set!\n");
|
||||
qib_devinfo(dd->pcidev,
|
||||
"device error interrupt, but no error bits set!\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -1622,8 +1627,8 @@ static noinline void handle_7322_errors(struct qib_devdata *dd)
|
||||
if (errs & QIB_E_RESET) {
|
||||
int pidx;
|
||||
|
||||
qib_dev_err(dd, "Got reset, requires re-init "
|
||||
"(unload and reload driver)\n");
|
||||
qib_dev_err(dd,
|
||||
"Got reset, requires re-init (unload and reload driver)\n");
|
||||
dd->flags &= ~QIB_INITTED; /* needs re-init */
|
||||
/* mark as having had error */
|
||||
*dd->devstatusp |= QIB_STATUS_HWERROR;
|
||||
@@ -1760,9 +1765,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
|
||||
ppd->dd->cspec->r1 ?
|
||||
QDR_STATIC_ADAPT_DOWN_R1 :
|
||||
QDR_STATIC_ADAPT_DOWN);
|
||||
printk(KERN_INFO QIB_DRV_NAME
|
||||
" IB%u:%u re-enabled QDR adaptation "
|
||||
"ibclt %x\n", ppd->dd->unit, ppd->port, ibclt);
|
||||
pr_info(
|
||||
"IB%u:%u re-enabled QDR adaptation ibclt %x\n",
|
||||
ppd->dd->unit, ppd->port, ibclt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1804,9 +1809,9 @@ static noinline void handle_7322_p_errors(struct qib_pportdata *ppd)
|
||||
if (!*msg)
|
||||
snprintf(msg, sizeof ppd->cpspec->epmsgbuf,
|
||||
"no others");
|
||||
qib_dev_porterr(dd, ppd->port, "error interrupt with unknown"
|
||||
" errors 0x%016Lx set (and %s)\n",
|
||||
(errs & ~QIB_E_P_BITSEXTANT), msg);
|
||||
qib_dev_porterr(dd, ppd->port,
|
||||
"error interrupt with unknown errors 0x%016Lx set (and %s)\n",
|
||||
(errs & ~QIB_E_P_BITSEXTANT), msg);
|
||||
*msg = '\0';
|
||||
}
|
||||
|
||||
@@ -2024,8 +2029,8 @@ static void qib_7322_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
if (!hwerrs)
|
||||
goto bail;
|
||||
if (hwerrs == ~0ULL) {
|
||||
qib_dev_err(dd, "Read of hardware error status failed "
|
||||
"(all bits set); ignoring\n");
|
||||
qib_dev_err(dd,
|
||||
"Read of hardware error status failed (all bits set); ignoring\n");
|
||||
goto bail;
|
||||
}
|
||||
qib_stats.sps_hwerrs++;
|
||||
@@ -2039,8 +2044,9 @@ static void qib_7322_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
/* no EEPROM logging, yet */
|
||||
|
||||
if (hwerrs)
|
||||
qib_devinfo(dd->pcidev, "Hardware error: hwerr=0x%llx "
|
||||
"(cleared)\n", (unsigned long long) hwerrs);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"Hardware error: hwerr=0x%llx (cleared)\n",
|
||||
(unsigned long long) hwerrs);
|
||||
|
||||
ctrl = qib_read_kreg32(dd, kr_control);
|
||||
if ((ctrl & SYM_MASK(Control, FreezeMode)) && !dd->diag_client) {
|
||||
@@ -2064,8 +2070,9 @@ static void qib_7322_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
|
||||
if (hwerrs & HWE_MASK(PowerOnBISTFailed)) {
|
||||
isfatal = 1;
|
||||
strlcpy(msg, "[Memory BIST test failed, "
|
||||
"InfiniPath hardware unusable]", msgl);
|
||||
strlcpy(msg,
|
||||
"[Memory BIST test failed, InfiniPath hardware unusable]",
|
||||
msgl);
|
||||
/* ignore from now on, so disable until driver reloaded */
|
||||
dd->cspec->hwerrmask &= ~HWE_MASK(PowerOnBISTFailed);
|
||||
qib_write_kreg(dd, kr_hwerrmask, dd->cspec->hwerrmask);
|
||||
@@ -2078,8 +2085,9 @@ static void qib_7322_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
||||
qib_dev_err(dd, "%s hardware error\n", msg);
|
||||
|
||||
if (isfatal && !dd->diag_client) {
|
||||
qib_dev_err(dd, "Fatal Hardware Error, no longer"
|
||||
" usable, SN %.16s\n", dd->serial);
|
||||
qib_dev_err(dd,
|
||||
"Fatal Hardware Error, no longer usable, SN %.16s\n",
|
||||
dd->serial);
|
||||
/*
|
||||
* for /sys status file and user programs to print; if no
|
||||
* trailing brace is copied, we'll know it was truncated.
|
||||
@@ -2667,8 +2675,9 @@ static noinline void unknown_7322_ibits(struct qib_devdata *dd, u64 istat)
|
||||
char msg[128];
|
||||
|
||||
kills = istat & ~QIB_I_BITSEXTANT;
|
||||
qib_dev_err(dd, "Clearing reserved interrupt(s) 0x%016llx:"
|
||||
" %s\n", (unsigned long long) kills, msg);
|
||||
qib_dev_err(dd,
|
||||
"Clearing reserved interrupt(s) 0x%016llx: %s\n",
|
||||
(unsigned long long) kills, msg);
|
||||
qib_write_kreg(dd, kr_intmask, (dd->cspec->int_enable_mask & ~kills));
|
||||
}
|
||||
|
||||
@@ -3101,16 +3110,16 @@ static void qib_setup_7322_interrupt(struct qib_devdata *dd, int clearpend)
|
||||
/* Try to get INTx interrupt */
|
||||
try_intx:
|
||||
if (!dd->pcidev->irq) {
|
||||
qib_dev_err(dd, "irq is 0, BIOS error? "
|
||||
"Interrupts won't work\n");
|
||||
qib_dev_err(dd,
|
||||
"irq is 0, BIOS error? Interrupts won't work\n");
|
||||
goto bail;
|
||||
}
|
||||
ret = request_irq(dd->pcidev->irq, qib_7322intr,
|
||||
IRQF_SHARED, QIB_DRV_NAME, dd);
|
||||
if (ret) {
|
||||
qib_dev_err(dd, "Couldn't setup INTx "
|
||||
"interrupt (irq=%d): %d\n",
|
||||
dd->pcidev->irq, ret);
|
||||
qib_dev_err(dd,
|
||||
"Couldn't setup INTx interrupt (irq=%d): %d\n",
|
||||
dd->pcidev->irq, ret);
|
||||
goto bail;
|
||||
}
|
||||
dd->cspec->irq = dd->pcidev->irq;
|
||||
@@ -3185,8 +3194,9 @@ try_intx:
|
||||
* Shouldn't happen since the enable said we could
|
||||
* have as many as we are trying to setup here.
|
||||
*/
|
||||
qib_dev_err(dd, "Couldn't setup MSIx "
|
||||
"interrupt (vec=%d, irq=%d): %d\n", msixnum,
|
||||
qib_dev_err(dd,
|
||||
"Couldn't setup MSIx interrupt (vec=%d, irq=%d): %d\n",
|
||||
msixnum,
|
||||
dd->cspec->msix_entries[msixnum].msix.vector,
|
||||
ret);
|
||||
qib_7322_nomsix(dd);
|
||||
@@ -3305,8 +3315,9 @@ static unsigned qib_7322_boardname(struct qib_devdata *dd)
|
||||
(unsigned)SYM_FIELD(dd->revision, Revision_R, SW));
|
||||
|
||||
if (qib_singleport && (features >> PORT_SPD_CAP_SHIFT) & PORT_SPD_CAP) {
|
||||
qib_devinfo(dd->pcidev, "IB%u: Forced to single port mode"
|
||||
" by module parameter\n", dd->unit);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"IB%u: Forced to single port mode by module parameter\n",
|
||||
dd->unit);
|
||||
features &= PORT_SPD_CAP;
|
||||
}
|
||||
|
||||
@@ -3400,8 +3411,8 @@ static int qib_do_7322_reset(struct qib_devdata *dd)
|
||||
if (val == dd->revision)
|
||||
break;
|
||||
if (i == 5) {
|
||||
qib_dev_err(dd, "Failed to initialize after reset, "
|
||||
"unusable\n");
|
||||
qib_dev_err(dd,
|
||||
"Failed to initialize after reset, unusable\n");
|
||||
ret = 0;
|
||||
goto bail;
|
||||
}
|
||||
@@ -3432,8 +3443,8 @@ static int qib_do_7322_reset(struct qib_devdata *dd)
|
||||
if (qib_pcie_params(dd, dd->lbus_width,
|
||||
&dd->cspec->num_msix_entries,
|
||||
dd->cspec->msix_entries))
|
||||
qib_dev_err(dd, "Reset failed to setup PCIe or interrupts; "
|
||||
"continuing anyway\n");
|
||||
qib_dev_err(dd,
|
||||
"Reset failed to setup PCIe or interrupts; continuing anyway\n");
|
||||
|
||||
qib_setup_7322_interrupt(dd, 1);
|
||||
|
||||
@@ -3474,8 +3485,9 @@ static void qib_7322_put_tid(struct qib_devdata *dd, u64 __iomem *tidptr,
|
||||
return;
|
||||
}
|
||||
if (chippa >= (1UL << IBA7322_TID_SZ_SHIFT)) {
|
||||
qib_dev_err(dd, "Physical page address 0x%lx "
|
||||
"larger than supported\n", pa);
|
||||
qib_dev_err(dd,
|
||||
"Physical page address 0x%lx larger than supported\n",
|
||||
pa);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4029,8 +4041,9 @@ static int qib_7322_set_loopback(struct qib_pportdata *ppd, const char *what)
|
||||
Loopback);
|
||||
/* enable heart beat again */
|
||||
val = IBA7322_IBC_HRTBT_RMASK << IBA7322_IBC_HRTBT_LSB;
|
||||
qib_devinfo(ppd->dd->pcidev, "Disabling IB%u:%u IBC loopback "
|
||||
"(normal)\n", ppd->dd->unit, ppd->port);
|
||||
qib_devinfo(ppd->dd->pcidev,
|
||||
"Disabling IB%u:%u IBC loopback (normal)\n",
|
||||
ppd->dd->unit, ppd->port);
|
||||
} else
|
||||
ret = -EINVAL;
|
||||
if (!ret) {
|
||||
@@ -4714,8 +4727,8 @@ static void init_7322_cntrnames(struct qib_devdata *dd)
|
||||
dd->pport[i].cpspec->portcntrs = kmalloc(dd->cspec->nportcntrs
|
||||
* sizeof(u64), GFP_KERNEL);
|
||||
if (!dd->pport[i].cpspec->portcntrs)
|
||||
qib_dev_err(dd, "Failed allocation for"
|
||||
" portcounters\n");
|
||||
qib_dev_err(dd,
|
||||
"Failed allocation for portcounters\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4865,8 +4878,8 @@ static int qib_7322_intr_fallback(struct qib_devdata *dd)
|
||||
if (!dd->cspec->num_msix_entries)
|
||||
return 0; /* already using INTx */
|
||||
|
||||
qib_devinfo(dd->pcidev, "MSIx interrupt not detected,"
|
||||
" trying INTx interrupts\n");
|
||||
qib_devinfo(dd->pcidev,
|
||||
"MSIx interrupt not detected, trying INTx interrupts\n");
|
||||
qib_7322_nomsix(dd);
|
||||
qib_enable_intx(dd->pcidev);
|
||||
qib_setup_7322_interrupt(dd, 0);
|
||||
@@ -5151,15 +5164,11 @@ static void try_7322_ipg(struct qib_pportdata *ppd)
|
||||
goto retry;
|
||||
|
||||
if (!ibp->smi_ah) {
|
||||
struct ib_ah_attr attr;
|
||||
struct ib_ah *ah;
|
||||
|
||||
memset(&attr, 0, sizeof attr);
|
||||
attr.dlid = be16_to_cpu(IB_LID_PERMISSIVE);
|
||||
attr.port_num = ppd->port;
|
||||
ah = ib_create_ah(ibp->qp0->ibqp.pd, &attr);
|
||||
ah = qib_create_qp0_ah(ibp, be16_to_cpu(IB_LID_PERMISSIVE));
|
||||
if (IS_ERR(ah))
|
||||
ret = -EINVAL;
|
||||
ret = PTR_ERR(ah);
|
||||
else {
|
||||
send_buf->ah = ah;
|
||||
ibp->smi_ah = to_iah(ah);
|
||||
@@ -5844,22 +5853,21 @@ static int setup_txselect(const char *str, struct kernel_param *kp)
|
||||
{
|
||||
struct qib_devdata *dd;
|
||||
unsigned long val;
|
||||
char *n;
|
||||
int ret;
|
||||
|
||||
if (strlen(str) >= MAX_ATTEN_LEN) {
|
||||
printk(KERN_INFO QIB_DRV_NAME " txselect_values string "
|
||||
"too long\n");
|
||||
pr_info("txselect_values string too long\n");
|
||||
return -ENOSPC;
|
||||
}
|
||||
val = simple_strtoul(str, &n, 0);
|
||||
if (n == str || val >= (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ +
|
||||
ret = kstrtoul(str, 0, &val);
|
||||
if (ret || val >= (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ +
|
||||
TXDDS_MFG_SZ)) {
|
||||
printk(KERN_INFO QIB_DRV_NAME
|
||||
"txselect_values must start with a number < %d\n",
|
||||
pr_info("txselect_values must start with a number < %d\n",
|
||||
TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + TXDDS_MFG_SZ);
|
||||
return -EINVAL;
|
||||
return ret ? ret : -EINVAL;
|
||||
}
|
||||
strcpy(txselect_list, str);
|
||||
|
||||
strcpy(txselect_list, str);
|
||||
list_for_each_entry(dd, &qib_dev_list, list)
|
||||
if (dd->deviceid == PCI_DEVICE_ID_QLOGIC_IB_7322)
|
||||
set_no_qsfp_atten(dd, 1);
|
||||
@@ -5882,11 +5890,10 @@ static int qib_late_7322_initreg(struct qib_devdata *dd)
|
||||
qib_write_kreg(dd, kr_sendpioavailaddr, dd->pioavailregs_phys);
|
||||
val = qib_read_kreg64(dd, kr_sendpioavailaddr);
|
||||
if (val != dd->pioavailregs_phys) {
|
||||
qib_dev_err(dd, "Catastrophic software error, "
|
||||
"SendPIOAvailAddr written as %lx, "
|
||||
"read back as %llx\n",
|
||||
(unsigned long) dd->pioavailregs_phys,
|
||||
(unsigned long long) val);
|
||||
qib_dev_err(dd,
|
||||
"Catastrophic software error, SendPIOAvailAddr written as %lx, read back as %llx\n",
|
||||
(unsigned long) dd->pioavailregs_phys,
|
||||
(unsigned long long) val);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
@@ -6098,8 +6105,8 @@ static int qib_init_7322_variables(struct qib_devdata *dd)
|
||||
dd->revision = readq(&dd->kregbase[kr_revision]);
|
||||
|
||||
if ((dd->revision & 0xffffffffU) == 0xffffffffU) {
|
||||
qib_dev_err(dd, "Revision register read failure, "
|
||||
"giving up initialization\n");
|
||||
qib_dev_err(dd,
|
||||
"Revision register read failure, giving up initialization\n");
|
||||
ret = -ENODEV;
|
||||
goto bail;
|
||||
}
|
||||
@@ -6265,9 +6272,9 @@ static int qib_init_7322_variables(struct qib_devdata *dd)
|
||||
*/
|
||||
if (!(dd->flags & QIB_HAS_QSFP)) {
|
||||
if (!IS_QMH(dd) && !IS_QME(dd))
|
||||
qib_devinfo(dd->pcidev, "IB%u:%u: "
|
||||
"Unknown mezzanine card type\n",
|
||||
dd->unit, ppd->port);
|
||||
qib_devinfo(dd->pcidev,
|
||||
"IB%u:%u: Unknown mezzanine card type\n",
|
||||
dd->unit, ppd->port);
|
||||
cp->h1_val = IS_QMH(dd) ? H1_FORCE_QMH : H1_FORCE_QME;
|
||||
/*
|
||||
* Choose center value as default tx serdes setting
|
||||
@@ -6922,8 +6929,8 @@ struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *pdev,
|
||||
dd->cspec->msix_entries[i].msix.entry = i;
|
||||
|
||||
if (qib_pcie_params(dd, 8, &tabsize, dd->cspec->msix_entries))
|
||||
qib_dev_err(dd, "Failed to setup PCIe or interrupts; "
|
||||
"continuing anyway\n");
|
||||
qib_dev_err(dd,
|
||||
"Failed to setup PCIe or interrupts; continuing anyway\n");
|
||||
/* may be less than we wanted, if not enough available */
|
||||
dd->cspec->num_msix_entries = tabsize;
|
||||
|
||||
@@ -7276,8 +7283,7 @@ static void find_best_ent(struct qib_pportdata *ppd,
|
||||
ppd->cpspec->no_eep < (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ +
|
||||
TXDDS_MFG_SZ)) {
|
||||
idx = ppd->cpspec->no_eep - (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ);
|
||||
printk(KERN_INFO QIB_DRV_NAME
|
||||
" IB%u:%u use idx %u into txdds_mfg\n",
|
||||
pr_info("IB%u:%u use idx %u into txdds_mfg\n",
|
||||
ppd->dd->unit, ppd->port, idx);
|
||||
*sdr_dds = &txdds_extra_mfg[idx];
|
||||
*ddr_dds = &txdds_extra_mfg[idx];
|
||||
@@ -7432,11 +7438,11 @@ static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable)
|
||||
u8 state = SYM_FIELD(data, IBSerdesCtrl_0, RXLOSEN);
|
||||
|
||||
if (enable && !state) {
|
||||
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS on\n",
|
||||
pr_info("IB%u:%u Turning LOS on\n",
|
||||
ppd->dd->unit, ppd->port);
|
||||
data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN);
|
||||
} else if (!enable && state) {
|
||||
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS off\n",
|
||||
pr_info("IB%u:%u Turning LOS off\n",
|
||||
ppd->dd->unit, ppd->port);
|
||||
data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN);
|
||||
}
|
||||
@@ -7672,8 +7678,7 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd)
|
||||
}
|
||||
}
|
||||
if (chan_done) {
|
||||
printk(KERN_INFO QIB_DRV_NAME
|
||||
" Serdes %d calibration not done after .5 sec: 0x%x\n",
|
||||
pr_info("Serdes %d calibration not done after .5 sec: 0x%x\n",
|
||||
IBSD(ppd->hw_pidx), chan_done);
|
||||
} else {
|
||||
for (chan = 0; chan < SERDES_CHANS; ++chan) {
|
||||
@@ -7681,9 +7686,8 @@ static int serdes_7322_init_new(struct qib_pportdata *ppd)
|
||||
(chan + (chan >> 1)),
|
||||
25, 0, 0);
|
||||
if ((~rxcaldone & (u32)BMASK(10, 10)) == 0)
|
||||
printk(KERN_INFO QIB_DRV_NAME
|
||||
" Serdes %d chan %d calibration "
|
||||
"failed\n", IBSD(ppd->hw_pidx), chan);
|
||||
pr_info("Serdes %d chan %d calibration failed\n",
|
||||
IBSD(ppd->hw_pidx), chan);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
|
||||
* Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
@@ -38,9 +38,14 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include "qib.h"
|
||||
#include "qib_common.h"
|
||||
#include "qib_mad.h"
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) QIB_DRV_NAME ": " fmt
|
||||
|
||||
/*
|
||||
* min buffers we want to have per context, after driver
|
||||
@@ -71,6 +76,9 @@ unsigned qib_n_krcv_queues;
|
||||
module_param_named(krcvqs, qib_n_krcv_queues, uint, S_IRUGO);
|
||||
MODULE_PARM_DESC(krcvqs, "number of kernel receive queues per IB port");
|
||||
|
||||
unsigned qib_cc_table_size;
|
||||
module_param_named(cc_table_size, qib_cc_table_size, uint, S_IRUGO);
|
||||
MODULE_PARM_DESC(cc_table_size, "Congestion control table entries 0 (CCA disabled - default), min = 128, max = 1984");
|
||||
/*
|
||||
* qib_wc_pat parameter:
|
||||
* 0 is WC via MTRR
|
||||
@@ -120,8 +128,8 @@ int qib_create_ctxts(struct qib_devdata *dd)
|
||||
*/
|
||||
dd->rcd = kzalloc(sizeof(*dd->rcd) * dd->ctxtcnt, GFP_KERNEL);
|
||||
if (!dd->rcd) {
|
||||
qib_dev_err(dd, "Unable to allocate ctxtdata array, "
|
||||
"failing\n");
|
||||
qib_dev_err(dd,
|
||||
"Unable to allocate ctxtdata array, failing\n");
|
||||
ret = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
@@ -137,8 +145,8 @@ int qib_create_ctxts(struct qib_devdata *dd)
|
||||
ppd = dd->pport + (i % dd->num_pports);
|
||||
rcd = qib_create_ctxtdata(ppd, i);
|
||||
if (!rcd) {
|
||||
qib_dev_err(dd, "Unable to allocate ctxtdata"
|
||||
" for Kernel ctxt, failing\n");
|
||||
qib_dev_err(dd,
|
||||
"Unable to allocate ctxtdata for Kernel ctxt, failing\n");
|
||||
ret = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
@@ -199,6 +207,7 @@ struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *ppd, u32 ctxt)
|
||||
void qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd,
|
||||
u8 hw_pidx, u8 port)
|
||||
{
|
||||
int size;
|
||||
ppd->dd = dd;
|
||||
ppd->hw_pidx = hw_pidx;
|
||||
ppd->port = port; /* IB port number, not index */
|
||||
@@ -210,6 +219,83 @@ void qib_init_pportdata(struct qib_pportdata *ppd, struct qib_devdata *dd,
|
||||
init_timer(&ppd->symerr_clear_timer);
|
||||
ppd->symerr_clear_timer.function = qib_clear_symerror_on_linkup;
|
||||
ppd->symerr_clear_timer.data = (unsigned long)ppd;
|
||||
|
||||
ppd->qib_wq = NULL;
|
||||
|
||||
spin_lock_init(&ppd->cc_shadow_lock);
|
||||
|
||||
if (qib_cc_table_size < IB_CCT_MIN_ENTRIES)
|
||||
goto bail;
|
||||
|
||||
ppd->cc_supported_table_entries = min(max_t(int, qib_cc_table_size,
|
||||
IB_CCT_MIN_ENTRIES), IB_CCT_ENTRIES*IB_CC_TABLE_CAP_DEFAULT);
|
||||
|
||||
ppd->cc_max_table_entries =
|
||||
ppd->cc_supported_table_entries/IB_CCT_ENTRIES;
|
||||
|
||||
size = IB_CC_TABLE_CAP_DEFAULT * sizeof(struct ib_cc_table_entry)
|
||||
* IB_CCT_ENTRIES;
|
||||
ppd->ccti_entries = kzalloc(size, GFP_KERNEL);
|
||||
if (!ppd->ccti_entries) {
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate congestion control table for port %d!\n",
|
||||
port);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
size = IB_CC_CCS_ENTRIES * sizeof(struct ib_cc_congestion_entry);
|
||||
ppd->congestion_entries = kzalloc(size, GFP_KERNEL);
|
||||
if (!ppd->congestion_entries) {
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate congestion setting list for port %d!\n",
|
||||
port);
|
||||
goto bail_1;
|
||||
}
|
||||
|
||||
size = sizeof(struct cc_table_shadow);
|
||||
ppd->ccti_entries_shadow = kzalloc(size, GFP_KERNEL);
|
||||
if (!ppd->ccti_entries_shadow) {
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate shadow ccti list for port %d!\n",
|
||||
port);
|
||||
goto bail_2;
|
||||
}
|
||||
|
||||
size = sizeof(struct ib_cc_congestion_setting_attr);
|
||||
ppd->congestion_entries_shadow = kzalloc(size, GFP_KERNEL);
|
||||
if (!ppd->congestion_entries_shadow) {
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate shadow congestion setting list for port %d!\n",
|
||||
port);
|
||||
goto bail_3;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
bail_3:
|
||||
kfree(ppd->ccti_entries_shadow);
|
||||
ppd->ccti_entries_shadow = NULL;
|
||||
bail_2:
|
||||
kfree(ppd->congestion_entries);
|
||||
ppd->congestion_entries = NULL;
|
||||
bail_1:
|
||||
kfree(ppd->ccti_entries);
|
||||
ppd->ccti_entries = NULL;
|
||||
bail:
|
||||
/* User is intentionally disabling the congestion control agent */
|
||||
if (!qib_cc_table_size)
|
||||
return;
|
||||
|
||||
if (qib_cc_table_size < IB_CCT_MIN_ENTRIES) {
|
||||
qib_cc_table_size = 0;
|
||||
qib_dev_err(dd,
|
||||
"Congestion Control table size %d less than minimum %d for port %d\n",
|
||||
qib_cc_table_size, IB_CCT_MIN_ENTRIES, port);
|
||||
}
|
||||
|
||||
qib_dev_err(dd, "Congestion Control Agent disabled for port %d\n",
|
||||
port);
|
||||
return;
|
||||
}
|
||||
|
||||
static int init_pioavailregs(struct qib_devdata *dd)
|
||||
@@ -221,8 +307,8 @@ static int init_pioavailregs(struct qib_devdata *dd)
|
||||
&dd->pcidev->dev, PAGE_SIZE, &dd->pioavailregs_phys,
|
||||
GFP_KERNEL);
|
||||
if (!dd->pioavailregs_dma) {
|
||||
qib_dev_err(dd, "failed to allocate PIOavail reg area "
|
||||
"in memory\n");
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate PIOavail reg area in memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto done;
|
||||
}
|
||||
@@ -277,15 +363,15 @@ static void init_shadow_tids(struct qib_devdata *dd)
|
||||
|
||||
pages = vzalloc(dd->cfgctxts * dd->rcvtidcnt * sizeof(struct page *));
|
||||
if (!pages) {
|
||||
qib_dev_err(dd, "failed to allocate shadow page * "
|
||||
"array, no expected sends!\n");
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate shadow page * array, no expected sends!\n");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
addrs = vzalloc(dd->cfgctxts * dd->rcvtidcnt * sizeof(dma_addr_t));
|
||||
if (!addrs) {
|
||||
qib_dev_err(dd, "failed to allocate shadow dma handle "
|
||||
"array, no expected sends!\n");
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate shadow dma handle array, no expected sends!\n");
|
||||
goto bail_free;
|
||||
}
|
||||
|
||||
@@ -309,13 +395,13 @@ static int loadtime_init(struct qib_devdata *dd)
|
||||
|
||||
if (((dd->revision >> QLOGIC_IB_R_SOFTWARE_SHIFT) &
|
||||
QLOGIC_IB_R_SOFTWARE_MASK) != QIB_CHIP_SWVERSION) {
|
||||
qib_dev_err(dd, "Driver only handles version %d, "
|
||||
"chip swversion is %d (%llx), failng\n",
|
||||
QIB_CHIP_SWVERSION,
|
||||
(int)(dd->revision >>
|
||||
qib_dev_err(dd,
|
||||
"Driver only handles version %d, chip swversion is %d (%llx), failng\n",
|
||||
QIB_CHIP_SWVERSION,
|
||||
(int)(dd->revision >>
|
||||
QLOGIC_IB_R_SOFTWARE_SHIFT) &
|
||||
QLOGIC_IB_R_SOFTWARE_MASK,
|
||||
(unsigned long long) dd->revision);
|
||||
QLOGIC_IB_R_SOFTWARE_MASK,
|
||||
(unsigned long long) dd->revision);
|
||||
ret = -ENOSYS;
|
||||
goto done;
|
||||
}
|
||||
@@ -419,8 +505,8 @@ static void verify_interrupt(unsigned long opaque)
|
||||
*/
|
||||
if (dd->int_counter == 0) {
|
||||
if (!dd->f_intr_fallback(dd))
|
||||
dev_err(&dd->pcidev->dev, "No interrupts detected, "
|
||||
"not usable.\n");
|
||||
dev_err(&dd->pcidev->dev,
|
||||
"No interrupts detected, not usable.\n");
|
||||
else /* re-arm the timer to see if fallback works */
|
||||
mod_timer(&dd->intrchk_timer, jiffies + HZ/2);
|
||||
}
|
||||
@@ -482,6 +568,41 @@ static void init_piobuf_state(struct qib_devdata *dd)
|
||||
dd->f_initvl15_bufs(dd);
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_create_workqueues - create per port workqueues
|
||||
* @dd: the qlogic_ib device
|
||||
*/
|
||||
static int qib_create_workqueues(struct qib_devdata *dd)
|
||||
{
|
||||
int pidx;
|
||||
struct qib_pportdata *ppd;
|
||||
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
ppd = dd->pport + pidx;
|
||||
if (!ppd->qib_wq) {
|
||||
char wq_name[8]; /* 3 + 2 + 1 + 1 + 1 */
|
||||
snprintf(wq_name, sizeof(wq_name), "qib%d_%d",
|
||||
dd->unit, pidx);
|
||||
ppd->qib_wq =
|
||||
create_singlethread_workqueue(wq_name);
|
||||
if (!ppd->qib_wq)
|
||||
goto wq_error;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
wq_error:
|
||||
pr_err("create_singlethread_workqueue failed for port %d\n",
|
||||
pidx + 1);
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
ppd = dd->pport + pidx;
|
||||
if (ppd->qib_wq) {
|
||||
destroy_workqueue(ppd->qib_wq);
|
||||
ppd->qib_wq = NULL;
|
||||
}
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_init - do the actual initialization sequence on the chip
|
||||
* @dd: the qlogic_ib device
|
||||
@@ -547,8 +668,8 @@ int qib_init(struct qib_devdata *dd, int reinit)
|
||||
if (!lastfail)
|
||||
lastfail = qib_setup_eagerbufs(rcd);
|
||||
if (lastfail) {
|
||||
qib_dev_err(dd, "failed to allocate kernel ctxt's "
|
||||
"rcvhdrq and/or egr bufs\n");
|
||||
qib_dev_err(dd,
|
||||
"failed to allocate kernel ctxt's rcvhdrq and/or egr bufs\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -764,6 +885,11 @@ static void qib_shutdown_device(struct qib_devdata *dd)
|
||||
* We can't count on interrupts since we are stopping.
|
||||
*/
|
||||
dd->f_quiet_serdes(ppd);
|
||||
|
||||
if (ppd->qib_wq) {
|
||||
destroy_workqueue(ppd->qib_wq);
|
||||
ppd->qib_wq = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
qib_update_eeprom_log(dd);
|
||||
@@ -893,8 +1019,7 @@ static void qib_verify_pioperf(struct qib_devdata *dd)
|
||||
/* 1 GiB/sec, slightly over IB SDR line rate */
|
||||
if (lcnt < (emsecs * 1024U))
|
||||
qib_dev_err(dd,
|
||||
"Performance problem: bandwidth to PIO buffers is "
|
||||
"only %u MiB/sec\n",
|
||||
"Performance problem: bandwidth to PIO buffers is only %u MiB/sec\n",
|
||||
lcnt / (u32) emsecs);
|
||||
|
||||
preempt_enable();
|
||||
@@ -967,8 +1092,8 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
|
||||
if (qib_cpulist)
|
||||
qib_cpulist_count = count;
|
||||
else
|
||||
qib_early_err(&pdev->dev, "Could not alloc cpulist "
|
||||
"info, cpu affinity might be wrong\n");
|
||||
qib_early_err(&pdev->dev,
|
||||
"Could not alloc cpulist info, cpu affinity might be wrong\n");
|
||||
}
|
||||
|
||||
bail:
|
||||
@@ -1057,21 +1182,20 @@ static int __init qlogic_ib_init(void)
|
||||
*/
|
||||
idr_init(&qib_unit_table);
|
||||
if (!idr_pre_get(&qib_unit_table, GFP_KERNEL)) {
|
||||
printk(KERN_ERR QIB_DRV_NAME ": idr_pre_get() failed\n");
|
||||
pr_err("idr_pre_get() failed\n");
|
||||
ret = -ENOMEM;
|
||||
goto bail_cq_wq;
|
||||
}
|
||||
|
||||
ret = pci_register_driver(&qib_driver);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR QIB_DRV_NAME
|
||||
": Unable to register driver: error %d\n", -ret);
|
||||
pr_err("Unable to register driver: error %d\n", -ret);
|
||||
goto bail_unit;
|
||||
}
|
||||
|
||||
/* not fatal if it doesn't work */
|
||||
if (qib_init_qibfs())
|
||||
printk(KERN_ERR QIB_DRV_NAME ": Unable to register ipathfs\n");
|
||||
pr_err("Unable to register ipathfs\n");
|
||||
goto bail; /* all OK */
|
||||
|
||||
bail_unit:
|
||||
@@ -1095,9 +1219,9 @@ static void __exit qlogic_ib_cleanup(void)
|
||||
|
||||
ret = qib_exit_qibfs();
|
||||
if (ret)
|
||||
printk(KERN_ERR QIB_DRV_NAME ": "
|
||||
"Unable to cleanup counter filesystem: "
|
||||
"error %d\n", -ret);
|
||||
pr_err(
|
||||
"Unable to cleanup counter filesystem: error %d\n",
|
||||
-ret);
|
||||
|
||||
pci_unregister_driver(&qib_driver);
|
||||
|
||||
@@ -1121,10 +1245,24 @@ static void cleanup_device_data(struct qib_devdata *dd)
|
||||
unsigned long flags;
|
||||
|
||||
/* users can't do anything more with chip */
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx)
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
if (dd->pport[pidx].statusp)
|
||||
*dd->pport[pidx].statusp &= ~QIB_STATUS_CHIP_PRESENT;
|
||||
|
||||
spin_lock(&dd->pport[pidx].cc_shadow_lock);
|
||||
|
||||
kfree(dd->pport[pidx].congestion_entries);
|
||||
dd->pport[pidx].congestion_entries = NULL;
|
||||
kfree(dd->pport[pidx].ccti_entries);
|
||||
dd->pport[pidx].ccti_entries = NULL;
|
||||
kfree(dd->pport[pidx].ccti_entries_shadow);
|
||||
dd->pport[pidx].ccti_entries_shadow = NULL;
|
||||
kfree(dd->pport[pidx].congestion_entries_shadow);
|
||||
dd->pport[pidx].congestion_entries_shadow = NULL;
|
||||
|
||||
spin_unlock(&dd->pport[pidx].cc_shadow_lock);
|
||||
}
|
||||
|
||||
if (!qib_wc_pat)
|
||||
qib_disable_wc(dd);
|
||||
|
||||
@@ -1223,9 +1361,9 @@ static int __devinit qib_init_one(struct pci_dev *pdev,
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
dd = qib_init_iba6120_funcs(pdev, ent);
|
||||
#else
|
||||
qib_early_err(&pdev->dev, "QLogic PCIE device 0x%x cannot "
|
||||
"work if CONFIG_PCI_MSI is not enabled\n",
|
||||
ent->device);
|
||||
qib_early_err(&pdev->dev,
|
||||
"QLogic PCIE device 0x%x cannot work if CONFIG_PCI_MSI is not enabled\n",
|
||||
ent->device);
|
||||
dd = ERR_PTR(-ENODEV);
|
||||
#endif
|
||||
break;
|
||||
@@ -1239,8 +1377,9 @@ static int __devinit qib_init_one(struct pci_dev *pdev,
|
||||
break;
|
||||
|
||||
default:
|
||||
qib_early_err(&pdev->dev, "Failing on unknown QLogic "
|
||||
"deviceid 0x%x\n", ent->device);
|
||||
qib_early_err(&pdev->dev,
|
||||
"Failing on unknown QLogic deviceid 0x%x\n",
|
||||
ent->device);
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
@@ -1249,6 +1388,10 @@ static int __devinit qib_init_one(struct pci_dev *pdev,
|
||||
if (ret)
|
||||
goto bail; /* error already printed */
|
||||
|
||||
ret = qib_create_workqueues(dd);
|
||||
if (ret)
|
||||
goto bail;
|
||||
|
||||
/* do the generic initialization */
|
||||
initfail = qib_init(dd, 0);
|
||||
|
||||
@@ -1293,9 +1436,9 @@ static int __devinit qib_init_one(struct pci_dev *pdev,
|
||||
if (!qib_wc_pat) {
|
||||
ret = qib_enable_wc(dd);
|
||||
if (ret) {
|
||||
qib_dev_err(dd, "Write combining not enabled "
|
||||
"(err %d): performance may be poor\n",
|
||||
-ret);
|
||||
qib_dev_err(dd,
|
||||
"Write combining not enabled (err %d): performance may be poor\n",
|
||||
-ret);
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
@@ -1361,9 +1504,9 @@ int qib_create_rcvhdrq(struct qib_devdata *dd, struct qib_ctxtdata *rcd)
|
||||
gfp_flags | __GFP_COMP);
|
||||
|
||||
if (!rcd->rcvhdrq) {
|
||||
qib_dev_err(dd, "attempt to allocate %d bytes "
|
||||
"for ctxt %u rcvhdrq failed\n",
|
||||
amt, rcd->ctxt);
|
||||
qib_dev_err(dd,
|
||||
"attempt to allocate %d bytes for ctxt %u rcvhdrq failed\n",
|
||||
amt, rcd->ctxt);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -1392,8 +1535,9 @@ int qib_create_rcvhdrq(struct qib_devdata *dd, struct qib_ctxtdata *rcd)
|
||||
return 0;
|
||||
|
||||
bail_free:
|
||||
qib_dev_err(dd, "attempt to allocate 1 page for ctxt %u "
|
||||
"rcvhdrqtailaddr failed\n", rcd->ctxt);
|
||||
qib_dev_err(dd,
|
||||
"attempt to allocate 1 page for ctxt %u rcvhdrqtailaddr failed\n",
|
||||
rcd->ctxt);
|
||||
vfree(rcd->user_event_mask);
|
||||
rcd->user_event_mask = NULL;
|
||||
bail_free_hdrq:
|
||||
|
||||
@@ -224,15 +224,15 @@ void qib_bad_intrstatus(struct qib_devdata *dd)
|
||||
* We print the message and disable interrupts, in hope of
|
||||
* having a better chance of debugging the problem.
|
||||
*/
|
||||
qib_dev_err(dd, "Read of chip interrupt status failed"
|
||||
" disabling interrupts\n");
|
||||
qib_dev_err(dd,
|
||||
"Read of chip interrupt status failed disabling interrupts\n");
|
||||
if (allbits++) {
|
||||
/* disable interrupt delivery, something is very wrong */
|
||||
if (allbits == 2)
|
||||
dd->f_set_intr_state(dd, 0);
|
||||
if (allbits == 3) {
|
||||
qib_dev_err(dd, "2nd bad interrupt status, "
|
||||
"unregistering interrupts\n");
|
||||
qib_dev_err(dd,
|
||||
"2nd bad interrupt status, unregistering interrupts\n");
|
||||
dd->flags |= QIB_BADINTR;
|
||||
dd->flags &= ~QIB_INITTED;
|
||||
dd->f_free_irq(dd);
|
||||
|
||||
@@ -35,21 +35,41 @@
|
||||
|
||||
/**
|
||||
* qib_alloc_lkey - allocate an lkey
|
||||
* @rkt: lkey table in which to allocate the lkey
|
||||
* @mr: memory region that this lkey protects
|
||||
* @dma_region: 0->normal key, 1->restricted DMA key
|
||||
*
|
||||
* Returns 0 if successful, otherwise returns -errno.
|
||||
*
|
||||
* Increments mr reference count as required.
|
||||
*
|
||||
* Sets the lkey field mr for non-dma regions.
|
||||
*
|
||||
* Returns 1 if successful, otherwise returns 0.
|
||||
*/
|
||||
|
||||
int qib_alloc_lkey(struct qib_lkey_table *rkt, struct qib_mregion *mr)
|
||||
int qib_alloc_lkey(struct qib_mregion *mr, int dma_region)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 r;
|
||||
u32 n;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
struct qib_ibdev *dev = to_idev(mr->pd->device);
|
||||
struct qib_lkey_table *rkt = &dev->lk_table;
|
||||
|
||||
spin_lock_irqsave(&rkt->lock, flags);
|
||||
|
||||
/* special case for dma_mr lkey == 0 */
|
||||
if (dma_region) {
|
||||
struct qib_mregion *tmr;
|
||||
|
||||
tmr = rcu_dereference(dev->dma_mr);
|
||||
if (!tmr) {
|
||||
qib_get_mr(mr);
|
||||
rcu_assign_pointer(dev->dma_mr, mr);
|
||||
mr->lkey_published = 1;
|
||||
}
|
||||
goto success;
|
||||
}
|
||||
|
||||
/* Find the next available LKEY */
|
||||
r = rkt->next;
|
||||
n = r;
|
||||
@@ -57,11 +77,8 @@ int qib_alloc_lkey(struct qib_lkey_table *rkt, struct qib_mregion *mr)
|
||||
if (rkt->table[r] == NULL)
|
||||
break;
|
||||
r = (r + 1) & (rkt->max - 1);
|
||||
if (r == n) {
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
ret = 0;
|
||||
if (r == n)
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
rkt->next = (r + 1) & (rkt->max - 1);
|
||||
/*
|
||||
@@ -76,57 +93,58 @@ int qib_alloc_lkey(struct qib_lkey_table *rkt, struct qib_mregion *mr)
|
||||
mr->lkey |= 1 << 8;
|
||||
rkt->gen++;
|
||||
}
|
||||
rkt->table[r] = mr;
|
||||
qib_get_mr(mr);
|
||||
rcu_assign_pointer(rkt->table[r], mr);
|
||||
mr->lkey_published = 1;
|
||||
success:
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
|
||||
ret = 1;
|
||||
|
||||
bail:
|
||||
out:
|
||||
return ret;
|
||||
bail:
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_free_lkey - free an lkey
|
||||
* @rkt: table from which to free the lkey
|
||||
* @lkey: lkey id to free
|
||||
* @mr: mr to free from tables
|
||||
*/
|
||||
int qib_free_lkey(struct qib_ibdev *dev, struct qib_mregion *mr)
|
||||
void qib_free_lkey(struct qib_mregion *mr)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 lkey = mr->lkey;
|
||||
u32 r;
|
||||
int ret;
|
||||
struct qib_ibdev *dev = to_idev(mr->pd->device);
|
||||
struct qib_lkey_table *rkt = &dev->lk_table;
|
||||
|
||||
spin_lock_irqsave(&dev->lk_table.lock, flags);
|
||||
if (lkey == 0) {
|
||||
if (dev->dma_mr && dev->dma_mr == mr) {
|
||||
ret = atomic_read(&dev->dma_mr->refcount);
|
||||
if (!ret)
|
||||
dev->dma_mr = NULL;
|
||||
} else
|
||||
ret = 0;
|
||||
} else {
|
||||
spin_lock_irqsave(&rkt->lock, flags);
|
||||
if (!mr->lkey_published)
|
||||
goto out;
|
||||
if (lkey == 0)
|
||||
rcu_assign_pointer(dev->dma_mr, NULL);
|
||||
else {
|
||||
r = lkey >> (32 - ib_qib_lkey_table_size);
|
||||
ret = atomic_read(&dev->lk_table.table[r]->refcount);
|
||||
if (!ret)
|
||||
dev->lk_table.table[r] = NULL;
|
||||
rcu_assign_pointer(rkt->table[r], NULL);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->lk_table.lock, flags);
|
||||
|
||||
if (ret)
|
||||
ret = -EBUSY;
|
||||
return ret;
|
||||
qib_put_mr(mr);
|
||||
mr->lkey_published = 0;
|
||||
out:
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_lkey_ok - check IB SGE for validity and initialize
|
||||
* @rkt: table containing lkey to check SGE against
|
||||
* @pd: protection domain
|
||||
* @isge: outgoing internal SGE
|
||||
* @sge: SGE to check
|
||||
* @acc: access flags
|
||||
*
|
||||
* Return 1 if valid and successful, otherwise returns 0.
|
||||
*
|
||||
* increments the reference count upon success
|
||||
*
|
||||
* Check the IB SGE for validity and initialize our internal version
|
||||
* of it.
|
||||
*/
|
||||
@@ -136,24 +154,25 @@ int qib_lkey_ok(struct qib_lkey_table *rkt, struct qib_pd *pd,
|
||||
struct qib_mregion *mr;
|
||||
unsigned n, m;
|
||||
size_t off;
|
||||
unsigned long flags;
|
||||
|
||||
/*
|
||||
* We use LKEY == zero for kernel virtual addresses
|
||||
* (see qib_get_dma_mr and qib_dma.c).
|
||||
*/
|
||||
spin_lock_irqsave(&rkt->lock, flags);
|
||||
rcu_read_lock();
|
||||
if (sge->lkey == 0) {
|
||||
struct qib_ibdev *dev = to_idev(pd->ibpd.device);
|
||||
|
||||
if (pd->user)
|
||||
goto bail;
|
||||
if (!dev->dma_mr)
|
||||
mr = rcu_dereference(dev->dma_mr);
|
||||
if (!mr)
|
||||
goto bail;
|
||||
atomic_inc(&dev->dma_mr->refcount);
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
if (unlikely(!atomic_inc_not_zero(&mr->refcount)))
|
||||
goto bail;
|
||||
rcu_read_unlock();
|
||||
|
||||
isge->mr = dev->dma_mr;
|
||||
isge->mr = mr;
|
||||
isge->vaddr = (void *) sge->addr;
|
||||
isge->length = sge->length;
|
||||
isge->sge_length = sge->length;
|
||||
@@ -161,18 +180,18 @@ int qib_lkey_ok(struct qib_lkey_table *rkt, struct qib_pd *pd,
|
||||
isge->n = 0;
|
||||
goto ok;
|
||||
}
|
||||
mr = rkt->table[(sge->lkey >> (32 - ib_qib_lkey_table_size))];
|
||||
if (unlikely(mr == NULL || mr->lkey != sge->lkey ||
|
||||
mr->pd != &pd->ibpd))
|
||||
mr = rcu_dereference(
|
||||
rkt->table[(sge->lkey >> (32 - ib_qib_lkey_table_size))]);
|
||||
if (unlikely(!mr || mr->lkey != sge->lkey || mr->pd != &pd->ibpd))
|
||||
goto bail;
|
||||
|
||||
off = sge->addr - mr->user_base;
|
||||
if (unlikely(sge->addr < mr->user_base ||
|
||||
off + sge->length > mr->length ||
|
||||
(mr->access_flags & acc) != acc))
|
||||
if (unlikely(sge->addr < mr->iova || off + sge->length > mr->length ||
|
||||
(mr->access_flags & acc) == 0))
|
||||
goto bail;
|
||||
atomic_inc(&mr->refcount);
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
if (unlikely(!atomic_inc_not_zero(&mr->refcount)))
|
||||
goto bail;
|
||||
rcu_read_unlock();
|
||||
|
||||
off += mr->offset;
|
||||
if (mr->page_shift) {
|
||||
@@ -208,20 +227,22 @@ int qib_lkey_ok(struct qib_lkey_table *rkt, struct qib_pd *pd,
|
||||
ok:
|
||||
return 1;
|
||||
bail:
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* qib_rkey_ok - check the IB virtual address, length, and RKEY
|
||||
* @dev: infiniband device
|
||||
* @ss: SGE state
|
||||
* @qp: qp for validation
|
||||
* @sge: SGE state
|
||||
* @len: length of data
|
||||
* @vaddr: virtual address to place data
|
||||
* @rkey: rkey to check
|
||||
* @acc: access flags
|
||||
*
|
||||
* Return 1 if successful, otherwise 0.
|
||||
*
|
||||
* increments the reference count upon success
|
||||
*/
|
||||
int qib_rkey_ok(struct qib_qp *qp, struct qib_sge *sge,
|
||||
u32 len, u64 vaddr, u32 rkey, int acc)
|
||||
@@ -230,25 +251,26 @@ int qib_rkey_ok(struct qib_qp *qp, struct qib_sge *sge,
|
||||
struct qib_mregion *mr;
|
||||
unsigned n, m;
|
||||
size_t off;
|
||||
unsigned long flags;
|
||||
|
||||
/*
|
||||
* We use RKEY == zero for kernel virtual addresses
|
||||
* (see qib_get_dma_mr and qib_dma.c).
|
||||
*/
|
||||
spin_lock_irqsave(&rkt->lock, flags);
|
||||
rcu_read_lock();
|
||||
if (rkey == 0) {
|
||||
struct qib_pd *pd = to_ipd(qp->ibqp.pd);
|
||||
struct qib_ibdev *dev = to_idev(pd->ibpd.device);
|
||||
|
||||
if (pd->user)
|
||||
goto bail;
|
||||
if (!dev->dma_mr)
|
||||
mr = rcu_dereference(dev->dma_mr);
|
||||
if (!mr)
|
||||
goto bail;
|
||||
atomic_inc(&dev->dma_mr->refcount);
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
if (unlikely(!atomic_inc_not_zero(&mr->refcount)))
|
||||
goto bail;
|
||||
rcu_read_unlock();
|
||||
|
||||
sge->mr = dev->dma_mr;
|
||||
sge->mr = mr;
|
||||
sge->vaddr = (void *) vaddr;
|
||||
sge->length = len;
|
||||
sge->sge_length = len;
|
||||
@@ -257,16 +279,18 @@ int qib_rkey_ok(struct qib_qp *qp, struct qib_sge *sge,
|
||||
goto ok;
|
||||
}
|
||||
|
||||
mr = rkt->table[(rkey >> (32 - ib_qib_lkey_table_size))];
|
||||
if (unlikely(mr == NULL || mr->lkey != rkey || qp->ibqp.pd != mr->pd))
|
||||
mr = rcu_dereference(
|
||||
rkt->table[(rkey >> (32 - ib_qib_lkey_table_size))]);
|
||||
if (unlikely(!mr || mr->lkey != rkey || qp->ibqp.pd != mr->pd))
|
||||
goto bail;
|
||||
|
||||
off = vaddr - mr->iova;
|
||||
if (unlikely(vaddr < mr->iova || off + len > mr->length ||
|
||||
(mr->access_flags & acc) == 0))
|
||||
goto bail;
|
||||
atomic_inc(&mr->refcount);
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
if (unlikely(!atomic_inc_not_zero(&mr->refcount)))
|
||||
goto bail;
|
||||
rcu_read_unlock();
|
||||
|
||||
off += mr->offset;
|
||||
if (mr->page_shift) {
|
||||
@@ -302,7 +326,7 @@ int qib_rkey_ok(struct qib_qp *qp, struct qib_sge *sge,
|
||||
ok:
|
||||
return 1;
|
||||
bail:
|
||||
spin_unlock_irqrestore(&rkt->lock, flags);
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -325,7 +349,9 @@ int qib_fast_reg_mr(struct qib_qp *qp, struct ib_send_wr *wr)
|
||||
if (pd->user || rkey == 0)
|
||||
goto bail;
|
||||
|
||||
mr = rkt->table[(rkey >> (32 - ib_qib_lkey_table_size))];
|
||||
mr = rcu_dereference_protected(
|
||||
rkt->table[(rkey >> (32 - ib_qib_lkey_table_size))],
|
||||
lockdep_is_held(&rkt->lock));
|
||||
if (unlikely(mr == NULL || qp->ibqp.pd != mr->pd))
|
||||
goto bail;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user