Loading drivers/scsi/bnx2fc/bnx2fc_fcoe.c +2 −2 Original line number Original line Diff line number Diff line Loading @@ -542,8 +542,7 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); if (vn_port) { if (vn_port) { port = lport_priv(vn_port); port = lport_priv(vn_port); if (compare_ether_addr(port->data_src_addr, dest_mac) if (!ether_addr_equal(port->data_src_addr, dest_mac)) { != 0) { BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); put_cpu(); put_cpu(); kfree_skb(skb); kfree_skb(skb); Loading Loading @@ -1381,6 +1380,7 @@ struct bnx2fc_interface *bnx2fc_interface_create(struct bnx2fc_hba *hba, return NULL; return NULL; } } ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr->cdev = ctlr_dev; interface = fcoe_ctlr_priv(ctlr); interface = fcoe_ctlr_priv(ctlr); dev_hold(netdev); dev_hold(netdev); kref_init(&interface->kref); kref_init(&interface->kref); Loading drivers/scsi/fcoe/fcoe.c +16 −9 Original line number Original line Diff line number Diff line Loading @@ -408,6 +408,7 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev, } } ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr->cdev = ctlr_dev; fcoe = fcoe_ctlr_priv(ctlr); fcoe = fcoe_ctlr_priv(ctlr); dev_hold(netdev); dev_hold(netdev); Loading Loading @@ -1440,22 +1441,28 @@ static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, ctlr = fcoe_to_ctlr(fcoe); ctlr = fcoe_to_ctlr(fcoe); lport = ctlr->lp; lport = ctlr->lp; if (unlikely(!lport)) { if (unlikely(!lport)) { FCOE_NETDEV_DBG(netdev, "Cannot find hba structure"); FCOE_NETDEV_DBG(netdev, "Cannot find hba structure\n"); goto err2; goto err2; } } if (!lport->link_up) if (!lport->link_up) goto err2; goto err2; FCOE_NETDEV_DBG(netdev, "skb_info: len:%d data_len:%d head:%p " FCOE_NETDEV_DBG(netdev, "data:%p tail:%p end:%p sum:%d dev:%s", "skb_info: len:%d data_len:%d head:%p data:%p tail:%p end:%p sum:%d dev:%s\n", skb->len, skb->data_len, skb->head, skb->data, skb->len, skb->data_len, skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb_tail_pointer(skb), skb_end_pointer(skb), skb->csum, skb->dev ? skb->dev->name : "<NULL>"); skb->csum, skb->dev ? skb->dev->name : "<NULL>"); skb = skb_share_check(skb, GFP_ATOMIC); if (skb == NULL) return NET_RX_DROP; eh = eth_hdr(skb); eh = eth_hdr(skb); if (is_fip_mode(ctlr) && if (is_fip_mode(ctlr) && compare_ether_addr(eh->h_source, ctlr->dest_addr)) { !ether_addr_equal(eh->h_source, ctlr->dest_addr)) { FCOE_NETDEV_DBG(netdev, "wrong source mac address:%pM\n", FCOE_NETDEV_DBG(netdev, "wrong source mac address:%pM\n", eh->h_source); eh->h_source); goto err; goto err; Loading Loading @@ -1540,13 +1547,13 @@ static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, wake_up_process(fps->thread); wake_up_process(fps->thread); spin_unlock(&fps->fcoe_rx_list.lock); spin_unlock(&fps->fcoe_rx_list.lock); return 0; return NET_RX_SUCCESS; err: err: per_cpu_ptr(lport->stats, get_cpu())->ErrorFrames++; per_cpu_ptr(lport->stats, get_cpu())->ErrorFrames++; put_cpu(); put_cpu(); err2: err2: kfree_skb(skb); kfree_skb(skb); return -1; return NET_RX_DROP; } } /** /** Loading Loading @@ -1788,13 +1795,13 @@ static void fcoe_recv_frame(struct sk_buff *skb) lport = fr->fr_dev; lport = fr->fr_dev; if (unlikely(!lport)) { if (unlikely(!lport)) { if (skb->destructor != fcoe_percpu_flush_done) if (skb->destructor != fcoe_percpu_flush_done) FCOE_NETDEV_DBG(skb->dev, "NULL lport in skb"); FCOE_NETDEV_DBG(skb->dev, "NULL lport in skb\n"); kfree_skb(skb); kfree_skb(skb); return; return; } } FCOE_NETDEV_DBG(skb->dev, "skb_info: len:%d data_len:%d " FCOE_NETDEV_DBG(skb->dev, "head:%p data:%p tail:%p end:%p sum:%d dev:%s", "skb_info: len:%d data_len:%d head:%p data:%p tail:%p end:%p sum:%d dev:%s\n", skb->len, skb->data_len, skb->len, skb->data_len, skb->head, skb->data, skb_tail_pointer(skb), skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->csum, skb_end_pointer(skb), skb->csum, Loading drivers/scsi/fcoe/fcoe_ctlr.c +95 −53 Original line number Original line Diff line number Diff line Loading @@ -160,30 +160,50 @@ void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_state mode) } } EXPORT_SYMBOL(fcoe_ctlr_init); EXPORT_SYMBOL(fcoe_ctlr_init); /** * fcoe_sysfs_fcf_add() - Add a fcoe_fcf{,_device} to a fcoe_ctlr{,_device} * @new: The newly discovered FCF * * Called with fip->ctlr_mutex held */ static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new) static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new) { { struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); struct fcoe_ctlr_device *ctlr_dev; struct fcoe_fcf_device temp, *fcf_dev; struct fcoe_fcf_device *temp, *fcf_dev; int rc = 0; int rc = -ENOMEM; LIBFCOE_FIP_DBG(fip, "New FCF fab %16.16llx mac %pM\n", LIBFCOE_FIP_DBG(fip, "New FCF fab %16.16llx mac %pM\n", new->fabric_name, new->fcf_mac); new->fabric_name, new->fcf_mac); mutex_lock(&ctlr_dev->lock); temp = kzalloc(sizeof(*temp), GFP_KERNEL); if (!temp) goto out; temp->fabric_name = new->fabric_name; temp->switch_name = new->switch_name; temp->fc_map = new->fc_map; temp->vfid = new->vfid; memcpy(temp->mac, new->fcf_mac, ETH_ALEN); temp->priority = new->pri; temp->fka_period = new->fka_period; temp->selected = 0; /* default to unselected */ temp.fabric_name = new->fabric_name; /* temp.switch_name = new->switch_name; * If ctlr_dev doesn't exist then it means we're a libfcoe user temp.fc_map = new->fc_map; * who doesn't use fcoe_syfs and didn't allocate a fcoe_ctlr_device. temp.vfid = new->vfid; * fnic would be an example of a driver with this behavior. In this memcpy(temp.mac, new->fcf_mac, ETH_ALEN); * case we want to add the fcoe_fcf to the fcoe_ctlr list, but we temp.priority = new->pri; * don't want to make sysfs changes. temp.fka_period = new->fka_period; */ temp.selected = 0; /* default to unselected */ fcf_dev = fcoe_fcf_device_add(ctlr_dev, &temp); ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); if (ctlr_dev) { mutex_lock(&ctlr_dev->lock); fcf_dev = fcoe_fcf_device_add(ctlr_dev, temp); if (unlikely(!fcf_dev)) { if (unlikely(!fcf_dev)) { rc = -ENOMEM; rc = -ENOMEM; mutex_unlock(&ctlr_dev->lock); goto out; goto out; } } Loading @@ -201,33 +221,52 @@ static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new) fcf_dev->priv = new; fcf_dev->priv = new; new->fcf_dev = fcf_dev; new->fcf_dev = fcf_dev; mutex_unlock(&ctlr_dev->lock); } list_add(&new->list, &fip->fcfs); list_add(&new->list, &fip->fcfs); fip->fcf_count++; fip->fcf_count++; rc = 0; out: out: mutex_unlock(&ctlr_dev->lock); kfree(temp); return rc; return rc; } } /** * fcoe_sysfs_fcf_del() - Remove a fcoe_fcf{,_device} to a fcoe_ctlr{,_device} * @new: The FCF to be removed * * Called with fip->ctlr_mutex held */ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) { { struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); struct fcoe_ctlr_device *cdev; struct fcoe_fcf_device *fcf_dev; struct fcoe_fcf_device *fcf_dev; list_del(&new->list); list_del(&new->list); fip->fcf_count--; fip->fcf_count--; mutex_lock(&ctlr_dev->lock); /* * If ctlr_dev doesn't exist then it means we're a libfcoe user * who doesn't use fcoe_syfs and didn't allocate a fcoe_ctlr_device * or a fcoe_fcf_device. * * fnic would be an example of a driver with this behavior. In this * case we want to remove the fcoe_fcf from the fcoe_ctlr list (above), * but we don't want to make sysfs changes. */ cdev = fcoe_ctlr_to_ctlr_dev(fip); if (cdev) { mutex_lock(&cdev->lock); fcf_dev = fcoe_fcf_to_fcf_dev(new); fcf_dev = fcoe_fcf_to_fcf_dev(new); WARN_ON(!fcf_dev); WARN_ON(!fcf_dev); new->fcf_dev = NULL; new->fcf_dev = NULL; fcoe_fcf_device_delete(fcf_dev); fcoe_fcf_device_delete(fcf_dev); kfree(new); kfree(new); mutex_unlock(&cdev->lock); mutex_unlock(&ctlr_dev->lock); } } } /** /** Loading Loading @@ -300,7 +339,7 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip) spin_unlock_bh(&fip->ctlr_lock); spin_unlock_bh(&fip->ctlr_lock); sel = fip->sel_fcf; sel = fip->sel_fcf; if (sel && !compare_ether_addr(sel->fcf_mac, fip->dest_addr)) if (sel && ether_addr_equal(sel->fcf_mac, fip->dest_addr)) goto unlock; goto unlock; if (!is_zero_ether_addr(fip->dest_addr)) { if (!is_zero_ether_addr(fip->dest_addr)) { printk(KERN_NOTICE "libfcoe: host%d: " printk(KERN_NOTICE "libfcoe: host%d: " Loading Loading @@ -1000,7 +1039,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) if (fcf->switch_name == new.switch_name && if (fcf->switch_name == new.switch_name && fcf->fabric_name == new.fabric_name && fcf->fabric_name == new.fabric_name && fcf->fc_map == new.fc_map && fcf->fc_map == new.fc_map && compare_ether_addr(fcf->fcf_mac, new.fcf_mac) == 0) { ether_addr_equal(fcf->fcf_mac, new.fcf_mac)) { found = 1; found = 1; break; break; } } Loading Loading @@ -1340,7 +1379,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, mp = (struct fip_mac_desc *)desc; mp = (struct fip_mac_desc *)desc; if (dlen < sizeof(*mp)) if (dlen < sizeof(*mp)) goto err; goto err; if (compare_ether_addr(mp->fd_mac, fcf->fcf_mac)) if (!ether_addr_equal(mp->fd_mac, fcf->fcf_mac)) goto err; goto err; desc_mask &= ~BIT(FIP_DT_MAC); desc_mask &= ~BIT(FIP_DT_MAC); break; break; Loading Loading @@ -1418,8 +1457,8 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, * 'port_id' is already validated, check MAC address and * 'port_id' is already validated, check MAC address and * wwpn * wwpn */ */ if (compare_ether_addr(fip->get_src_addr(vn_port), if (!ether_addr_equal(fip->get_src_addr(vn_port), vp->fd_mac) != 0 || vp->fd_mac) || get_unaligned_be64(&vp->fd_wwpn) != get_unaligned_be64(&vp->fd_wwpn) != vn_port->wwpn) vn_port->wwpn) continue; continue; Loading Loading @@ -1453,6 +1492,9 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, */ */ void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) { { skb = skb_share_check(skb, GFP_ATOMIC); if (!skb) return; skb_queue_tail(&fip->fip_recv_list, skb); skb_queue_tail(&fip->fip_recv_list, skb); schedule_work(&fip->recv_work); schedule_work(&fip->recv_work); } } Loading @@ -1479,12 +1521,12 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb) goto drop; goto drop; eh = eth_hdr(skb); eh = eth_hdr(skb); if (fip->mode == FIP_MODE_VN2VN) { if (fip->mode == FIP_MODE_VN2VN) { if (compare_ether_addr(eh->h_dest, fip->ctl_src_addr) && if (!ether_addr_equal(eh->h_dest, fip->ctl_src_addr) && compare_ether_addr(eh->h_dest, fcoe_all_vn2vn) && !ether_addr_equal(eh->h_dest, fcoe_all_vn2vn) && compare_ether_addr(eh->h_dest, fcoe_all_p2p)) !ether_addr_equal(eh->h_dest, fcoe_all_p2p)) goto drop; goto drop; } else if (compare_ether_addr(eh->h_dest, fip->ctl_src_addr) && } else if (!ether_addr_equal(eh->h_dest, fip->ctl_src_addr) && compare_ether_addr(eh->h_dest, fcoe_all_enode)) !ether_addr_equal(eh->h_dest, fcoe_all_enode)) goto drop; goto drop; fiph = (struct fip_header *)skb->data; fiph = (struct fip_header *)skb->data; op = ntohs(fiph->fip_op); op = ntohs(fiph->fip_op); Loading Loading @@ -1856,7 +1898,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, * address_mode flag to use FC_OUI-based Ethernet DA. * address_mode flag to use FC_OUI-based Ethernet DA. * Otherwise we use the FCoE gateway addr * Otherwise we use the FCoE gateway addr */ */ if (!compare_ether_addr(sa, (u8[6])FC_FCOE_FLOGI_MAC)) { if (ether_addr_equal(sa, (u8[6])FC_FCOE_FLOGI_MAC)) { fcoe_ctlr_map_dest(fip); fcoe_ctlr_map_dest(fip); } else { } else { memcpy(fip->dest_addr, sa, ETH_ALEN); memcpy(fip->dest_addr, sa, ETH_ALEN); Loading Loading @@ -2825,7 +2867,7 @@ static void fcoe_ctlr_vn_timeout(struct fcoe_ctlr *fip) * disabled, so that should ensure that this routine is only called * disabled, so that should ensure that this routine is only called * when nothing is happening. * when nothing is happening. */ */ void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip, static void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip, enum fip_state fip_mode) enum fip_state fip_mode) { { void *priv; void *priv; Loading drivers/scsi/fcoe/fcoe_sysfs.c +7 −7 Original line number Original line Diff line number Diff line Loading @@ -300,29 +300,29 @@ static ssize_t store_ctlr_mode(struct device *dev, switch (ctlr->enabled) { switch (ctlr->enabled) { case FCOE_CTLR_ENABLED: case FCOE_CTLR_ENABLED: LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled."); LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n"); return -EBUSY; return -EBUSY; case FCOE_CTLR_DISABLED: case FCOE_CTLR_DISABLED: if (!ctlr->f->set_fcoe_ctlr_mode) { if (!ctlr->f->set_fcoe_ctlr_mode) { LIBFCOE_SYSFS_DBG(ctlr, LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported by LLD."); "Mode change not supported by LLD.\n"); return -ENOTSUPP; return -ENOTSUPP; } } ctlr->mode = fcoe_parse_mode(mode); ctlr->mode = fcoe_parse_mode(mode); if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) { if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) { LIBFCOE_SYSFS_DBG(ctlr, LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n", "Unknown mode %s provided.", buf); buf); return -EINVAL; return -EINVAL; } } ctlr->f->set_fcoe_ctlr_mode(ctlr); ctlr->f->set_fcoe_ctlr_mode(ctlr); LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.", buf); LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf); return count; return count; case FCOE_CTLR_UNUSED: case FCOE_CTLR_UNUSED: default: default: LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported."); LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n"); return -ENOTSUPP; return -ENOTSUPP; }; }; } } Loading Loading @@ -653,7 +653,7 @@ static int fcoe_fcf_device_match(struct fcoe_fcf_device *new, if (new->switch_name == old->switch_name && if (new->switch_name == old->switch_name && new->fabric_name == old->fabric_name && new->fabric_name == old->fabric_name && new->fc_map == old->fc_map && new->fc_map == old->fc_map && compare_ether_addr(new->mac, old->mac) == 0) ether_addr_equal(new->mac, old->mac)) return 1; return 1; return 0; return 0; } } Loading drivers/scsi/fnic/fnic_fcs.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -658,13 +658,13 @@ void fnic_update_mac_locked(struct fnic *fnic, u8 *new) if (is_zero_ether_addr(new)) if (is_zero_ether_addr(new)) new = ctl; new = ctl; if (!compare_ether_addr(data, new)) if (ether_addr_equal(data, new)) return; return; FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new); FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new); if (!is_zero_ether_addr(data) && compare_ether_addr(data, ctl)) if (!is_zero_ether_addr(data) && !ether_addr_equal(data, ctl)) vnic_dev_del_addr(fnic->vdev, data); vnic_dev_del_addr(fnic->vdev, data); memcpy(data, new, ETH_ALEN); memcpy(data, new, ETH_ALEN); if (compare_ether_addr(new, ctl)) if (!ether_addr_equal(new, ctl)) vnic_dev_add_addr(fnic->vdev, new); vnic_dev_add_addr(fnic->vdev, new); } } Loading Loading
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +2 −2 Original line number Original line Diff line number Diff line Loading @@ -542,8 +542,7 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); vn_port = fc_vport_id_lookup(lport, ntoh24(fh->fh_d_id)); if (vn_port) { if (vn_port) { port = lport_priv(vn_port); port = lport_priv(vn_port); if (compare_ether_addr(port->data_src_addr, dest_mac) if (!ether_addr_equal(port->data_src_addr, dest_mac)) { != 0) { BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); put_cpu(); put_cpu(); kfree_skb(skb); kfree_skb(skb); Loading Loading @@ -1381,6 +1380,7 @@ struct bnx2fc_interface *bnx2fc_interface_create(struct bnx2fc_hba *hba, return NULL; return NULL; } } ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr->cdev = ctlr_dev; interface = fcoe_ctlr_priv(ctlr); interface = fcoe_ctlr_priv(ctlr); dev_hold(netdev); dev_hold(netdev); kref_init(&interface->kref); kref_init(&interface->kref); Loading
drivers/scsi/fcoe/fcoe.c +16 −9 Original line number Original line Diff line number Diff line Loading @@ -408,6 +408,7 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev, } } ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr = fcoe_ctlr_device_priv(ctlr_dev); ctlr->cdev = ctlr_dev; fcoe = fcoe_ctlr_priv(ctlr); fcoe = fcoe_ctlr_priv(ctlr); dev_hold(netdev); dev_hold(netdev); Loading Loading @@ -1440,22 +1441,28 @@ static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, ctlr = fcoe_to_ctlr(fcoe); ctlr = fcoe_to_ctlr(fcoe); lport = ctlr->lp; lport = ctlr->lp; if (unlikely(!lport)) { if (unlikely(!lport)) { FCOE_NETDEV_DBG(netdev, "Cannot find hba structure"); FCOE_NETDEV_DBG(netdev, "Cannot find hba structure\n"); goto err2; goto err2; } } if (!lport->link_up) if (!lport->link_up) goto err2; goto err2; FCOE_NETDEV_DBG(netdev, "skb_info: len:%d data_len:%d head:%p " FCOE_NETDEV_DBG(netdev, "data:%p tail:%p end:%p sum:%d dev:%s", "skb_info: len:%d data_len:%d head:%p data:%p tail:%p end:%p sum:%d dev:%s\n", skb->len, skb->data_len, skb->head, skb->data, skb->len, skb->data_len, skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb_tail_pointer(skb), skb_end_pointer(skb), skb->csum, skb->dev ? skb->dev->name : "<NULL>"); skb->csum, skb->dev ? skb->dev->name : "<NULL>"); skb = skb_share_check(skb, GFP_ATOMIC); if (skb == NULL) return NET_RX_DROP; eh = eth_hdr(skb); eh = eth_hdr(skb); if (is_fip_mode(ctlr) && if (is_fip_mode(ctlr) && compare_ether_addr(eh->h_source, ctlr->dest_addr)) { !ether_addr_equal(eh->h_source, ctlr->dest_addr)) { FCOE_NETDEV_DBG(netdev, "wrong source mac address:%pM\n", FCOE_NETDEV_DBG(netdev, "wrong source mac address:%pM\n", eh->h_source); eh->h_source); goto err; goto err; Loading Loading @@ -1540,13 +1547,13 @@ static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, wake_up_process(fps->thread); wake_up_process(fps->thread); spin_unlock(&fps->fcoe_rx_list.lock); spin_unlock(&fps->fcoe_rx_list.lock); return 0; return NET_RX_SUCCESS; err: err: per_cpu_ptr(lport->stats, get_cpu())->ErrorFrames++; per_cpu_ptr(lport->stats, get_cpu())->ErrorFrames++; put_cpu(); put_cpu(); err2: err2: kfree_skb(skb); kfree_skb(skb); return -1; return NET_RX_DROP; } } /** /** Loading Loading @@ -1788,13 +1795,13 @@ static void fcoe_recv_frame(struct sk_buff *skb) lport = fr->fr_dev; lport = fr->fr_dev; if (unlikely(!lport)) { if (unlikely(!lport)) { if (skb->destructor != fcoe_percpu_flush_done) if (skb->destructor != fcoe_percpu_flush_done) FCOE_NETDEV_DBG(skb->dev, "NULL lport in skb"); FCOE_NETDEV_DBG(skb->dev, "NULL lport in skb\n"); kfree_skb(skb); kfree_skb(skb); return; return; } } FCOE_NETDEV_DBG(skb->dev, "skb_info: len:%d data_len:%d " FCOE_NETDEV_DBG(skb->dev, "head:%p data:%p tail:%p end:%p sum:%d dev:%s", "skb_info: len:%d data_len:%d head:%p data:%p tail:%p end:%p sum:%d dev:%s\n", skb->len, skb->data_len, skb->len, skb->data_len, skb->head, skb->data, skb_tail_pointer(skb), skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->csum, skb_end_pointer(skb), skb->csum, Loading
drivers/scsi/fcoe/fcoe_ctlr.c +95 −53 Original line number Original line Diff line number Diff line Loading @@ -160,30 +160,50 @@ void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_state mode) } } EXPORT_SYMBOL(fcoe_ctlr_init); EXPORT_SYMBOL(fcoe_ctlr_init); /** * fcoe_sysfs_fcf_add() - Add a fcoe_fcf{,_device} to a fcoe_ctlr{,_device} * @new: The newly discovered FCF * * Called with fip->ctlr_mutex held */ static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new) static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new) { { struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); struct fcoe_ctlr_device *ctlr_dev; struct fcoe_fcf_device temp, *fcf_dev; struct fcoe_fcf_device *temp, *fcf_dev; int rc = 0; int rc = -ENOMEM; LIBFCOE_FIP_DBG(fip, "New FCF fab %16.16llx mac %pM\n", LIBFCOE_FIP_DBG(fip, "New FCF fab %16.16llx mac %pM\n", new->fabric_name, new->fcf_mac); new->fabric_name, new->fcf_mac); mutex_lock(&ctlr_dev->lock); temp = kzalloc(sizeof(*temp), GFP_KERNEL); if (!temp) goto out; temp->fabric_name = new->fabric_name; temp->switch_name = new->switch_name; temp->fc_map = new->fc_map; temp->vfid = new->vfid; memcpy(temp->mac, new->fcf_mac, ETH_ALEN); temp->priority = new->pri; temp->fka_period = new->fka_period; temp->selected = 0; /* default to unselected */ temp.fabric_name = new->fabric_name; /* temp.switch_name = new->switch_name; * If ctlr_dev doesn't exist then it means we're a libfcoe user temp.fc_map = new->fc_map; * who doesn't use fcoe_syfs and didn't allocate a fcoe_ctlr_device. temp.vfid = new->vfid; * fnic would be an example of a driver with this behavior. In this memcpy(temp.mac, new->fcf_mac, ETH_ALEN); * case we want to add the fcoe_fcf to the fcoe_ctlr list, but we temp.priority = new->pri; * don't want to make sysfs changes. temp.fka_period = new->fka_period; */ temp.selected = 0; /* default to unselected */ fcf_dev = fcoe_fcf_device_add(ctlr_dev, &temp); ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); if (ctlr_dev) { mutex_lock(&ctlr_dev->lock); fcf_dev = fcoe_fcf_device_add(ctlr_dev, temp); if (unlikely(!fcf_dev)) { if (unlikely(!fcf_dev)) { rc = -ENOMEM; rc = -ENOMEM; mutex_unlock(&ctlr_dev->lock); goto out; goto out; } } Loading @@ -201,33 +221,52 @@ static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new) fcf_dev->priv = new; fcf_dev->priv = new; new->fcf_dev = fcf_dev; new->fcf_dev = fcf_dev; mutex_unlock(&ctlr_dev->lock); } list_add(&new->list, &fip->fcfs); list_add(&new->list, &fip->fcfs); fip->fcf_count++; fip->fcf_count++; rc = 0; out: out: mutex_unlock(&ctlr_dev->lock); kfree(temp); return rc; return rc; } } /** * fcoe_sysfs_fcf_del() - Remove a fcoe_fcf{,_device} to a fcoe_ctlr{,_device} * @new: The FCF to be removed * * Called with fip->ctlr_mutex held */ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new) { { struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr *fip = new->fip; struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); struct fcoe_ctlr_device *cdev; struct fcoe_fcf_device *fcf_dev; struct fcoe_fcf_device *fcf_dev; list_del(&new->list); list_del(&new->list); fip->fcf_count--; fip->fcf_count--; mutex_lock(&ctlr_dev->lock); /* * If ctlr_dev doesn't exist then it means we're a libfcoe user * who doesn't use fcoe_syfs and didn't allocate a fcoe_ctlr_device * or a fcoe_fcf_device. * * fnic would be an example of a driver with this behavior. In this * case we want to remove the fcoe_fcf from the fcoe_ctlr list (above), * but we don't want to make sysfs changes. */ cdev = fcoe_ctlr_to_ctlr_dev(fip); if (cdev) { mutex_lock(&cdev->lock); fcf_dev = fcoe_fcf_to_fcf_dev(new); fcf_dev = fcoe_fcf_to_fcf_dev(new); WARN_ON(!fcf_dev); WARN_ON(!fcf_dev); new->fcf_dev = NULL; new->fcf_dev = NULL; fcoe_fcf_device_delete(fcf_dev); fcoe_fcf_device_delete(fcf_dev); kfree(new); kfree(new); mutex_unlock(&cdev->lock); mutex_unlock(&ctlr_dev->lock); } } } /** /** Loading Loading @@ -300,7 +339,7 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip) spin_unlock_bh(&fip->ctlr_lock); spin_unlock_bh(&fip->ctlr_lock); sel = fip->sel_fcf; sel = fip->sel_fcf; if (sel && !compare_ether_addr(sel->fcf_mac, fip->dest_addr)) if (sel && ether_addr_equal(sel->fcf_mac, fip->dest_addr)) goto unlock; goto unlock; if (!is_zero_ether_addr(fip->dest_addr)) { if (!is_zero_ether_addr(fip->dest_addr)) { printk(KERN_NOTICE "libfcoe: host%d: " printk(KERN_NOTICE "libfcoe: host%d: " Loading Loading @@ -1000,7 +1039,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) if (fcf->switch_name == new.switch_name && if (fcf->switch_name == new.switch_name && fcf->fabric_name == new.fabric_name && fcf->fabric_name == new.fabric_name && fcf->fc_map == new.fc_map && fcf->fc_map == new.fc_map && compare_ether_addr(fcf->fcf_mac, new.fcf_mac) == 0) { ether_addr_equal(fcf->fcf_mac, new.fcf_mac)) { found = 1; found = 1; break; break; } } Loading Loading @@ -1340,7 +1379,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, mp = (struct fip_mac_desc *)desc; mp = (struct fip_mac_desc *)desc; if (dlen < sizeof(*mp)) if (dlen < sizeof(*mp)) goto err; goto err; if (compare_ether_addr(mp->fd_mac, fcf->fcf_mac)) if (!ether_addr_equal(mp->fd_mac, fcf->fcf_mac)) goto err; goto err; desc_mask &= ~BIT(FIP_DT_MAC); desc_mask &= ~BIT(FIP_DT_MAC); break; break; Loading Loading @@ -1418,8 +1457,8 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, * 'port_id' is already validated, check MAC address and * 'port_id' is already validated, check MAC address and * wwpn * wwpn */ */ if (compare_ether_addr(fip->get_src_addr(vn_port), if (!ether_addr_equal(fip->get_src_addr(vn_port), vp->fd_mac) != 0 || vp->fd_mac) || get_unaligned_be64(&vp->fd_wwpn) != get_unaligned_be64(&vp->fd_wwpn) != vn_port->wwpn) vn_port->wwpn) continue; continue; Loading Loading @@ -1453,6 +1492,9 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, */ */ void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) { { skb = skb_share_check(skb, GFP_ATOMIC); if (!skb) return; skb_queue_tail(&fip->fip_recv_list, skb); skb_queue_tail(&fip->fip_recv_list, skb); schedule_work(&fip->recv_work); schedule_work(&fip->recv_work); } } Loading @@ -1479,12 +1521,12 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb) goto drop; goto drop; eh = eth_hdr(skb); eh = eth_hdr(skb); if (fip->mode == FIP_MODE_VN2VN) { if (fip->mode == FIP_MODE_VN2VN) { if (compare_ether_addr(eh->h_dest, fip->ctl_src_addr) && if (!ether_addr_equal(eh->h_dest, fip->ctl_src_addr) && compare_ether_addr(eh->h_dest, fcoe_all_vn2vn) && !ether_addr_equal(eh->h_dest, fcoe_all_vn2vn) && compare_ether_addr(eh->h_dest, fcoe_all_p2p)) !ether_addr_equal(eh->h_dest, fcoe_all_p2p)) goto drop; goto drop; } else if (compare_ether_addr(eh->h_dest, fip->ctl_src_addr) && } else if (!ether_addr_equal(eh->h_dest, fip->ctl_src_addr) && compare_ether_addr(eh->h_dest, fcoe_all_enode)) !ether_addr_equal(eh->h_dest, fcoe_all_enode)) goto drop; goto drop; fiph = (struct fip_header *)skb->data; fiph = (struct fip_header *)skb->data; op = ntohs(fiph->fip_op); op = ntohs(fiph->fip_op); Loading Loading @@ -1856,7 +1898,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, * address_mode flag to use FC_OUI-based Ethernet DA. * address_mode flag to use FC_OUI-based Ethernet DA. * Otherwise we use the FCoE gateway addr * Otherwise we use the FCoE gateway addr */ */ if (!compare_ether_addr(sa, (u8[6])FC_FCOE_FLOGI_MAC)) { if (ether_addr_equal(sa, (u8[6])FC_FCOE_FLOGI_MAC)) { fcoe_ctlr_map_dest(fip); fcoe_ctlr_map_dest(fip); } else { } else { memcpy(fip->dest_addr, sa, ETH_ALEN); memcpy(fip->dest_addr, sa, ETH_ALEN); Loading Loading @@ -2825,7 +2867,7 @@ static void fcoe_ctlr_vn_timeout(struct fcoe_ctlr *fip) * disabled, so that should ensure that this routine is only called * disabled, so that should ensure that this routine is only called * when nothing is happening. * when nothing is happening. */ */ void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip, static void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip, enum fip_state fip_mode) enum fip_state fip_mode) { { void *priv; void *priv; Loading
drivers/scsi/fcoe/fcoe_sysfs.c +7 −7 Original line number Original line Diff line number Diff line Loading @@ -300,29 +300,29 @@ static ssize_t store_ctlr_mode(struct device *dev, switch (ctlr->enabled) { switch (ctlr->enabled) { case FCOE_CTLR_ENABLED: case FCOE_CTLR_ENABLED: LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled."); LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n"); return -EBUSY; return -EBUSY; case FCOE_CTLR_DISABLED: case FCOE_CTLR_DISABLED: if (!ctlr->f->set_fcoe_ctlr_mode) { if (!ctlr->f->set_fcoe_ctlr_mode) { LIBFCOE_SYSFS_DBG(ctlr, LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported by LLD."); "Mode change not supported by LLD.\n"); return -ENOTSUPP; return -ENOTSUPP; } } ctlr->mode = fcoe_parse_mode(mode); ctlr->mode = fcoe_parse_mode(mode); if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) { if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) { LIBFCOE_SYSFS_DBG(ctlr, LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n", "Unknown mode %s provided.", buf); buf); return -EINVAL; return -EINVAL; } } ctlr->f->set_fcoe_ctlr_mode(ctlr); ctlr->f->set_fcoe_ctlr_mode(ctlr); LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.", buf); LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf); return count; return count; case FCOE_CTLR_UNUSED: case FCOE_CTLR_UNUSED: default: default: LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported."); LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n"); return -ENOTSUPP; return -ENOTSUPP; }; }; } } Loading Loading @@ -653,7 +653,7 @@ static int fcoe_fcf_device_match(struct fcoe_fcf_device *new, if (new->switch_name == old->switch_name && if (new->switch_name == old->switch_name && new->fabric_name == old->fabric_name && new->fabric_name == old->fabric_name && new->fc_map == old->fc_map && new->fc_map == old->fc_map && compare_ether_addr(new->mac, old->mac) == 0) ether_addr_equal(new->mac, old->mac)) return 1; return 1; return 0; return 0; } } Loading
drivers/scsi/fnic/fnic_fcs.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -658,13 +658,13 @@ void fnic_update_mac_locked(struct fnic *fnic, u8 *new) if (is_zero_ether_addr(new)) if (is_zero_ether_addr(new)) new = ctl; new = ctl; if (!compare_ether_addr(data, new)) if (ether_addr_equal(data, new)) return; return; FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new); FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, "update_mac %pM\n", new); if (!is_zero_ether_addr(data) && compare_ether_addr(data, ctl)) if (!is_zero_ether_addr(data) && !ether_addr_equal(data, ctl)) vnic_dev_del_addr(fnic->vdev, data); vnic_dev_del_addr(fnic->vdev, data); memcpy(data, new, ETH_ALEN); memcpy(data, new, ETH_ALEN); if (compare_ether_addr(new, ctl)) if (!ether_addr_equal(new, ctl)) vnic_dev_add_addr(fnic->vdev, new); vnic_dev_add_addr(fnic->vdev, new); } } Loading