|
@@ -2017,7 +2017,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);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2281,7 +2281,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;
|
|
@@ -2289,16 +2289,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);
|
|
|
|
|
|
|
@@ -2361,15 +2357,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);
|
|
|
|
|
- rdata->ids.port_name = get_unaligned_be64(&vn->fd_wwpn);
|
|
|
|
|
|
|
+ frport->rdata.ids.port_id = ntoh24(vn->fd_fc_id);
|
|
|
|
|
+ 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))
|
|
@@ -2750,10 +2748,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 fc_rport_priv rdata;
|
|
|
|
|
- struct fcoe_rport frport;
|
|
|
|
|
- } buf;
|
|
|
|
|
|
|
+ struct fcoe_rport frport = { };
|
|
|
int rc, vlan_id = 0;
|
|
int rc, vlan_id = 0;
|
|
|
|
|
|
|
|
fiph = (struct fip_header *)skb->data;
|
|
fiph = (struct fip_header *)skb->data;
|
|
@@ -2769,7 +2764,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;
|
|
@@ -2778,19 +2773,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.rdata);
|
|
|
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.rdata);
|
|
|
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.rdata);
|
|
|
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.rdata);
|
|
|
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.rdata);
|
|
|
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);
|
|
@@ -2814,22 +2809,18 @@ drop:
|
|
|
*/
|
|
*/
|
|
|
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);
|
|
|
|
|
|
|
@@ -2883,7 +2874,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 "
|
|
@@ -2994,22 +2986,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 fc_rport_priv rdata;
|
|
|
|
|
- struct fcoe_rport frport;
|
|
|
|
|
- } buf;
|
|
|
|
|
|
|
+ struct fcoe_rport frport = { };
|
|
|
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.rdata);
|
|
|
mutex_unlock(&fip->ctlr_mutex);
|
|
mutex_unlock(&fip->ctlr_mutex);
|
|
|
|
|
|
|
|
drop:
|
|
drop:
|