struct packet_type *ptype,
struct net_device *orig_dev)
{
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
- fc = container_of(ptype, struct fcoe_softc, fip_packet_type);
- fcoe_ctlr_recv(&fc->ctlr, skb);
+ port = container_of(ptype, struct fcoe_port, fip_packet_type);
+ fcoe_ctlr_recv(&port->ctlr, skb);
return 0;
}
*/
static void fcoe_update_src_mac(struct fcoe_ctlr *fip, u8 *old, u8 *new)
{
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
- fc = fcoe_from_ctlr(fip);
+ port = fcoe_from_ctlr(fip);
rtnl_lock();
if (!is_zero_ether_addr(old))
- dev_unicast_delete(fc->netdev, old);
- dev_unicast_add(fc->netdev, new);
+ dev_unicast_delete(port->netdev, old);
+ dev_unicast_add(port->netdev, new);
rtnl_unlock();
}
/**
* fcoe_netdev_cleanup() - clean up netdev configurations
- * @fc: ptr to the fcoe_softc
+ * @port: ptr to the fcoe_port
*/
-void fcoe_netdev_cleanup(struct fcoe_softc *fc)
+void fcoe_netdev_cleanup(struct fcoe_port *port)
{
u8 flogi_maddr[ETH_ALEN];
/* Don't listen for Ethernet packets anymore */
- dev_remove_pack(&fc->fcoe_packet_type);
- dev_remove_pack(&fc->fip_packet_type);
+ dev_remove_pack(&port->fcoe_packet_type);
+ dev_remove_pack(&port->fip_packet_type);
/* Delete secondary MAC addresses */
rtnl_lock();
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
- dev_unicast_delete(fc->netdev, flogi_maddr);
- if (!is_zero_ether_addr(fc->ctlr.data_src_addr))
- dev_unicast_delete(fc->netdev, fc->ctlr.data_src_addr);
- if (fc->ctlr.spma)
- dev_unicast_delete(fc->netdev, fc->ctlr.ctl_src_addr);
- dev_mc_delete(fc->netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
+ dev_unicast_delete(port->netdev, flogi_maddr);
+ if (!is_zero_ether_addr(port->ctlr.data_src_addr))
+ dev_unicast_delete(port->netdev, port->ctlr.data_src_addr);
+ if (port->ctlr.spma)
+ dev_unicast_delete(port->netdev, port->ctlr.ctl_src_addr);
+ dev_mc_delete(port->netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
}
{
u32 mfs;
u64 wwnn, wwpn;
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
u8 flogi_maddr[ETH_ALEN];
struct netdev_hw_addr *ha;
/* Setup lport private data to point to fcoe softc */
- fc = lport_priv(lp);
- fc->ctlr.lp = lp;
- fc->netdev = netdev;
+ port = lport_priv(lp);
+ port->ctlr.lp = lp;
+ port->netdev = netdev;
/* Do not support for bonding device */
if ((netdev->priv_flags & IFF_MASTER_ALB) ||
FCOE_NETDEV_DBG(netdev, "Supports LRO for max xid 0x%x\n",
lp->lro_xid);
}
- skb_queue_head_init(&fc->fcoe_pending_queue);
- fc->fcoe_pending_queue_active = 0;
- setup_timer(&fc->timer, fcoe_queue_timer, (unsigned long)lp);
+ skb_queue_head_init(&port->fcoe_pending_queue);
+ port->fcoe_pending_queue_active = 0;
+ setup_timer(&port->timer, fcoe_queue_timer, (unsigned long)lp);
/* look for SAN MAC address, if multiple SAN MACs exist, only
* use the first one for SPMA */
rcu_read_lock();
for_each_dev_addr(netdev, ha) {
if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
- (is_valid_ether_addr(ha->addr))) {
- memcpy(fc->ctlr.ctl_src_addr, ha->addr, ETH_ALEN);
- fc->ctlr.spma = 1;
+ (is_valid_ether_addr(port->ctlr.ctl_src_addr))) {
+ memcpy(port->ctlr.ctl_src_addr, ha->addr, ETH_ALEN);
+ port->ctlr.spma = 1;
break;
}
}
rcu_read_unlock();
/* setup Source Mac Address */
- if (!fc->ctlr.spma)
- memcpy(fc->ctlr.ctl_src_addr, netdev->dev_addr,
- fc->netdev->addr_len);
+ if (!port->ctlr.spma)
+ memcpy(port->ctlr.ctl_src_addr, netdev->dev_addr,
+ netdev->addr_len);
wwnn = fcoe_wwn_from_mac(netdev->dev_addr, 1, 0);
fc_set_wwnn(lp, wwnn);
rtnl_lock();
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
dev_unicast_add(netdev, flogi_maddr);
- if (fc->ctlr.spma)
- dev_unicast_add(netdev, fc->ctlr.ctl_src_addr);
+ if (port->ctlr.spma)
+ dev_unicast_add(netdev, port->ctlr.ctl_src_addr);
dev_mc_add(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
* setup the receive function from ethernet driver
* on the ethertype for the given device
*/
- fc->fcoe_packet_type.func = fcoe_rcv;
- fc->fcoe_packet_type.type = __constant_htons(ETH_P_FCOE);
- fc->fcoe_packet_type.dev = netdev;
- dev_add_pack(&fc->fcoe_packet_type);
+ port->fcoe_packet_type.func = fcoe_rcv;
+ port->fcoe_packet_type.type = __constant_htons(ETH_P_FCOE);
+ port->fcoe_packet_type.dev = netdev;
+ dev_add_pack(&port->fcoe_packet_type);
- fc->fip_packet_type.func = fcoe_fip_recv;
- fc->fip_packet_type.type = htons(ETH_P_FIP);
- fc->fip_packet_type.dev = netdev;
- dev_add_pack(&fc->fip_packet_type);
+ port->fip_packet_type.func = fcoe_fip_recv;
+ port->fip_packet_type.type = htons(ETH_P_FIP);
+ port->fip_packet_type.dev = netdev;
+ dev_add_pack(&port->fip_packet_type);
return 0;
}
/**
* fcoe_em_config() - allocates em for this lport
- * @lp: the port that em is to allocated for
+ * @lp: the fcoe that em is to allocated for
*
* Called with write fcoe_hostlist_lock held.
*
*/
static inline int fcoe_em_config(struct fc_lport *lp)
{
- struct fcoe_softc *fc = lport_priv(lp);
- struct fcoe_softc *oldfc = NULL;
+ struct fcoe_interface *fcoe;
+ struct fcoe_port *port = lport_priv(lp);
+ struct fcoe_port *oldfc = NULL;
struct net_device *old_real_dev, *cur_real_dev;
u16 min_xid = FCOE_MIN_XID;
u16 max_xid = FCOE_MAX_XID;
* Reuse existing offload em instance in case
* it is already allocated on real eth device
*/
- if (fc->netdev->priv_flags & IFF_802_1Q_VLAN)
- cur_real_dev = vlan_dev_real_dev(fc->netdev);
+ if (port->netdev->priv_flags & IFF_802_1Q_VLAN)
+ cur_real_dev = vlan_dev_real_dev(port->netdev);
else
- cur_real_dev = fc->netdev;
+ cur_real_dev = port->netdev;
- list_for_each_entry(oldfc, &fcoe_hostlist, list) {
+ list_for_each_entry(fcoe, &fcoe_hostlist, list) {
+ oldfc = fcoe->priv;
if (oldfc->netdev->priv_flags & IFF_802_1Q_VLAN)
old_real_dev = vlan_dev_real_dev(oldfc->netdev);
else
old_real_dev = oldfc->netdev;
if (cur_real_dev == old_real_dev) {
- fc->oem = oldfc->oem;
+ port->oem = oldfc->oem;
break;
}
}
- if (fc->oem) {
- if (!fc_exch_mgr_add(lp, fc->oem, fcoe_oem_match)) {
+ if (port->oem) {
+ if (!fc_exch_mgr_add(lp, port->oem, fcoe_oem_match)) {
printk(KERN_ERR "fcoe_em_config: failed to add "
"offload em:%p on interface:%s\n",
- fc->oem, fc->netdev->name);
+ port->oem, port->netdev->name);
return -ENOMEM;
}
} else {
- fc->oem = fc_exch_mgr_alloc(lp, FC_CLASS_3,
+ port->oem = fc_exch_mgr_alloc(lp, FC_CLASS_3,
FCOE_MIN_XID, lp->lro_xid,
fcoe_oem_match);
- if (!fc->oem) {
+ if (!port->oem) {
printk(KERN_ERR "fcoe_em_config: failed to allocate "
"em for offload exches on interface:%s\n",
- fc->netdev->name);
+ port->netdev->name);
return -ENOMEM;
}
}
skip_oem:
if (!fc_exch_mgr_alloc(lp, FC_CLASS_3, min_xid, max_xid, NULL)) {
printk(KERN_ERR "fcoe_em_config: failed to "
- "allocate em on interface %s\n", fc->netdev->name);
+ "allocate em on interface %s\n", port->netdev->name);
return -ENOMEM;
}
*/
static void fcoe_if_destroy(struct fc_lport *lport)
{
- struct fcoe_softc *fc = lport_priv(lport);
- struct net_device *netdev = fc->netdev;
+ struct fcoe_port *port = lport_priv(lport);
+ struct fcoe_interface *fcoe = port->fcoe;
+ struct net_device *netdev = port->netdev;
FCOE_NETDEV_DBG(netdev, "Destroying interface\n");
fcoe_hostlist_remove(lport);
/* clean up netdev configurations */
- fcoe_netdev_cleanup(fc);
+ fcoe_netdev_cleanup(port);
/* tear-down the FCoE controller */
- fcoe_ctlr_destroy(&fc->ctlr);
+ fcoe_ctlr_destroy(&port->ctlr);
/* Free queued packets for the per-CPU receive threads */
fcoe_percpu_clean(lport);
fcoe_clean_pending_queue(lport);
/* Stop the timer */
- del_timer_sync(&fc->timer);
+ del_timer_sync(&port->timer);
/* Free memory used by statistical counters */
fc_lport_free_stats(lport);
/* Release the net_device and Scsi_Host */
dev_put(netdev);
scsi_host_put(lport->host);
+ kfree(fcoe); /* TODO, should be refcounted */
}
/*
{
int rc;
struct fc_lport *lport = NULL;
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
+ struct fcoe_interface *fcoe;
struct Scsi_Host *shost;
FCOE_NETDEV_DBG(netdev, "Create Interface\n");
+ fcoe = kzalloc(sizeof(*fcoe), GFP_KERNEL);
+ if (!fcoe) {
+ FCOE_NETDEV_DBG(netdev, "Could not allocate fcoe structure\n");
+ rc = -ENOMEM;
+ goto out;
+ }
+
shost = libfc_host_alloc(&fcoe_shost_template,
- sizeof(struct fcoe_softc));
+ sizeof(struct fcoe_port));
if (!shost) {
FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n");
rc = -ENOMEM;
- goto out;
+ goto out_kfree_port;
}
lport = shost_priv(shost);
- fc = lport_priv(lport);
+ port = lport_priv(lport);
+
+ port->fcoe = fcoe;
+ fcoe->priv = port;
/* configure fc_lport, e.g., em */
rc = fcoe_lport_config(lport);
/*
* Initialize FIP.
*/
- fcoe_ctlr_init(&fc->ctlr);
- fc->ctlr.send = fcoe_fip_send;
- fc->ctlr.update_mac = fcoe_update_src_mac;
+ fcoe_ctlr_init(&port->ctlr);
+ port->ctlr.send = fcoe_fip_send;
+ port->ctlr.update_mac = fcoe_update_src_mac;
/* configure lport network properties */
rc = fcoe_netdev_config(lport, netdev);
fc_fabric_login(lport);
if (!fcoe_link_ok(lport))
- fcoe_ctlr_link_up(&fc->ctlr);
+ fcoe_ctlr_link_up(&port->ctlr);
dev_hold(netdev);
out_lp_destroy:
fc_exch_mgr_free(lport);
out_netdev_cleanup:
- fcoe_netdev_cleanup(fc);
+ fcoe_netdev_cleanup(port);
out_host_put:
scsi_host_put(lport->host);
+out_kfree_port:
+ kfree(fcoe);
out:
return ERR_PTR(rc);
}
{
struct fc_lport *lp;
struct fcoe_rcv_info *fr;
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
struct fc_frame_header *fh;
struct fcoe_percpu_s *fps;
unsigned int cpu;
- fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type);
- lp = fc->ctlr.lp;
+ port = container_of(ptype, struct fcoe_port, fcoe_packet_type);
+ lp = port->ctlr.lp;
if (unlikely(lp == NULL)) {
FCOE_NETDEV_DBG(dev, "Cannot find hba structure");
goto err2;
* fcoe_fc_crc() - calculates FC CRC in this fcoe skb
* @fp: the fc_frame containing data to be checksummed
*
- * This uses crc32() to calculate the crc for fc frame
+ * This uses crc32() to calculate the crc for port frame
* Return : 32 bit crc
*/
u32 fcoe_fc_crc(struct fc_frame *fp)
/**
* fcoe_xmit() - FCoE frame transmit function
- * @lp: the associated local port
+ * @lp: the associated local fcoe
* @fp: the fc_frame to be transmitted
*
* Return : 0 for success
unsigned int hlen; /* header length implies the version */
unsigned int tlen; /* trailer length */
unsigned int elen; /* eth header, may include vlan */
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
u8 sof, eof;
struct fcoe_hdr *hp;
WARN_ON((fr_len(fp) % sizeof(u32)) != 0);
- fc = lport_priv(lp);
+ port = lport_priv(lp);
fh = fc_frame_header_get(fp);
skb = fp_skb(fp);
wlen = skb->len / FCOE_WORD_TO_BYTE;
}
if (unlikely(fh->fh_r_ctl == FC_RCTL_ELS_REQ) &&
- fcoe_ctlr_els_send(&fc->ctlr, skb))
+ fcoe_ctlr_els_send(&port->ctlr, skb))
return 0;
sof = fr_sof(fp);
crc = fcoe_fc_crc(fp);
}
- /* copy fc crc and eof to the skb buff */
+ /* copy port crc and eof to the skb buff */
if (skb_is_nonlinear(skb)) {
skb_frag_t *frag;
if (fcoe_get_paged_crc_eof(skb, tlen)) {
cp = NULL;
}
- /* adjust skb network/transport offsets to match mac/fcoe/fc */
+ /* adjust skb network/transport offsets to match mac/fcoe/port */
skb_push(skb, elen + hlen);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb->mac_len = elen;
skb->protocol = htons(ETH_P_FCOE);
- skb->dev = fc->netdev;
+ skb->dev = port->netdev;
/* fill up mac and fcoe headers */
eh = eth_hdr(skb);
eh->h_proto = htons(ETH_P_FCOE);
- if (fc->ctlr.map_dest)
+ if (port->ctlr.map_dest)
fc_fcoe_set_mac(eh->h_dest, fh->fh_d_id);
else
/* insert GW address */
- memcpy(eh->h_dest, fc->ctlr.dest_addr, ETH_ALEN);
+ memcpy(eh->h_dest, port->ctlr.dest_addr, ETH_ALEN);
- if (unlikely(fc->ctlr.flogi_oxid != FC_XID_UNKNOWN))
- memcpy(eh->h_source, fc->ctlr.ctl_src_addr, ETH_ALEN);
+ if (unlikely(port->ctlr.flogi_oxid != FC_XID_UNKNOWN))
+ memcpy(eh->h_source, port->ctlr.ctl_src_addr, ETH_ALEN);
else
- memcpy(eh->h_source, fc->ctlr.data_src_addr, ETH_ALEN);
+ memcpy(eh->h_source, port->ctlr.data_src_addr, ETH_ALEN);
hp = (struct fcoe_hdr *)(eh + 1);
memset(hp, 0, sizeof(*hp));
/* send down to lld */
fr_dev(fp) = lp;
- if (fc->fcoe_pending_queue.qlen)
+ if (port->fcoe_pending_queue.qlen)
fcoe_check_wait_queue(lp, skb);
else if (fcoe_start_io(skb))
fcoe_check_wait_queue(lp, skb);
struct fcoe_crc_eof crc_eof;
struct fc_frame *fp;
u8 *mac = NULL;
- struct fcoe_softc *fc;
+ struct fcoe_port *port;
struct fcoe_hdr *hp;
set_user_nice(current, -20);
/*
* Save source MAC address before discarding header.
*/
- fc = lport_priv(lp);
+ port = lport_priv(lp);
if (skb_is_nonlinear(skb))
skb_linearize(skb); /* not ideal */
mac = eth_hdr(skb)->h_source;
}
fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED;
}
- if (unlikely(fc->ctlr.flogi_oxid != FC_XID_UNKNOWN) &&
- fcoe_ctlr_recv_flogi(&fc->ctlr, fp, mac)) {
+ if (unlikely(port->ctlr.flogi_oxid != FC_XID_UNKNOWN) &&
+ fcoe_ctlr_recv_flogi(&port->ctlr, fp, mac)) {
fc_frame_free(fp);
continue;
}
*/
static void fcoe_check_wait_queue(struct fc_lport *lp, struct sk_buff *skb)
{
- struct fcoe_softc *fc = lport_priv(lp);
+ struct fcoe_port *port = lport_priv(lp);
int rc;
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
+ spin_lock_bh(&port->fcoe_pending_queue.lock);
if (skb)
- __skb_queue_tail(&fc->fcoe_pending_queue, skb);
+ __skb_queue_tail(&port->fcoe_pending_queue, skb);
- if (fc->fcoe_pending_queue_active)
+ if (port->fcoe_pending_queue_active)
goto out;
- fc->fcoe_pending_queue_active = 1;
+ port->fcoe_pending_queue_active = 1;
- while (fc->fcoe_pending_queue.qlen) {
+ while (port->fcoe_pending_queue.qlen) {
/* keep qlen > 0 until fcoe_start_io succeeds */
- fc->fcoe_pending_queue.qlen++;
- skb = __skb_dequeue(&fc->fcoe_pending_queue);
+ port->fcoe_pending_queue.qlen++;
+ skb = __skb_dequeue(&port->fcoe_pending_queue);
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
+ spin_unlock_bh(&port->fcoe_pending_queue.lock);
rc = fcoe_start_io(skb);
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
+ spin_lock_bh(&port->fcoe_pending_queue.lock);
if (rc) {
- __skb_queue_head(&fc->fcoe_pending_queue, skb);
+ __skb_queue_head(&port->fcoe_pending_queue, skb);
/* undo temporary increment above */
- fc->fcoe_pending_queue.qlen--;
+ port->fcoe_pending_queue.qlen--;
break;
}
/* undo temporary increment above */
- fc->fcoe_pending_queue.qlen--;
+ port->fcoe_pending_queue.qlen--;
}
- if (fc->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
+ if (port->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
lp->qfull = 0;
- if (fc->fcoe_pending_queue.qlen && !timer_pending(&fc->timer))
- mod_timer(&fc->timer, jiffies + 2);
- fc->fcoe_pending_queue_active = 0;
+ if (port->fcoe_pending_queue.qlen && !timer_pending(&port->timer))
+ mod_timer(&port->timer, jiffies + 2);
+ port->fcoe_pending_queue_active = 0;
out:
- if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH)
+ if (port->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH)
lp->qfull = 1;
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
+ spin_unlock_bh(&port->fcoe_pending_queue.lock);
return;
}
{
struct fc_lport *lp = NULL;
struct net_device *netdev = ptr;
- struct fcoe_softc *fc;
+ struct fcoe_interface *fcoe;
+ struct fcoe_port *port = NULL;
struct fcoe_dev_stats *stats;
u32 link_possible = 1;
u32 mfs;
int rc = NOTIFY_OK;
read_lock(&fcoe_hostlist_lock);
- list_for_each_entry(fc, &fcoe_hostlist, list) {
- if (fc->netdev == netdev) {
- lp = fc->ctlr.lp;
+ list_for_each_entry(fcoe, &fcoe_hostlist, list) {
+ port = fcoe->priv;
+ if (port->netdev == netdev) {
+ lp = port->ctlr.lp;
break;
}
}
"from netdev netlink\n", event);
}
if (link_possible && !fcoe_link_ok(lp))
- fcoe_ctlr_link_up(&fc->ctlr);
- else if (fcoe_ctlr_link_down(&fc->ctlr)) {
+ fcoe_ctlr_link_up(&port->ctlr);
+ else if (fcoe_ctlr_link_down(&port->ctlr)) {
stats = fc_lport_get_stats(lp);
stats->LinkFailureCount++;
fcoe_clean_pending_queue(lp);
module_param_call(create, fcoe_create, NULL, NULL, S_IWUSR);
__MODULE_PARM_TYPE(create, "string");
-MODULE_PARM_DESC(create, "Create fcoe port using net device passed in.");
+MODULE_PARM_DESC(create, "Create fcoe fcoe using net device passed in.");
module_param_call(destroy, fcoe_destroy, NULL, NULL, S_IWUSR);
__MODULE_PARM_TYPE(destroy, "string");
-MODULE_PARM_DESC(destroy, "Destroy fcoe port");
+MODULE_PARM_DESC(destroy, "Destroy fcoe fcoe");
/**
* fcoe_link_ok() - Check if link is ok for the fc_lport
*/
int fcoe_link_ok(struct fc_lport *lp)
{
- struct fcoe_softc *fc = lport_priv(lp);
- struct net_device *dev = fc->netdev;
+ struct fcoe_port *port = lport_priv(lp);
+ struct net_device *dev = port->netdev;
struct ethtool_cmd ecmd = { ETHTOOL_GSET };
if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&
*/
void fcoe_clean_pending_queue(struct fc_lport *lp)
{
- struct fcoe_softc *fc = lport_priv(lp);
+ struct fcoe_port *port = lport_priv(lp);
struct sk_buff *skb;
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
- while ((skb = __skb_dequeue(&fc->fcoe_pending_queue)) != NULL) {
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
+ spin_lock_bh(&port->fcoe_pending_queue.lock);
+ while ((skb = __skb_dequeue(&port->fcoe_pending_queue)) != NULL) {
+ spin_unlock_bh(&port->fcoe_pending_queue.lock);
kfree_skb(skb);
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
+ spin_lock_bh(&port->fcoe_pending_queue.lock);
}
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
+ spin_unlock_bh(&port->fcoe_pending_queue.lock);
}
/**
}
/**
- * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device
+ * fcoe_hostlist_lookup_port() - find the corresponding lport by a given device
* @dev: this is currently ptr to net_device
*
* Called with fcoe_hostlist_lock held.
*
- * Returns: NULL or the located fcoe_softc
+ * Returns: NULL or the located fcoe_port
*/
-static struct fcoe_softc *
-fcoe_hostlist_lookup_softc(const struct net_device *dev)
+static struct fcoe_interface *
+fcoe_hostlist_lookup_port(const struct net_device *dev)
{
- struct fcoe_softc *fc;
+ struct fcoe_interface *fcoe;
- list_for_each_entry(fc, &fcoe_hostlist, list) {
- if (fc->netdev == dev)
- return fc;
+ list_for_each_entry(fcoe, &fcoe_hostlist, list) {
+ if (fcoe->priv->netdev == dev)
+ return fcoe;
}
return NULL;
}
*/
struct fc_lport *fcoe_hostlist_lookup(const struct net_device *netdev)
{
- struct fcoe_softc *fc;
+ struct fcoe_interface *fcoe;
read_lock(&fcoe_hostlist_lock);
- fc = fcoe_hostlist_lookup_softc(netdev);
+ fcoe = fcoe_hostlist_lookup_port(netdev);
read_unlock(&fcoe_hostlist_lock);
- return (fc) ? fc->ctlr.lp : NULL;
+ return (fcoe) ? fcoe->priv->ctlr.lp : NULL;
}
/**
*
* Returns: 0 for success
*/
-int fcoe_hostlist_add(const struct fc_lport *lp)
+int fcoe_hostlist_add(const struct fc_lport *lport)
{
- struct fcoe_softc *fc;
-
- fc = fcoe_hostlist_lookup_softc(fcoe_netdev(lp));
- if (!fc) {
- fc = lport_priv(lp);
- list_add_tail(&fc->list, &fcoe_hostlist);
+ struct fcoe_interface *fcoe;
+ struct fcoe_port *port;
+
+ fcoe = fcoe_hostlist_lookup_port(fcoe_netdev(lport));
+ if (!fcoe) {
+ port = lport_priv(lport);
+ fcoe = port->fcoe;
+ list_add_tail(&fcoe->list, &fcoe_hostlist);
}
return 0;
}
*
* Returns: 0 for success
*/
-int fcoe_hostlist_remove(const struct fc_lport *lp)
+int fcoe_hostlist_remove(const struct fc_lport *lport)
{
- struct fcoe_softc *fc;
+ struct fcoe_interface *fcoe;
write_lock_bh(&fcoe_hostlist_lock);
- fc = fcoe_hostlist_lookup_softc(fcoe_netdev(lp));
- BUG_ON(!fc);
- list_del(&fc->list);
+ fcoe = fcoe_hostlist_lookup_port(fcoe_netdev(lport));
+ BUG_ON(!fcoe);
+ list_del(&fcoe->list);
write_unlock_bh(&fcoe_hostlist_lock);
return 0;
static void __exit fcoe_exit(void)
{
unsigned int cpu;
- struct fcoe_softc *fc, *tmp;
+ struct fcoe_interface *fcoe, *tmp;
fcoe_dev_cleanup();
/* releases the associated fcoe hosts */
- list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list)
- fcoe_if_destroy(fc->ctlr.lp);
+ list_for_each_entry_safe(fcoe, tmp, &fcoe_hostlist, list)
+ fcoe_if_destroy(fcoe->priv->ctlr.lp);
unregister_hotcpu_notifier(&fcoe_cpu_notifier);
- for_each_online_cpu(cpu) {
+ for_each_online_cpu(cpu)
fcoe_percpu_thread_destroy(cpu);
- }
/* detach from scsi transport */
fcoe_if_exit();