Commit 6e6d0536 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Seven fixes to four drivers with no core changes.

  The mpt3sas one is theoretical until we get a CPU that goes up to 64
  bits physical, the qla2xxx one fixes an oops in a driver
  initialization error leg and the others are mostly cosmetic"

[ The fcoe patches may be worth highlighting - they may be "just"
  cleanups, but they simplify and fix the odd fc_rport_priv structure
  handling rules so that the new gcc-9 warnings about memset crossing
  structure boundaries are gone.

  The old code was hard for humans to understand too, and really
  confused the compiler sanity checks  - Linus ]

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: qla2xxx: Fix possible fcport null-pointer dereferences
  scsi: mpt3sas: Use 63-bit DMA addressing on SAS35 HBA
  scsi: hpsa: remove printing internal cdb on tag collision
  scsi: hpsa: correct scsi command status issue after reset
  scsi: fcoe: pass in fcoe_rport structure instead of fc_rport_priv
  scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure
  scsi: libfc: Whitespace cleanup in libfc.h
parents 10e5ddd7 e82f04ec
...@@ -2005,7 +2005,7 @@ EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); ...@@ -2005,7 +2005,7 @@ EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac);
*/ */
static inline struct fcoe_rport *fcoe_ctlr_rport(struct fc_rport_priv *rdata) static inline struct fcoe_rport *fcoe_ctlr_rport(struct fc_rport_priv *rdata)
{ {
return (struct fcoe_rport *)(rdata + 1); return container_of(rdata, struct fcoe_rport, rdata);
} }
/** /**
...@@ -2269,7 +2269,7 @@ static void fcoe_ctlr_vn_start(struct fcoe_ctlr *fip) ...@@ -2269,7 +2269,7 @@ static void fcoe_ctlr_vn_start(struct fcoe_ctlr *fip)
*/ */
static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,
struct sk_buff *skb, struct sk_buff *skb,
struct fc_rport_priv *rdata) struct fcoe_rport *frport)
{ {
struct fip_header *fiph; struct fip_header *fiph;
struct fip_desc *desc = NULL; struct fip_desc *desc = NULL;
...@@ -2277,16 +2277,12 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, ...@@ -2277,16 +2277,12 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,
struct fip_wwn_desc *wwn = NULL; struct fip_wwn_desc *wwn = NULL;
struct fip_vn_desc *vn = NULL; struct fip_vn_desc *vn = NULL;
struct fip_size_desc *size = NULL; struct fip_size_desc *size = NULL;
struct fcoe_rport *frport;
size_t rlen; size_t rlen;
size_t dlen; size_t dlen;
u32 desc_mask = 0; u32 desc_mask = 0;
u32 dtype; u32 dtype;
u8 sub; u8 sub;
memset(rdata, 0, sizeof(*rdata) + sizeof(*frport));
frport = fcoe_ctlr_rport(rdata);
fiph = (struct fip_header *)skb->data; fiph = (struct fip_header *)skb->data;
frport->flags = ntohs(fiph->fip_flags); frport->flags = ntohs(fiph->fip_flags);
...@@ -2349,15 +2345,17 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip, ...@@ -2349,15 +2345,17 @@ static int fcoe_ctlr_vn_parse(struct fcoe_ctlr *fip,
if (dlen != sizeof(struct fip_wwn_desc)) if (dlen != sizeof(struct fip_wwn_desc))
goto len_err; goto len_err;
wwn = (struct fip_wwn_desc *)desc; wwn = (struct fip_wwn_desc *)desc;
rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn); frport->rdata.ids.node_name =
get_unaligned_be64(&wwn->fd_wwn);
break; break;
case FIP_DT_VN_ID: case FIP_DT_VN_ID:
if (dlen != sizeof(struct fip_vn_desc)) if (dlen != sizeof(struct fip_vn_desc))
goto len_err; goto len_err;
vn = (struct fip_vn_desc *)desc; vn = (struct fip_vn_desc *)desc;
memcpy(frport->vn_mac, vn->fd_mac, ETH_ALEN); memcpy(frport->vn_mac, vn->fd_mac, ETH_ALEN);
rdata->ids.port_id = ntoh24(vn->fd_fc_id); frport->rdata.ids.port_id = ntoh24(vn->fd_fc_id);
rdata->ids.port_name = get_unaligned_be64(&vn->fd_wwpn); frport->rdata.ids.port_name =
get_unaligned_be64(&vn->fd_wwpn);
break; break;
case FIP_DT_FC4F: case FIP_DT_FC4F:
if (dlen != sizeof(struct fip_fc4_feat)) if (dlen != sizeof(struct fip_fc4_feat))
...@@ -2403,16 +2401,14 @@ static void fcoe_ctlr_vn_send_claim(struct fcoe_ctlr *fip) ...@@ -2403,16 +2401,14 @@ static void fcoe_ctlr_vn_send_claim(struct fcoe_ctlr *fip)
/** /**
* fcoe_ctlr_vn_probe_req() - handle incoming VN2VN probe request. * fcoe_ctlr_vn_probe_req() - handle incoming VN2VN probe request.
* @fip: The FCoE controller * @fip: The FCoE controller
* @rdata: parsed remote port with frport from the probe request * @frport: parsed FCoE rport from the probe request
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip,
struct fc_rport_priv *rdata) struct fcoe_rport *frport)
{ {
struct fcoe_rport *frport = fcoe_ctlr_rport(rdata); if (frport->rdata.ids.port_id != fip->port_id)
if (rdata->ids.port_id != fip->port_id)
return; return;
switch (fip->state) { switch (fip->state) {
...@@ -2432,7 +2428,7 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, ...@@ -2432,7 +2428,7 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip,
* Probe's REC bit is not set. * Probe's REC bit is not set.
* If we don't reply, we will change our address. * If we don't reply, we will change our address.
*/ */
if (fip->lp->wwpn > rdata->ids.port_name && if (fip->lp->wwpn > frport->rdata.ids.port_name &&
!(frport->flags & FIP_FL_REC_OR_P2P)) { !(frport->flags & FIP_FL_REC_OR_P2P)) {
LIBFCOE_FIP_DBG(fip, "vn_probe_req: " LIBFCOE_FIP_DBG(fip, "vn_probe_req: "
"port_id collision\n"); "port_id collision\n");
...@@ -2456,14 +2452,14 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip, ...@@ -2456,14 +2452,14 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip,
/** /**
* fcoe_ctlr_vn_probe_reply() - handle incoming VN2VN probe reply. * fcoe_ctlr_vn_probe_reply() - handle incoming VN2VN probe reply.
* @fip: The FCoE controller * @fip: The FCoE controller
* @rdata: parsed remote port with frport from the probe request * @frport: parsed FCoE rport from the probe request
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip, static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip,
struct fc_rport_priv *rdata) struct fcoe_rport *frport)
{ {
if (rdata->ids.port_id != fip->port_id) if (frport->rdata.ids.port_id != fip->port_id)
return; return;
switch (fip->state) { switch (fip->state) {
case FIP_ST_VNMP_START: case FIP_ST_VNMP_START:
...@@ -2486,11 +2482,11 @@ static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip, ...@@ -2486,11 +2482,11 @@ static void fcoe_ctlr_vn_probe_reply(struct fcoe_ctlr *fip,
/** /**
* fcoe_ctlr_vn_add() - Add a VN2VN entry to the list, based on a claim reply. * fcoe_ctlr_vn_add() - Add a VN2VN entry to the list, based on a claim reply.
* @fip: The FCoE controller * @fip: The FCoE controller
* @new: newly-parsed remote port with frport as a template for new rdata * @new: newly-parsed FCoE rport as a template for new rdata
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fcoe_rport *new)
{ {
struct fc_lport *lport = fip->lp; struct fc_lport *lport = fip->lp;
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
...@@ -2498,7 +2494,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) ...@@ -2498,7 +2494,7 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new)
struct fcoe_rport *frport; struct fcoe_rport *frport;
u32 port_id; u32 port_id;
port_id = new->ids.port_id; port_id = new->rdata.ids.port_id;
if (port_id == fip->port_id) if (port_id == fip->port_id)
return; return;
...@@ -2515,22 +2511,28 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new) ...@@ -2515,22 +2511,28 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new)
rdata->disc_id = lport->disc.disc_id; rdata->disc_id = lport->disc.disc_id;
ids = &rdata->ids; ids = &rdata->ids;
if ((ids->port_name != -1 && ids->port_name != new->ids.port_name) || if ((ids->port_name != -1 &&
(ids->node_name != -1 && ids->node_name != new->ids.node_name)) { ids->port_name != new->rdata.ids.port_name) ||
(ids->node_name != -1 &&
ids->node_name != new->rdata.ids.node_name)) {
mutex_unlock(&rdata->rp_mutex); mutex_unlock(&rdata->rp_mutex);
LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id); LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id);
fc_rport_logoff(rdata); fc_rport_logoff(rdata);
mutex_lock(&rdata->rp_mutex); mutex_lock(&rdata->rp_mutex);
} }
ids->port_name = new->ids.port_name; ids->port_name = new->rdata.ids.port_name;
ids->node_name = new->ids.node_name; ids->node_name = new->rdata.ids.node_name;
mutex_unlock(&rdata->rp_mutex); mutex_unlock(&rdata->rp_mutex);
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n", LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n",
port_id, frport->fcoe_len ? "old" : "new", port_id, frport->fcoe_len ? "old" : "new",
rdata->rp_state); rdata->rp_state);
*frport = *fcoe_ctlr_rport(new); frport->fcoe_len = new->fcoe_len;
frport->flags = new->flags;
frport->login_count = new->login_count;
memcpy(frport->enode_mac, new->enode_mac, ETH_ALEN);
memcpy(frport->vn_mac, new->vn_mac, ETH_ALEN);
frport->time = 0; frport->time = 0;
} }
...@@ -2562,16 +2564,14 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac) ...@@ -2562,16 +2564,14 @@ static int fcoe_ctlr_vn_lookup(struct fcoe_ctlr *fip, u32 port_id, u8 *mac)
/** /**
* fcoe_ctlr_vn_claim_notify() - handle received FIP VN2VN Claim Notification * fcoe_ctlr_vn_claim_notify() - handle received FIP VN2VN Claim Notification
* @fip: The FCoE controller * @fip: The FCoE controller
* @new: newly-parsed remote port with frport as a template for new rdata * @new: newly-parsed FCoE rport as a template for new rdata
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip,
struct fc_rport_priv *new) struct fcoe_rport *new)
{ {
struct fcoe_rport *frport = fcoe_ctlr_rport(new); if (new->flags & FIP_FL_REC_OR_P2P) {
if (frport->flags & FIP_FL_REC_OR_P2P) {
LIBFCOE_FIP_DBG(fip, "send probe req for P2P/REC\n"); LIBFCOE_FIP_DBG(fip, "send probe req for P2P/REC\n");
fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0);
return; return;
...@@ -2580,7 +2580,7 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, ...@@ -2580,7 +2580,7 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip,
case FIP_ST_VNMP_START: case FIP_ST_VNMP_START:
case FIP_ST_VNMP_PROBE1: case FIP_ST_VNMP_PROBE1:
case FIP_ST_VNMP_PROBE2: case FIP_ST_VNMP_PROBE2:
if (new->ids.port_id == fip->port_id) { if (new->rdata.ids.port_id == fip->port_id) {
LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " LIBFCOE_FIP_DBG(fip, "vn_claim_notify: "
"restart, state %d\n", "restart, state %d\n",
fip->state); fip->state);
...@@ -2589,8 +2589,8 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, ...@@ -2589,8 +2589,8 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip,
break; break;
case FIP_ST_VNMP_CLAIM: case FIP_ST_VNMP_CLAIM:
case FIP_ST_VNMP_UP: case FIP_ST_VNMP_UP:
if (new->ids.port_id == fip->port_id) { if (new->rdata.ids.port_id == fip->port_id) {
if (new->ids.port_name > fip->lp->wwpn) { if (new->rdata.ids.port_name > fip->lp->wwpn) {
LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " LIBFCOE_FIP_DBG(fip, "vn_claim_notify: "
"restart, port_id collision\n"); "restart, port_id collision\n");
fcoe_ctlr_vn_restart(fip); fcoe_ctlr_vn_restart(fip);
...@@ -2602,15 +2602,16 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, ...@@ -2602,15 +2602,16 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip,
break; break;
} }
LIBFCOE_FIP_DBG(fip, "vn_claim_notify: send reply to %x\n", LIBFCOE_FIP_DBG(fip, "vn_claim_notify: send reply to %x\n",
new->ids.port_id); new->rdata.ids.port_id);
fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, frport->enode_mac, fcoe_ctlr_vn_send(fip, FIP_SC_VN_CLAIM_REP, new->enode_mac,
min((u32)frport->fcoe_len, min((u32)new->fcoe_len,
fcoe_ctlr_fcoe_size(fip))); fcoe_ctlr_fcoe_size(fip)));
fcoe_ctlr_vn_add(fip, new); fcoe_ctlr_vn_add(fip, new);
break; break;
default: default:
LIBFCOE_FIP_DBG(fip, "vn_claim_notify: " LIBFCOE_FIP_DBG(fip, "vn_claim_notify: "
"ignoring claim from %x\n", new->ids.port_id); "ignoring claim from %x\n",
new->rdata.ids.port_id);
break; break;
} }
} }
...@@ -2618,15 +2619,15 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip, ...@@ -2618,15 +2619,15 @@ static void fcoe_ctlr_vn_claim_notify(struct fcoe_ctlr *fip,
/** /**
* fcoe_ctlr_vn_claim_resp() - handle received Claim Response * fcoe_ctlr_vn_claim_resp() - handle received Claim Response
* @fip: The FCoE controller that received the frame * @fip: The FCoE controller that received the frame
* @new: newly-parsed remote port with frport from the Claim Response * @new: newly-parsed FCoE rport from the Claim Response
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip, static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip,
struct fc_rport_priv *new) struct fcoe_rport *new)
{ {
LIBFCOE_FIP_DBG(fip, "claim resp from from rport %x - state %s\n", LIBFCOE_FIP_DBG(fip, "claim resp from from rport %x - state %s\n",
new->ids.port_id, fcoe_ctlr_state(fip->state)); new->rdata.ids.port_id, fcoe_ctlr_state(fip->state));
if (fip->state == FIP_ST_VNMP_UP || fip->state == FIP_ST_VNMP_CLAIM) if (fip->state == FIP_ST_VNMP_UP || fip->state == FIP_ST_VNMP_CLAIM)
fcoe_ctlr_vn_add(fip, new); fcoe_ctlr_vn_add(fip, new);
} }
...@@ -2634,28 +2635,28 @@ static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip, ...@@ -2634,28 +2635,28 @@ static void fcoe_ctlr_vn_claim_resp(struct fcoe_ctlr *fip,
/** /**
* fcoe_ctlr_vn_beacon() - handle received beacon. * fcoe_ctlr_vn_beacon() - handle received beacon.
* @fip: The FCoE controller that received the frame * @fip: The FCoE controller that received the frame
* @new: newly-parsed remote port with frport from the Beacon * @new: newly-parsed FCoE rport from the Beacon
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,
struct fc_rport_priv *new) struct fcoe_rport *new)
{ {
struct fc_lport *lport = fip->lp; struct fc_lport *lport = fip->lp;
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
struct fcoe_rport *frport; struct fcoe_rport *frport;
frport = fcoe_ctlr_rport(new); if (new->flags & FIP_FL_REC_OR_P2P) {
if (frport->flags & FIP_FL_REC_OR_P2P) {
LIBFCOE_FIP_DBG(fip, "p2p beacon while in vn2vn mode\n"); LIBFCOE_FIP_DBG(fip, "p2p beacon while in vn2vn mode\n");
fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0); fcoe_ctlr_vn_send(fip, FIP_SC_VN_PROBE_REQ, fcoe_all_vn2vn, 0);
return; return;
} }
rdata = fc_rport_lookup(lport, new->ids.port_id); rdata = fc_rport_lookup(lport, new->rdata.ids.port_id);
if (rdata) { if (rdata) {
if (rdata->ids.node_name == new->ids.node_name && if (rdata->ids.node_name == new->rdata.ids.node_name &&
rdata->ids.port_name == new->ids.port_name) { rdata->ids.port_name == new->rdata.ids.port_name) {
frport = fcoe_ctlr_rport(rdata); frport = fcoe_ctlr_rport(rdata);
LIBFCOE_FIP_DBG(fip, "beacon from rport %x\n", LIBFCOE_FIP_DBG(fip, "beacon from rport %x\n",
rdata->ids.port_id); rdata->ids.port_id);
if (!frport->time && fip->state == FIP_ST_VNMP_UP) { if (!frport->time && fip->state == FIP_ST_VNMP_UP) {
...@@ -2678,7 +2679,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip, ...@@ -2678,7 +2679,7 @@ static void fcoe_ctlr_vn_beacon(struct fcoe_ctlr *fip,
* Don't add the neighbor yet. * Don't add the neighbor yet.
*/ */
LIBFCOE_FIP_DBG(fip, "beacon from new rport %x. sending claim notify\n", LIBFCOE_FIP_DBG(fip, "beacon from new rport %x. sending claim notify\n",
new->ids.port_id); new->rdata.ids.port_id);
if (time_after(jiffies, if (time_after(jiffies,
fip->sol_time + msecs_to_jiffies(FIP_VN_ANN_WAIT))) fip->sol_time + msecs_to_jiffies(FIP_VN_ANN_WAIT)))
fcoe_ctlr_vn_send_claim(fip); fcoe_ctlr_vn_send_claim(fip);
...@@ -2738,10 +2739,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -2738,10 +2739,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
{ {
struct fip_header *fiph; struct fip_header *fiph;
enum fip_vn2vn_subcode sub; enum fip_vn2vn_subcode sub;
struct { struct fcoe_rport frport = { };
struct fc_rport_priv rdata;
struct fcoe_rport frport;
} buf;
int rc, vlan_id = 0; int rc, vlan_id = 0;
fiph = (struct fip_header *)skb->data; fiph = (struct fip_header *)skb->data;
...@@ -2757,7 +2755,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -2757,7 +2755,7 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
goto drop; goto drop;
} }
rc = fcoe_ctlr_vn_parse(fip, skb, &buf.rdata); rc = fcoe_ctlr_vn_parse(fip, skb, &frport);
if (rc) { if (rc) {
LIBFCOE_FIP_DBG(fip, "vn_recv vn_parse error %d\n", rc); LIBFCOE_FIP_DBG(fip, "vn_recv vn_parse error %d\n", rc);
goto drop; goto drop;
...@@ -2766,19 +2764,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -2766,19 +2764,19 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
mutex_lock(&fip->ctlr_mutex); mutex_lock(&fip->ctlr_mutex);
switch (sub) { switch (sub) {
case FIP_SC_VN_PROBE_REQ: case FIP_SC_VN_PROBE_REQ:
fcoe_ctlr_vn_probe_req(fip, &buf.rdata); fcoe_ctlr_vn_probe_req(fip, &frport);
break; break;
case FIP_SC_VN_PROBE_REP: case FIP_SC_VN_PROBE_REP:
fcoe_ctlr_vn_probe_reply(fip, &buf.rdata); fcoe_ctlr_vn_probe_reply(fip, &frport);
break; break;
case FIP_SC_VN_CLAIM_NOTIFY: case FIP_SC_VN_CLAIM_NOTIFY:
fcoe_ctlr_vn_claim_notify(fip, &buf.rdata); fcoe_ctlr_vn_claim_notify(fip, &frport);
break; break;
case FIP_SC_VN_CLAIM_REP: case FIP_SC_VN_CLAIM_REP:
fcoe_ctlr_vn_claim_resp(fip, &buf.rdata); fcoe_ctlr_vn_claim_resp(fip, &frport);
break; break;
case FIP_SC_VN_BEACON: case FIP_SC_VN_BEACON:
fcoe_ctlr_vn_beacon(fip, &buf.rdata); fcoe_ctlr_vn_beacon(fip, &frport);
break; break;
default: default:
LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub); LIBFCOE_FIP_DBG(fip, "vn_recv unknown subcode %d\n", sub);
...@@ -2802,22 +2800,18 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -2802,22 +2800,18 @@ static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
*/ */
static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip, static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip,
struct sk_buff *skb, struct sk_buff *skb,
struct fc_rport_priv *rdata) struct fcoe_rport *frport)
{ {
struct fip_header *fiph; struct fip_header *fiph;
struct fip_desc *desc = NULL; struct fip_desc *desc = NULL;
struct fip_mac_desc *macd = NULL; struct fip_mac_desc *macd = NULL;
struct fip_wwn_desc *wwn = NULL; struct fip_wwn_desc *wwn = NULL;
struct fcoe_rport *frport;
size_t rlen; size_t rlen;
size_t dlen; size_t dlen;
u32 desc_mask = 0; u32 desc_mask = 0;
u32 dtype; u32 dtype;
u8 sub; u8 sub;
memset(rdata, 0, sizeof(*rdata) + sizeof(*frport));
frport = fcoe_ctlr_rport(rdata);
fiph = (struct fip_header *)skb->data; fiph = (struct fip_header *)skb->data;
frport->flags = ntohs(fiph->fip_flags); frport->flags = ntohs(fiph->fip_flags);
...@@ -2871,7 +2865,8 @@ static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip, ...@@ -2871,7 +2865,8 @@ static int fcoe_ctlr_vlan_parse(struct fcoe_ctlr *fip,
if (dlen != sizeof(struct fip_wwn_desc)) if (dlen != sizeof(struct fip_wwn_desc))
goto len_err; goto len_err;
wwn = (struct fip_wwn_desc *)desc; wwn = (struct fip_wwn_desc *)desc;
rdata->ids.node_name = get_unaligned_be64(&wwn->fd_wwn); frport->rdata.ids.node_name =
get_unaligned_be64(&wwn->fd_wwn);
break; break;
default: default:
LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x " LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x "
...@@ -2957,13 +2952,13 @@ static void fcoe_ctlr_vlan_send(struct fcoe_ctlr *fip, ...@@ -2957,13 +2952,13 @@ static void fcoe_ctlr_vlan_send(struct fcoe_ctlr *fip,
/** /**
* fcoe_ctlr_vlan_disk_reply() - send FIP VLAN Discovery Notification. * fcoe_ctlr_vlan_disk_reply() - send FIP VLAN Discovery Notification.
* @fip: The FCoE controller * @fip: The FCoE controller
* @frport: The newly-parsed FCoE rport from the Discovery Request
* *
* Called with ctlr_mutex held. * Called with ctlr_mutex held.
*/ */
static void fcoe_ctlr_vlan_disc_reply(struct fcoe_ctlr *fip, static void fcoe_ctlr_vlan_disc_reply(struct fcoe_ctlr *fip,
struct fc_rport_priv *rdata) struct fcoe_rport *frport)
{ {
struct fcoe_rport *frport = fcoe_ctlr_rport(rdata);
enum fip_vlan_subcode sub = FIP_SC_VL_NOTE; enum fip_vlan_subcode sub = FIP_SC_VL_NOTE;
if (fip->mode == FIP_MODE_VN2VN) if (fip->mode == FIP_MODE_VN2VN)
...@@ -2982,22 +2977,19 @@ static int fcoe_ctlr_vlan_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -2982,22 +2977,19 @@ static int fcoe_ctlr_vlan_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
{ {
struct fip_header *fiph; struct fip_header *fiph;
enum fip_vlan_subcode sub; enum fip_vlan_subcode sub;
struct { struct fcoe_rport frport = { };
struct fc_rport_priv rdata;
struct fcoe_rport frport;
} buf;
int rc; int rc;
fiph = (struct fip_header *)skb->data; fiph = (struct fip_header *)skb->data;
sub = fiph->fip_subcode; sub = fiph->fip_subcode;
rc = fcoe_ctlr_vlan_parse(fip, skb, &buf.rdata); rc = fcoe_ctlr_vlan_parse(fip, skb, &frport);
if (rc) { if (rc) {
LIBFCOE_FIP_DBG(fip, "vlan_recv vlan_parse error %d\n", rc); LIBFCOE_FIP_DBG(fip, "vlan_recv vlan_parse error %d\n", rc);
goto drop; goto drop;
} }
mutex_lock(&fip->ctlr_mutex); mutex_lock(&fip->ctlr_mutex);
if (sub == FIP_SC_VL_REQ) if (sub == FIP_SC_VL_REQ)
fcoe_ctlr_vlan_disc_reply(fip, &buf.rdata); fcoe_ctlr_vlan_disc_reply(fip, &frport);
mutex_unlock(&fip->ctlr_mutex); mutex_unlock(&fip->ctlr_mutex);
drop: drop:
......
...@@ -2334,6 +2334,8 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h, ...@@ -2334,6 +2334,8 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
case IOACCEL2_SERV_RESPONSE_COMPLETE: case IOACCEL2_SERV_RESPONSE_COMPLETE:
switch (c2->error_data.status) { switch (c2->error_data.status) {
case IOACCEL2_STATUS_SR_TASK_COMP_GOOD: case IOACCEL2_STATUS_SR_TASK_COMP_GOOD:
if (cmd)
cmd->result = 0;
break; break;
case IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND: case IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND:
cmd->result |= SAM_STAT_CHECK_CONDITION; cmd->result |= SAM_STAT_CHECK_CONDITION;
...@@ -2483,8 +2485,10 @@ static void process_ioaccel2_completion(struct ctlr_info *h, ...@@ -2483,8 +2485,10 @@ static void process_ioaccel2_completion(struct ctlr_info *h,
/* check for good status */ /* check for good status */
if (likely(c2->error_data.serv_response == 0 && if (likely(c2->error_data.serv_response == 0 &&
c2->error_data.status == 0)) c2->error_data.status == 0)) {
cmd->result = 0;
return hpsa_cmd_free_and_done(h, c, cmd); return hpsa_cmd_free_and_done(h, c, cmd);
}
/* /*
* Any RAID offload error results in retry which will use * Any RAID offload error results in retry which will use
...@@ -5653,6 +5657,12 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) ...@@ -5653,6 +5657,12 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
if (c == NULL) if (c == NULL)
return SCSI_MLQUEUE_DEVICE_BUSY; return SCSI_MLQUEUE_DEVICE_BUSY;
/*
* This is necessary because the SML doesn't zero out this field during
* error recovery.
*/
cmd->result = 0;
/* /*
* Call alternate submit routine for I/O accelerated commands. * Call alternate submit routine for I/O accelerated commands.
* Retries always go down the normal I/O path. * Retries always go down the normal I/O path.
...@@ -6081,8 +6091,6 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h, ...@@ -6081,8 +6091,6 @@ static struct CommandList *cmd_tagged_alloc(struct ctlr_info *h,
if (idx != h->last_collision_tag) { /* Print once per tag */ if (idx != h->last_collision_tag) { /* Print once per tag */
dev_warn(&h->pdev->dev, dev_warn(&h->pdev->dev,
"%s: tag collision (tag=%d)\n", __func__, idx); "%s: tag collision (tag=%d)\n", __func__, idx);
if (c->scsi_cmd != NULL)
scsi_print_command(c->scsi_cmd);
if (scmd) if (scmd)
scsi_print_command(scmd); scsi_print_command(scmd);
h->last_collision_tag = idx; h->last_collision_tag = idx;
......
...@@ -128,6 +128,7 @@ EXPORT_SYMBOL(fc_rport_lookup); ...@@ -128,6 +128,7 @@ EXPORT_SYMBOL(fc_rport_lookup);
struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
{ {
struct fc_rport_priv *rdata; struct fc_rport_priv *rdata;
size_t rport_priv_size = sizeof(*rdata);
lockdep_assert_held(&lport->disc.disc_mutex); lockdep_assert_held(&lport->disc.disc_mutex);
...@@ -135,7 +136,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id) ...@@ -135,7 +136,9 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
if (rdata) if (rdata)
return rdata; return rdata;
rdata = kzalloc(sizeof(*rdata) + lport->rport_priv_size, GFP_KERNEL); if (lport->rport_priv_size > 0)
rport_priv_size = lport->rport_priv_size;
rdata = kzalloc(rport_priv_size, GFP_KERNEL);
if (!rdata) if (!rdata)
return NULL; return NULL;
......
...@@ -2703,6 +2703,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2703,6 +2703,8 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
{ {
u64 required_mask, coherent_mask; u64 required_mask, coherent_mask;
struct sysinfo s; struct sysinfo s;
/* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */
int dma_mask = (ioc->hba_mpi_version_belonged > MPI2_VERSION) ? 63 : 64;
if (ioc->is_mcpu_endpoint) if (ioc->is_mcpu_endpoint)
goto try_32bit; goto try_32bit;
...@@ -2712,17 +2714,17 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev) ...@@ -2712,17 +2714,17 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
goto try_32bit; goto try_32bit;
if (ioc->dma_mask) if (ioc->dma_mask)
coherent_mask = DMA_BIT_MASK(64); coherent_mask = DMA_BIT_MASK(dma_mask);
else else
coherent_mask = DMA_BIT_MASK(32); coherent_mask = DMA_BIT_MASK(32);
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) || if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(dma_mask)) ||
dma_set_coherent_mask(&pdev->dev, coherent_mask)) dma_set_coherent_mask(&pdev->dev, coherent_mask))
goto try_32bit; goto try_32bit;
ioc->base_add_sg_single = &_base_add_sg_single_64; ioc->base_add_sg_single = &_base_add_sg_single_64;
ioc->sge_size = sizeof(Mpi2SGESimple64_t); ioc->sge_size = sizeof(Mpi2SGESimple64_t);
ioc->dma_mask = 64; ioc->dma_mask = dma_mask;
goto out; goto out;
try_32bit: try_32bit:
...@@ -2744,7 +2746,7 @@ static int ...@@ -2744,7 +2746,7 @@ static int
_base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc, _base_change_consistent_dma_mask(struct MPT3SAS_ADAPTER *ioc,
struct pci_dev *pdev) struct pci_dev *pdev)
{ {
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(ioc->dma_mask))) {
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
return -ENODEV; return -ENODEV;
} }
...@@ -4989,7 +4991,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -4989,7 +4991,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
total_sz += sz; total_sz += sz;
} while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));
if (ioc->dma_mask == 64) { if (ioc->dma_mask > 32) {
if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) { if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) {
ioc_warn(ioc, "no suitable consistent DMA mask for %s\n", ioc_warn(ioc, "no suitable consistent DMA mask for %s\n",
pci_name(ioc->pdev)); pci_name(ioc->pdev));
......
...@@ -4877,7 +4877,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) ...@@ -4877,7 +4877,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
ql_log(ql_log_warn, vha, 0xd049, ql_log(ql_log_warn, vha, 0xd049,
"Failed to allocate ct_sns request.\n"); "Failed to allocate ct_sns request.\n");
kfree(fcport); kfree(fcport);
fcport = NULL; return NULL;
} }
INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn); INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn);
......
...@@ -229,6 +229,7 @@ struct fcoe_fcf { ...@@ -229,6 +229,7 @@ struct fcoe_fcf {
* @vn_mac: VN_Node assigned MAC address for data * @vn_mac: VN_Node assigned MAC address for data
*/ */
struct fcoe_rport { struct fcoe_rport {
struct fc_rport_priv rdata;
unsigned long time; unsigned long time;
u16 fcoe_len; u16 fcoe_len;
u16 flags; u16 flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment