From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org
Cc: Chris Leech <christopher.leech@intel.com>,
Robert Love <robert.w.love@intel.com>
Subject: [PATCH 15/64] fcoe: move FIP controller from fcoe_port to fcoe_interface
Date: Tue, 25 Aug 2009 13:59:46 -0700 [thread overview]
Message-ID: <20090825205946.1553.99415.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090825205826.1553.94414.stgit@localhost.localdomain>
From: Chris Leech <christopher.leech@intel.com>
There is only one FIP state per net_device, so the FIP controller needs to be
moved from the per-SCSI-host fcoe_port to the per-net_device fcoe_interface
structure.
Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 83 +++++++++++++++++++++-------------------------
drivers/scsi/fcoe/fcoe.h | 4 +-
2 files changed, 39 insertions(+), 48 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index c215235..01519c7 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -152,11 +152,9 @@ static int fcoe_fip_recv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct fcoe_interface *fcoe;
- struct fcoe_port *port;
fcoe = container_of(ptype, struct fcoe_interface, fip_packet_type);
- port = fcoe->priv;
- fcoe_ctlr_recv(&port->ctlr, skb);
+ fcoe_ctlr_recv(&fcoe->ctlr, skb);
return 0;
}
@@ -167,7 +165,7 @@ static int fcoe_fip_recv(struct sk_buff *skb, struct net_device *dev,
*/
static void fcoe_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
{
- skb->dev = fcoe_from_ctlr(fip)->fcoe->netdev;
+ skb->dev = fcoe_from_ctlr(fip)->netdev;
dev_queue_xmit(skb);
}
@@ -183,11 +181,8 @@ static void fcoe_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
static void fcoe_update_src_mac(struct fcoe_ctlr *fip, u8 *old, u8 *new)
{
struct fcoe_interface *fcoe;
- struct fcoe_port *port;
-
- port = fcoe_from_ctlr(fip);
- fcoe = port->fcoe;
+ fcoe = fcoe_from_ctlr(fip);
rtnl_lock();
if (!is_zero_ether_addr(old))
dev_unicast_delete(fcoe->netdev, old);
@@ -244,10 +239,10 @@ void fcoe_netdev_cleanup(struct fcoe_port *port)
rtnl_lock();
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
dev_unicast_delete(fcoe->netdev, flogi_maddr);
- if (!is_zero_ether_addr(port->ctlr.data_src_addr))
- dev_unicast_delete(fcoe->netdev, port->ctlr.data_src_addr);
- if (port->ctlr.spma)
- dev_unicast_delete(fcoe->netdev, port->ctlr.ctl_src_addr);
+ if (!is_zero_ether_addr(fcoe->ctlr.data_src_addr))
+ dev_unicast_delete(fcoe->netdev, fcoe->ctlr.data_src_addr);
+ if (fcoe->ctlr.spma)
+ dev_unicast_delete(fcoe->netdev, fcoe->ctlr.ctl_src_addr);
dev_mc_delete(fcoe->netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
}
@@ -285,7 +280,7 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
/* Setup lport private data to point to fcoe softc */
port = lport_priv(lp);
fcoe = port->fcoe;
- port->ctlr.lp = lp;
+ fcoe->ctlr.lp = lp;
fcoe->netdev = netdev;
/* Do not support for bonding device */
@@ -334,17 +329,17 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
rcu_read_lock();
for_each_dev_addr(netdev, ha) {
if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
- (is_valid_ether_addr(port->ctlr.ctl_src_addr))) {
- memcpy(port->ctlr.ctl_src_addr, ha->addr, ETH_ALEN);
- port->ctlr.spma = 1;
+ (is_valid_ether_addr(fcoe->ctlr.ctl_src_addr))) {
+ memcpy(fcoe->ctlr.ctl_src_addr, ha->addr, ETH_ALEN);
+ fcoe->ctlr.spma = 1;
break;
}
}
rcu_read_unlock();
/* setup Source Mac Address */
- if (!port->ctlr.spma)
- memcpy(port->ctlr.ctl_src_addr, netdev->dev_addr,
+ if (!fcoe->ctlr.spma)
+ memcpy(fcoe->ctlr.ctl_src_addr, netdev->dev_addr,
netdev->addr_len);
wwnn = fcoe_wwn_from_mac(netdev->dev_addr, 1, 0);
@@ -361,8 +356,8 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
rtnl_lock();
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
dev_unicast_add(netdev, flogi_maddr);
- if (port->ctlr.spma)
- dev_unicast_add(netdev, port->ctlr.ctl_src_addr);
+ if (fcoe->ctlr.spma)
+ dev_unicast_add(netdev, fcoe->ctlr.ctl_src_addr);
dev_mc_add(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
@@ -537,7 +532,7 @@ static void fcoe_if_destroy(struct fc_lport *lport)
fcoe_netdev_cleanup(port);
/* tear-down the FCoE controller */
- fcoe_ctlr_destroy(&port->ctlr);
+ fcoe_ctlr_destroy(&fcoe->ctlr);
/* Free queued packets for the per-CPU receive threads */
fcoe_percpu_clean(lport);
@@ -662,9 +657,9 @@ static struct fc_lport *fcoe_if_create(struct net_device *netdev,
/*
* Initialize FIP.
*/
- fcoe_ctlr_init(&port->ctlr);
- port->ctlr.send = fcoe_fip_send;
- port->ctlr.update_mac = fcoe_update_src_mac;
+ fcoe_ctlr_init(&fcoe->ctlr);
+ fcoe->ctlr.send = fcoe_fip_send;
+ fcoe->ctlr.update_mac = fcoe_update_src_mac;
/* configure lport network properties */
rc = fcoe_netdev_config(lport, netdev);
@@ -714,7 +709,7 @@ static struct fc_lport *fcoe_if_create(struct net_device *netdev,
fc_fabric_login(lport);
if (!fcoe_link_ok(lport))
- fcoe_ctlr_link_up(&port->ctlr);
+ fcoe_ctlr_link_up(&fcoe->ctlr);
dev_hold(netdev);
@@ -929,14 +924,12 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
struct fc_lport *lp;
struct fcoe_rcv_info *fr;
struct fcoe_interface *fcoe;
- struct fcoe_port *port;
struct fc_frame_header *fh;
struct fcoe_percpu_s *fps;
unsigned int cpu;
fcoe = container_of(ptype, struct fcoe_interface, fcoe_packet_type);
- port = fcoe->priv;
- lp = port->ctlr.lp;
+ lp = fcoe->ctlr.lp;
if (unlikely(lp == NULL)) {
FCOE_NETDEV_DBG(dev, "Cannot find hba structure");
goto err2;
@@ -1137,13 +1130,13 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
unsigned int hlen; /* header length implies the version */
unsigned int tlen; /* trailer length */
unsigned int elen; /* eth header, may include vlan */
- struct fcoe_port *port;
+ struct fcoe_port *port = lport_priv(lp);
+ struct fcoe_interface *fcoe = port->fcoe;
u8 sof, eof;
struct fcoe_hdr *hp;
WARN_ON((fr_len(fp) % sizeof(u32)) != 0);
- port = lport_priv(lp);
fh = fc_frame_header_get(fp);
skb = fp_skb(fp);
wlen = skb->len / FCOE_WORD_TO_BYTE;
@@ -1154,7 +1147,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
}
if (unlikely(fh->fh_r_ctl == FC_RCTL_ELS_REQ) &&
- fcoe_ctlr_els_send(&port->ctlr, skb))
+ fcoe_ctlr_els_send(&fcoe->ctlr, skb))
return 0;
sof = fr_sof(fp);
@@ -1205,21 +1198,21 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
skb_reset_network_header(skb);
skb->mac_len = elen;
skb->protocol = htons(ETH_P_FCOE);
- skb->dev = port->fcoe->netdev;
+ skb->dev = fcoe->netdev;
/* fill up mac and fcoe headers */
eh = eth_hdr(skb);
eh->h_proto = htons(ETH_P_FCOE);
- if (port->ctlr.map_dest)
+ if (fcoe->ctlr.map_dest)
fc_fcoe_set_mac(eh->h_dest, fh->fh_d_id);
else
/* insert GW address */
- memcpy(eh->h_dest, port->ctlr.dest_addr, ETH_ALEN);
+ memcpy(eh->h_dest, fcoe->ctlr.dest_addr, ETH_ALEN);
- if (unlikely(port->ctlr.flogi_oxid != FC_XID_UNKNOWN))
- memcpy(eh->h_source, port->ctlr.ctl_src_addr, ETH_ALEN);
+ if (unlikely(fcoe->ctlr.flogi_oxid != FC_XID_UNKNOWN))
+ memcpy(eh->h_source, fcoe->ctlr.ctl_src_addr, ETH_ALEN);
else
- memcpy(eh->h_source, port->ctlr.data_src_addr, ETH_ALEN);
+ memcpy(eh->h_source, fcoe->ctlr.data_src_addr, ETH_ALEN);
hp = (struct fcoe_hdr *)(eh + 1);
memset(hp, 0, sizeof(*hp));
@@ -1382,8 +1375,8 @@ int fcoe_percpu_receive_thread(void *arg)
}
fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED;
}
- if (unlikely(port->ctlr.flogi_oxid != FC_XID_UNKNOWN) &&
- fcoe_ctlr_recv_flogi(&port->ctlr, fp, mac)) {
+ if (unlikely(port->fcoe->ctlr.flogi_oxid != FC_XID_UNKNOWN) &&
+ fcoe_ctlr_recv_flogi(&port->fcoe->ctlr, fp, mac)) {
fc_frame_free(fp);
continue;
}
@@ -1482,7 +1475,6 @@ static int fcoe_device_notification(struct notifier_block *notifier,
struct fc_lport *lp = NULL;
struct net_device *netdev = ptr;
struct fcoe_interface *fcoe;
- struct fcoe_port *port = NULL;
struct fcoe_dev_stats *stats;
u32 link_possible = 1;
u32 mfs;
@@ -1490,9 +1482,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
read_lock(&fcoe_hostlist_lock);
list_for_each_entry(fcoe, &fcoe_hostlist, list) {
- port = fcoe->priv;
if (fcoe->netdev == netdev) {
- lp = port->ctlr.lp;
+ lp = fcoe->ctlr.lp;
break;
}
}
@@ -1523,8 +1514,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
"from netdev netlink\n", event);
}
if (link_possible && !fcoe_link_ok(lp))
- fcoe_ctlr_link_up(&port->ctlr);
- else if (fcoe_ctlr_link_down(&port->ctlr)) {
+ fcoe_ctlr_link_up(&fcoe->ctlr);
+ else if (fcoe_ctlr_link_down(&fcoe->ctlr)) {
stats = fc_lport_get_stats(lp);
stats->LinkFailureCount++;
fcoe_clean_pending_queue(lp);
@@ -1841,7 +1832,7 @@ struct fc_lport *fcoe_hostlist_lookup(const struct net_device *netdev)
fcoe = fcoe_hostlist_lookup_port(netdev);
read_unlock(&fcoe_hostlist_lock);
- return (fcoe) ? fcoe->priv->ctlr.lp : NULL;
+ return (fcoe) ? fcoe->ctlr.lp : NULL;
}
/**
@@ -1941,7 +1932,7 @@ static void __exit fcoe_exit(void)
/* releases the associated fcoe hosts */
list_for_each_entry_safe(fcoe, tmp, &fcoe_hostlist, list)
- fcoe_if_destroy(fcoe->priv->ctlr.lp);
+ fcoe_if_destroy(fcoe->ctlr.lp);
unregister_hotcpu_notifier(&fcoe_cpu_notifier);
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index 685aa9d..5b190b5 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -85,6 +85,7 @@ struct fcoe_interface {
struct net_device *netdev;
struct packet_type fcoe_packet_type;
struct packet_type fip_packet_type;
+ struct fcoe_ctlr ctlr;
};
/*
@@ -97,10 +98,9 @@ struct fcoe_port {
struct sk_buff_head fcoe_pending_queue;
u8 fcoe_pending_queue_active;
struct timer_list timer; /* queue timer */
- struct fcoe_ctlr ctlr;
};
-#define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_port, ctlr)
+#define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_interface, ctlr)
static inline struct net_device *fcoe_netdev(const struct fc_lport *lp)
{
next prev parent reply other threads:[~2009-08-25 20:59 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 20:58 [PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2009-08-25 20:58 ` [PATCH 01/64] fcoe: Add format spacing to FCOE_NETDEV_DBG debug macro Robert Love
2009-08-25 20:58 ` [PATCH 02/64] libfc: Fix misleading debug statement Robert Love
2009-08-25 20:58 ` [PATCH 03/64] fcoe: libfcoe: extra semicolon in CHECK_LOGGING macros causes compile error Robert Love
2009-08-25 20:58 ` [PATCH 04/64] fcoe, libfc: adds per cpu exch pool within exchange manager(EM) Robert Love
2009-08-25 20:58 ` [PATCH 05/64] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lock Robert Love
2009-08-25 20:58 ` [PATCH 06/64] libfc: Export FC headers Robert Love
2009-08-27 10:27 ` Christof Schmitt
2009-08-27 17:42 ` Robert Love
2009-08-28 8:32 ` Swen Schillig
2009-08-28 16:58 ` Robert Love
2009-08-25 20:59 ` [PATCH 07/64] fcoe: Add sysfs parameter to fcoe for minimum DDP read I/O size Robert Love
2009-08-25 20:59 ` [PATCH 08/64] libfcoe: fcoe_ctlr_destroy use cancel_work_sync instead of flush_work Robert Love
2009-08-25 20:59 ` [PATCH 09/64] fcoe: fix missing error check in call to fcoe_if_init Robert Love
2009-08-25 20:59 ` [PATCH 10/64] fcoe: remove unnecessary list and lock initializations Robert Love
2009-08-25 20:59 ` [PATCH 11/64] fcoe: interface changes to fcoe_if_create and fcoe_if_destroy Robert Love
2009-08-25 20:59 ` [PATCH 12/64] fcoe: Introduce and allocate fcoe_interface structure, 1:1 with net_device Robert Love
2009-08-25 20:59 ` [PATCH 13/64] fcoe: move netdev to fcoe_interface Robert Love
2009-08-25 20:59 ` [PATCH 14/64] fcoe: move packet handlers from fcoe_port " Robert Love
2009-08-25 20:59 ` Robert Love [this message]
2009-08-25 20:59 ` [PATCH 16/64] fcoe: move offload exchange manager pointer " Robert Love
2009-08-25 20:59 ` [PATCH 17/64] fcoe: remove fcoe_interface->priv pointer Robert Love
2009-08-25 21:00 ` [PATCH 18/64] fcoe: fcoe_interface create, destroy and refcounting Robert Love
2009-08-25 21:00 ` [PATCH 19/64] fcoe: split out per interface setup Robert Love
2009-08-25 21:00 ` [PATCH 20/64] fcoe: add mutex to protect create and destroy Robert Love
2009-08-25 21:00 ` [PATCH 21/64] fcoe: move the host-list add/remove to keep out VN_Ports Robert Love
2009-08-25 21:00 ` [PATCH 22/64] fcoe: Fix module ref count bug by adding NETDEV UNREGISTER handling Robert Love
2009-08-25 21:00 ` [PATCH 23/64] fcoe: use rtnl mutex in place of hostlist lock Robert Love
2009-08-25 21:00 ` [PATCH 24/64] libfc: prepare to split off struct fc_rport_priv from fc_rport_libfc_priv Robert Love
2009-08-25 21:00 ` [PATCH 25/64] libfc: change interface for rport_create Robert Love
2009-08-25 21:00 ` [PATCH 26/64] libfc: fix RPORT_TO_PRIV and PRIV_TO_RPORT() macros Robert Love
2009-08-25 21:00 ` [PATCH 27/64] libfc: make fc_rport_priv the primary rport interface Robert Love
2009-08-25 21:00 ` [PATCH 28/64] libfc: change elsct to use FC_ID instead of rdata Robert Love
2009-08-25 21:01 ` [PATCH 29/64] libfc: make rport structure optional Robert Love
2009-08-25 21:01 ` [PATCH 30/64] libfc: rearrange code in fc_rport_work Robert Love
2009-08-25 21:01 ` [PATCH 31/64] libfc: rename rport event CREATED to READY Robert Love
2009-08-25 21:01 ` [PATCH 32/64] libfc: don't create dummy (rogue) remote ports Robert Love
2009-08-25 21:01 ` [PATCH 33/64] libfc: fix rport event race between READY and LOGO Robert Love
2009-08-25 21:01 ` [PATCH 34/64] libfc: eliminate disc->event Robert Love
2009-08-25 21:01 ` [PATCH 35/64] libfc: remove unused disc->delay element Robert Love
2009-08-25 21:01 ` [PATCH 36/64] libfc: rport debug messages were printing pointer values Robert Love
2009-08-25 21:01 ` [PATCH 37/64] libfc: simplify fc_lport_rport_callback Robert Love
2009-08-25 21:01 ` [PATCH 38/64] libfc: make rport module maintain the rport list Robert Love
2009-08-25 21:01 ` [PATCH 39/64] libfc: have rport_create do a lookup for pre-existing rports first Robert Love
2009-08-25 21:02 ` [PATCH 40/64] libfc: change to make remote port callback optional Robert Love
2009-08-25 21:02 ` [PATCH 41/64] libfc: move rport_lookup into fc_rport.c Robert Love
2009-08-25 21:02 ` [PATCH 42/64] libfc: do not log off rports before or after discovery Robert Love
2009-08-25 21:02 ` [PATCH 43/64] libfc: discovery restart sequence error fix Robert Love
2009-08-25 21:02 ` [PATCH 44/64] libfc: rearrange code in fc_disc_gpn_ft_resp() Robert Love
2009-08-25 21:02 ` [PATCH 45/64] libfc: handle discovery failure more correctly Robert Love
2009-08-25 21:02 ` [PATCH 46/64] libfc: fix: empty zone causes endless discovery retries Robert Love
2009-08-25 21:02 ` [PATCH 47/64] libfc: discovery retry should clear pending first Robert Love
2009-08-25 21:02 ` [PATCH 48/64] libfc: discovery gpn_ft parse bug Robert Love
2009-08-25 21:02 ` [PATCH 49/64] libfc: clean up point-to-point discovery code Robert Love
2009-08-25 21:02 ` [PATCH 50/64] libfc: don't do discovery before callback is set Robert Love
2009-08-25 21:02 ` [PATCH 51/64] libfc: Initialize fc_rport_identifiers inside fc_rport_create Robert Love
2009-08-25 21:03 ` [PATCH 52/64] libfc: Always reset remote port roles when receiving PRLI Robert Love
2009-08-25 21:03 ` [PATCH 53/64] libfc: move remote port lookup for ELS requests into fc_rport.c Robert Love
2009-08-25 21:03 ` [PATCH 54/64] libfc: fix: rport_recv_req needs disc_mutex when calling rport_lookup Robert Love
2009-08-25 21:03 ` [PATCH 55/64] libfc: improve debug messages for ELS response handlers Robert Love
2009-08-25 21:03 ` [PATCH 56/64] libfc: correctly handle incoming PLOGI request Robert Love
2009-08-25 21:03 ` [PATCH 57/64] libfc: fix rport error handling for login-required and invalid ops Robert Love
2009-08-25 21:03 ` [PATCH 58/64] libfc: re-login to remote ports that send us LOGO Robert Love
2009-08-25 21:03 ` [PATCH 59/64] libfc: LOGO response code had extraeous enter_rtv Robert Love
2009-08-25 21:03 ` [PATCH 60/64] libfc: use ADISC to verify rport login state Robert Love
2009-08-25 21:03 ` [PATCH 61/64] libfc: fix handling of incoming Discover Address (ADISC) requests Robert Love
2009-08-25 21:03 ` [PATCH 62/64] libfc: send GPN_ID in reaction to single-port RSCNs Robert Love
2009-08-25 21:04 ` [PATCH 63/64] libfc: don't swap OX_ID and RX_ID when sending BA_RJT Robert Love
2009-08-25 21:04 ` [PATCH 64/64] fcoe: flush per-cpu thread work when destroying interface Robert Love
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090825205946.1553.99415.stgit@localhost.localdomain \
--to=robert.w.love@intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=christopher.leech@intel.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.