*/
static void fcoe_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
{
- skb->dev = fcoe_from_ctlr(fip)->real_dev;
+ skb->dev = fcoe_from_ctlr(fip)->netdev;
dev_queue_xmit(skb);
}
fc = fcoe_from_ctlr(fip);
rtnl_lock();
if (!is_zero_ether_addr(old))
- dev_unicast_delete(fc->real_dev, old);
- dev_unicast_add(fc->real_dev, new);
+ dev_unicast_delete(fc->netdev, old);
+ dev_unicast_add(fc->netdev, new);
rtnl_unlock();
}
/* Delete secondary MAC addresses */
rtnl_lock();
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
- dev_unicast_delete(fc->real_dev, flogi_maddr);
+ dev_unicast_delete(fc->netdev, flogi_maddr);
if (!is_zero_ether_addr(fc->ctlr.data_src_addr))
- dev_unicast_delete(fc->real_dev, fc->ctlr.data_src_addr);
+ dev_unicast_delete(fc->netdev, fc->ctlr.data_src_addr);
if (fc->ctlr.spma)
- dev_unicast_delete(fc->real_dev, fc->ctlr.ctl_src_addr);
- dev_mc_delete(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
+ dev_unicast_delete(fc->netdev, fc->ctlr.ctl_src_addr);
+ dev_mc_delete(fc->netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
}
/* Setup lport private data to point to fcoe softc */
fc = lport_priv(lp);
fc->ctlr.lp = lp;
- fc->real_dev = netdev;
- fc->phys_dev = netdev;
-
- /* Require support for get_pauseparam ethtool op. */
- if (netdev->priv_flags & IFF_802_1Q_VLAN)
- fc->phys_dev = vlan_dev_real_dev(netdev);
+ fc->netdev = netdev;
/* Do not support for bonding device */
- if ((fc->real_dev->priv_flags & IFF_MASTER_ALB) ||
- (fc->real_dev->priv_flags & IFF_SLAVE_INACTIVE) ||
- (fc->real_dev->priv_flags & IFF_MASTER_8023AD)) {
+ if ((netdev->priv_flags & IFF_MASTER_ALB) ||
+ (netdev->priv_flags & IFF_SLAVE_INACTIVE) ||
+ (netdev->priv_flags & IFF_MASTER_8023AD)) {
return -EOPNOTSUPP;
}
* user-configured limit. If the MFS is too low, fcoe_link_ok()
* will return 0, so do this first.
*/
- mfs = fc->real_dev->mtu - (sizeof(struct fcoe_hdr) +
- sizeof(struct fcoe_crc_eof));
+ mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
+ sizeof(struct fcoe_crc_eof));
if (fc_set_mfs(lp, mfs))
return -EINVAL;
/* offload features support */
- if (fc->real_dev->features & NETIF_F_SG)
+ if (netdev->features & NETIF_F_SG)
lp->sg_supp = 1;
if (netdev->features & NETIF_F_FCOE_CRC) {
/* setup Source Mac Address */
if (!fc->ctlr.spma)
- memcpy(fc->ctlr.ctl_src_addr, fc->real_dev->dev_addr,
- fc->real_dev->addr_len);
+ memcpy(fc->ctlr.ctl_src_addr, netdev->dev_addr,
+ fc->netdev->addr_len);
- wwnn = fcoe_wwn_from_mac(fc->real_dev->dev_addr, 1, 0);
+ wwnn = fcoe_wwn_from_mac(netdev->dev_addr, 1, 0);
fc_set_wwnn(lp, wwnn);
/* XXX - 3rd arg needs to be vlan id */
- wwpn = fcoe_wwn_from_mac(fc->real_dev->dev_addr, 2, 0);
+ wwpn = fcoe_wwn_from_mac(netdev->dev_addr, 2, 0);
fc_set_wwpn(lp, wwpn);
/*
*/
rtnl_lock();
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
- dev_unicast_add(fc->real_dev, flogi_maddr);
+ dev_unicast_add(netdev, flogi_maddr);
if (fc->ctlr.spma)
- dev_unicast_add(fc->real_dev, fc->ctlr.ctl_src_addr);
- dev_mc_add(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
+ dev_unicast_add(netdev, fc->ctlr.ctl_src_addr);
+ dev_mc_add(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
/*
*/
fc->fcoe_packet_type.func = fcoe_rcv;
fc->fcoe_packet_type.type = __constant_htons(ETH_P_FCOE);
- fc->fcoe_packet_type.dev = fc->real_dev;
+ fc->fcoe_packet_type.dev = netdev;
dev_add_pack(&fc->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 = fc->real_dev;
+ fc->fip_packet_type.dev = netdev;
dev_add_pack(&fc->fip_packet_type);
return 0;
{
struct fcoe_softc *fc = lport_priv(lp);
struct fcoe_softc *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 phys_dev.
+ * 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);
+ else
+ cur_real_dev = fc->netdev;
+
list_for_each_entry(oldfc, &fcoe_hostlist, list) {
- if (oldfc->phys_dev == fc->phys_dev) {
+ 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;
break;
}
if (!fc_exch_mgr_add(lp, fc->oem, fcoe_oem_match)) {
printk(KERN_ERR "fcoe_em_config: failed to add "
"offload em:%p on interface:%s\n",
- fc->oem, fc->real_dev->name);
+ fc->oem, fc->netdev->name);
return -ENOMEM;
}
} else {
if (!fc->oem) {
printk(KERN_ERR "fcoe_em_config: failed to allocate "
"em for offload exches on interface:%s\n",
- fc->real_dev->name);
+ fc->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->real_dev->name);
+ "allocate em on interface %s\n", fc->netdev->name);
return -ENOMEM;
}
fc_lport_free_stats(lp);
/* Release the net_device and Scsi_Host */
- dev_put(fc->real_dev);
+ dev_put(netdev);
scsi_host_put(lp->host);
return 0;
skb_reset_network_header(skb);
skb->mac_len = elen;
skb->protocol = htons(ETH_P_FCOE);
- skb->dev = fc->real_dev;
+ skb->dev = fc->netdev;
/* fill up mac and fcoe headers */
eh = eth_hdr(skb);
ulong event, void *ptr)
{
struct fc_lport *lp = NULL;
- struct net_device *real_dev = ptr;
+ struct net_device *netdev = ptr;
struct fcoe_softc *fc;
struct fcoe_dev_stats *stats;
u32 link_possible = 1;
read_lock(&fcoe_hostlist_lock);
list_for_each_entry(fc, &fcoe_hostlist, list) {
- if (fc->real_dev == real_dev) {
+ if (fc->netdev == netdev) {
lp = fc->ctlr.lp;
break;
}
case NETDEV_CHANGE:
break;
case NETDEV_CHANGEMTU:
- mfs = fc->real_dev->mtu -
- (sizeof(struct fcoe_hdr) +
- sizeof(struct fcoe_crc_eof));
+ mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
+ sizeof(struct fcoe_crc_eof));
if (mfs >= FC_MIN_MAX_FRAME)
fc_set_mfs(lp, mfs);
break;
case NETDEV_REGISTER:
break;
default:
- FCOE_NETDEV_DBG(real_dev, "Unknown event %ld "
+ FCOE_NETDEV_DBG(netdev, "Unknown event %ld "
"from netdev netlink\n", event);
}
if (link_possible && !fcoe_link_ok(lp))
int fcoe_link_ok(struct fc_lport *lp)
{
struct fcoe_softc *fc = lport_priv(lp);
- struct net_device *dev = fc->real_dev;
+ struct net_device *dev = fc->netdev;
struct ethtool_cmd ecmd = { ETHTOOL_GSET };
if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&
struct fcoe_softc *fc;
list_for_each_entry(fc, &fcoe_hostlist, list) {
- if (fc->real_dev == dev)
+ if (fc->netdev == dev)
return fc;
}
return NULL;
/* releases the associated fcoe hosts */
list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list)
- fcoe_if_destroy(fc->real_dev);
+ fcoe_if_destroy(fc->netdev);
unregister_hotcpu_notifier(&fcoe_cpu_notifier);