Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150247
b: refs/heads/master
c: 184dd34
h: refs/heads/master
i:
  150245: c0484fa
  150243: 6bce5dd
  150239: 93d8037
v: v3
  • Loading branch information
Vasu Dev authored and David S. Miller committed May 18, 2009
1 parent 33f6ed0 commit 5a9e942
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab6b85c1d7a1bf6c2b27fb542a7b2404e45b7e24
refs/heads/master: 184dd3459bb334d9061b58faed3610d08d6c7ff8
24 changes: 22 additions & 2 deletions trunk/drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ void fcoe_netdev_cleanup(struct fcoe_softc *fc)
if (!is_zero_ether_addr(fc->ctlr.data_src_addr))
dev_unicast_delete(fc->real_dev,
fc->ctlr.data_src_addr, ETH_ALEN);
if (fc->ctlr.spma)
dev_unicast_delete(fc->real_dev,
fc->ctlr.ctl_src_addr, ETH_ALEN);
dev_mc_delete(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
rtnl_unlock();
}
Expand All @@ -257,6 +260,7 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
u64 wwnn, wwpn;
struct fcoe_softc *fc;
u8 flogi_maddr[ETH_ALEN];
struct netdev_hw_addr *ha;

/* Setup lport private data to point to fcoe softc */
fc = lport_priv(lp);
Expand Down Expand Up @@ -313,9 +317,23 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
skb_queue_head_init(&fc->fcoe_pending_queue);
fc->fcoe_pending_queue_active = 0;

/* 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(fc->ctlr.ctl_src_addr))) {
memcpy(fc->ctlr.ctl_src_addr, ha->addr, ETH_ALEN);
fc->ctlr.spma = 1;
break;
}
}
rcu_read_unlock();

/* setup Source Mac Address */
memcpy(fc->ctlr.ctl_src_addr, fc->real_dev->dev_addr,
fc->real_dev->addr_len);
if (!fc->ctlr.spma)
memcpy(fc->ctlr.ctl_src_addr, fc->real_dev->dev_addr,
fc->real_dev->addr_len);

wwnn = fcoe_wwn_from_mac(fc->real_dev->dev_addr, 1, 0);
fc_set_wwnn(lp, wwnn);
Expand All @@ -331,6 +349,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(fc->real_dev, flogi_maddr, ETH_ALEN);
if (fc->ctlr.spma)
dev_unicast_add(fc->real_dev, fc->ctlr.ctl_src_addr, ETH_ALEN);
rtnl_unlock();

/*
Expand Down
10 changes: 9 additions & 1 deletion trunk/drivers/scsi/fcoe/libfcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf)
sol->fip.fip_subcode = FIP_SC_SOL;
sol->fip.fip_dl_len = htons(sizeof(sol->desc) / FIP_BPW);
sol->fip.fip_flags = htons(FIP_FL_FPMA);
if (fip->spma)
sol->fip.fip_flags |= htons(FIP_FL_SPMA);

sol->desc.mac.fd_desc.fip_dtype = FIP_DT_MAC;
sol->desc.mac.fd_desc.fip_dlen = sizeof(sol->desc.mac) / FIP_BPW;
Expand Down Expand Up @@ -350,6 +352,8 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, int ports, u8 *sa)
kal->fip.fip_dl_len = htons((sizeof(kal->mac) +
ports * sizeof(*vn)) / FIP_BPW);
kal->fip.fip_flags = htons(FIP_FL_FPMA);
if (fip->spma)
kal->fip.fip_flags |= htons(FIP_FL_SPMA);

kal->mac.fd_desc.fip_dtype = FIP_DT_MAC;
kal->mac.fd_desc.fip_dlen = sizeof(kal->mac) / FIP_BPW;
Expand Down Expand Up @@ -413,6 +417,8 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip,
cap->fip.fip_subcode = FIP_SC_REQ;
cap->fip.fip_dl_len = htons((dlen + sizeof(*mac)) / FIP_BPW);
cap->fip.fip_flags = htons(FIP_FL_FPMA);
if (fip->spma)
cap->fip.fip_flags |= htons(FIP_FL_SPMA);

cap->encaps.fd_desc.fip_dtype = dtype;
cap->encaps.fd_desc.fip_dlen = dlen / FIP_BPW;
Expand All @@ -421,8 +427,10 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip,
memset(mac, 0, sizeof(mac));
mac->fd_desc.fip_dtype = FIP_DT_MAC;
mac->fd_desc.fip_dlen = sizeof(*mac) / FIP_BPW;
if (dtype != ELS_FLOGI)
if (dtype != FIP_DT_FLOGI)
memcpy(mac->fd_mac, fip->data_src_addr, ETH_ALEN);
else if (fip->spma)
memcpy(mac->fd_mac, fip->ctl_src_addr, ETH_ALEN);

skb->protocol = htons(ETH_P_802_3);
skb_reset_mac_header(skb);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/scsi/libfcoe.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ enum fip_state {
* @link: current link status for libfc.
* @last_link: last link state reported to libfc.
* @map_dest: use the FC_MAP mode for destination MAC addresses.
* @spma: supports SPMA server-provided MACs mode
* @dest_addr: MAC address of the selected FC forwarder.
* @ctl_src_addr: the native MAC address of our local port.
* @data_src_addr: the assigned MAC address for the local port after FLOGI.
Expand Down Expand Up @@ -104,6 +105,7 @@ struct fcoe_ctlr {
u8 link;
u8 last_link;
u8 map_dest;
u8 spma;
u8 dest_addr[ETH_ALEN];
u8 ctl_src_addr[ETH_ALEN];
u8 data_src_addr[ETH_ALEN];
Expand Down

0 comments on commit 5a9e942

Please sign in to comment.