Lines Matching refs:lport
552 fcoe_check_wait_queue(port->lport, skb);
554 fcoe_check_wait_queue(port->lport, skb);
585 * @lport: The local port to update the source MAC on
591 static void fcoe_update_src_mac(struct fc_lport *lport, u8 *addr)
593 struct fcoe_port *port = lport_priv(lport);
604 * fcoe_get_src_mac() - return the Ethernet source address for an lport
605 * @lport: libfc lport
607 static u8 *fcoe_get_src_mac(struct fc_lport *lport)
609 struct fcoe_port *port = lport_priv(lport);
616 * @lport: The local port to be setup
620 static int fcoe_lport_config(struct fc_lport *lport)
622 lport->link_up = 0;
623 lport->qfull = 0;
624 lport->max_retry_count = 3;
625 lport->max_rport_retry_count = 3;
626 lport->e_d_tov = fcoe_e_d_tov;
627 lport->r_a_tov = fcoe_r_a_tov;
628 lport->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS |
630 lport->does_npiv = 1;
632 fc_lport_init_stats(lport);
634 /* lport fc_lport related configuration */
635 fc_lport_config(lport);
638 lport->crc_offload = 0;
639 lport->seq_offload = 0;
640 lport->lro_enabled = 0;
641 lport->lro_xid = 0;
642 lport->lso_max = 0;
648 * fcoe_netdev_features_change - Updates the lport's offload flags based
651 static void fcoe_netdev_features_change(struct fc_lport *lport,
654 mutex_lock(&lport->lp_mutex);
657 lport->sg_supp = 1;
659 lport->sg_supp = 0;
662 lport->crc_offload = 1;
665 lport->crc_offload = 0;
669 lport->seq_offload = 1;
670 lport->lso_max = min(netdev->gso_max_size, GSO_LEGACY_MAX_SIZE);
672 lport->lso_max);
674 lport->seq_offload = 0;
675 lport->lso_max = 0;
679 lport->lro_enabled = 1;
680 lport->lro_xid = netdev->fcoe_ddp_xid;
682 lport->lro_xid);
684 lport->lro_enabled = 0;
685 lport->lro_xid = 0;
688 mutex_unlock(&lport->lp_mutex);
693 * @lport: The local port that is associated with the net device
700 static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
708 /* Setup lport private data to point to fcoe softc */
709 port = lport_priv(lport);
715 lport->vlan = vlan_dev_vlan_id(netdev);
717 lport->vlan = 0;
730 if (fc_set_mfs(lport, mfs))
734 fcoe_netdev_features_change(lport, netdev);
740 fcoe_link_speed_update(lport);
742 if (!lport->vport) {
745 fc_set_wwnn(lport, wwnn);
749 fc_set_wwpn(lport, wwpn);
757 * @lport: The local port
764 static int fcoe_shost_config(struct fc_lport *lport, struct device *dev)
768 /* lport scsi host config */
769 lport->host->max_lun = FCOE_MAX_LUN;
770 lport->host->max_id = FCOE_MAX_FCP_TARGET;
771 lport->host->max_channel = 0;
772 lport->host->max_cmd_len = FCOE_MAX_CMD_LEN;
774 if (lport->vport)
775 lport->host->transportt = fcoe_vport_scsi_transport;
777 lport->host->transportt = fcoe_nport_scsi_transport;
780 rc = scsi_add_host(lport->host, dev);
782 FCOE_NETDEV_DBG(fcoe_netdev(lport), "fcoe_shost_config: "
787 if (!lport->vport)
788 fc_host_max_npiv_vports(lport->host) = USHRT_MAX;
790 snprintf(fc_host_symbolic_name(lport->host), FC_SYMBOLIC_NAME_SIZE,
792 fcoe_netdev(lport)->name);
800 * @lport: The local port that is associated with the net device
806 static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
813 port = lport_priv(lport);
818 if (lport->vport)
835 snprintf(fc_host_serial_number(lport->host),
839 snprintf(fc_host_manufacturer(lport->host),
843 snprintf(fc_host_model(lport->host),
847 snprintf(fc_host_model_description(lport->host),
851 snprintf(fc_host_hardware_version(lport->host),
855 snprintf(fc_host_driver_version(lport->host),
859 snprintf(fc_host_optionrom_version(lport->host),
863 snprintf(fc_host_firmware_version(lport->host),
868 /* Enable FDMI lport states */
869 lport->fdmi_enabled = 1;
872 lport->fdmi_enabled = 0;
916 * @lport: The local port that the new EM will be associated with
920 static inline int fcoe_em_config(struct fc_lport *lport)
922 struct fcoe_port *port = lport_priv(lport);
931 * offload exchange ids to be shared across all VN_PORTs/lport.
933 if (!lport->lro_enabled || !lport->lro_xid ||
934 (lport->lro_xid >= max_xid)) {
935 lport->lro_xid = 0;
961 if (!fc_exch_mgr_add(lport, fcoe->oem, fcoe_oem_match)) {
968 fcoe->oem = fc_exch_mgr_alloc(lport, FC_CLASS_3,
969 FCOE_MIN_XID, lport->lro_xid,
982 min_xid += lport->lro_xid + 1;
985 if (!fc_exch_mgr_alloc(lport, FC_CLASS_3, min_xid, max_xid, NULL)) {
996 * @lport: The local port to be destroyed
1001 static void fcoe_if_destroy(struct fc_lport *lport)
1003 struct fcoe_port *port = lport_priv(lport);
1010 fc_fabric_logoff(lport);
1013 fc_lport_destroy(lport);
1019 fcoe_clean_pending_queue(lport);
1023 if (lport->vport)
1029 fcoe_percpu_clean(lport);
1032 fc_remove_host(lport->host);
1033 scsi_remove_host(lport->host);
1035 /* Destroy lport scsi_priv */
1036 fc_fcp_destroy(lport);
1039 fc_exch_mgr_free(lport);
1042 fc_lport_free_stats(lport);
1046 * master lport until it fcoe interface fully cleaned-up.
1048 if (lport->vport)
1049 scsi_host_put(lport->host);
1054 * @lport: The local port to setup DDP for
1061 static int fcoe_ddp_setup(struct fc_lport *lport, u16 xid,
1064 struct net_device *netdev = fcoe_netdev(lport);
1076 * @lport: The local port to setup DDP for
1083 static int fcoe_ddp_target(struct fc_lport *lport, u16 xid,
1086 struct net_device *netdev = fcoe_netdev(lport);
1098 * @lport: The local port to complete DDP on
1103 static int fcoe_ddp_done(struct fc_lport *lport, u16 xid)
1105 struct net_device *netdev = fcoe_netdev(lport);
1127 struct fc_lport *lport, *n_port;
1140 lport = libfc_host_alloc(&fcoe_shost_template, sizeof(*port));
1142 lport = libfc_vport_create(vport, sizeof(*port));
1144 if (!lport) {
1149 port = lport_priv(lport);
1150 port->lport = lport;
1158 * Need to add the lport to the hostlist
1161 fcoe_hostlist_add(lport);
1164 rc = fcoe_lport_config(lport);
1166 FCOE_NETDEV_DBG(netdev, "Could not configure lport for the "
1175 fc_set_wwnn(lport, vport->node_name);
1176 fc_set_wwpn(lport, vport->port_name);
1179 /* configure lport network properties */
1180 rc = fcoe_netdev_config(lport, netdev);
1187 /* configure lport scsi host properties */
1188 rc = fcoe_shost_config(lport, parent);
1196 rc = fcoe_libfc_config(lport, ctlr, &fcoe_libfc_fcn_templ, 1);
1204 fcoe_fdmi_info(lport, netdev);
1216 /* lport exch manager allocation */
1217 rc = fcoe_em_config(lport);
1221 rc = fc_exch_mgr_list_clone(n_port, lport);
1229 return lport;
1232 fc_exch_mgr_free(lport);
1234 fcoe_hostlist_del(lport);
1235 scsi_host_put(lport->host);
1317 struct fc_lport *lport;
1328 lport = ctlr->lp;
1329 if (unlikely(!lport)) {
1333 if (!lport->link_up)
1375 fr->fr_dev = lport;
1417 this_cpu_inc(lport->stats->ErrorFrames);
1445 * @lport: The local port that the frame is to be transmitted for
1450 static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp)
1461 struct fcoe_port *port = lport_priv(lport);
1472 if (!lport->link_up) {
1478 fcoe_ctlr_els_send(ctlr, lport, skb))
1490 if (likely(lport->crc_offload)) {
1558 if (lport->seq_offload && fr_max_payload(fp)) {
1566 this_cpu_inc(lport->stats->TxFrames);
1567 this_cpu_add(lport->stats->TxWords, wlen);
1570 fr_dev(fp) = lport;
1577 * @lport: The local port the frame was received on
1582 static inline int fcoe_filter_frames(struct fc_lport *lport,
1595 if (lport->crc_offload && skb->ip_summed == CHECKSUM_UNNECESSARY)
1604 fcoe = ((struct fcoe_port *)lport_priv(lport))->priv;
1608 FCOE_DBG("fcoe: dropping FCoE lport LOGO in fip mode\n");
1618 if (this_cpu_inc_return(lport->stats->InvalidCRCCount) < 5)
1630 struct fc_lport *lport;
1637 lport = fr->fr_dev;
1638 if (unlikely(!lport)) {
1639 FCOE_NETDEV_DBG(skb->dev, "NULL lport in skb\n");
1662 stats = per_cpu_ptr(lport->stats, raw_smp_processor_id());
1676 this_cpu_inc(lport->stats->RxFrames);
1677 this_cpu_add(lport->stats->RxWords, fr_len / FCOE_WORD_TO_BYTE);
1681 fr_dev(fp) = lport;
1692 if (!fcoe_filter_frames(lport, fp)) {
1693 fc_exch_recv(lport, fp);
1697 this_cpu_inc(lport->stats->ErrorFrames);
1817 struct fc_lport *lport = NULL;
1828 lport = ctlr->lp;
1832 if (!lport) {
1851 fc_set_mfs(lport, mfs);
1857 fcoe_vport_remove(lport);
1859 fcoe_if_destroy(lport);
1867 fcoe_netdev_features_change(lport, netdev);
1874 fcoe_link_speed_update(lport);
1878 if (link_possible && !fcoe_link_ok(lport)) {
1894 this_cpu_inc(lport->stats->LinkFailureCount);
1895 fcoe_clean_pending_queue(lport);
1982 struct fc_lport *lport = ctlr->lp;
1983 struct net_device *netdev = fcoe_netdev(lport);
2034 struct fc_lport *lport;
2046 lport = ctlr->lp;
2047 port = lport_priv(lport);
2069 fcoe_vport_remove(port->lport);
2078 fcoe_if_destroy(port->lport);
2170 struct fc_lport *lport;
2175 /* look for existing lport */
2189 lport = fcoe_if_create(fcoe, &ctlr_dev->dev, 0);
2190 if (IS_ERR(lport)) {
2204 ctlr->lp = lport;
2210 lport->boot_time = jiffies;
2211 fc_fabric_login(lport);
2215 * it must be done after the lport is added to the
2222 * before the lport can be found in the hostlist
2231 !fcoe_link_ok(lport)) {
2278 * @lport: The local port to check link on
2283 static int fcoe_link_ok(struct fc_lport *lport)
2285 struct net_device *netdev = fcoe_netdev(lport);
2294 * @lport: The local port whose skbs are to be cleared
2302 static void fcoe_percpu_clean(struct fc_lport *lport)
2322 struct fc_lport *lport = shost_priv(shost);
2323 struct fcoe_port *port = lport_priv(lport);
2379 * @lport: The local port that identifies the FCoE interface to be added
2385 static int fcoe_hostlist_add(const struct fc_lport *lport)
2390 fcoe = fcoe_hostlist_lookup_port(fcoe_netdev(lport));
2392 port = lport_priv(lport);
2402 * @lport: The local port that identifies the FCoE interface to be added
2407 static void fcoe_hostlist_del(const struct fc_lport *lport)
2412 port = lport_priv(lport);
2502 fcoe_hostlist_del(port->lport);
2543 struct fc_lport *lport = exch->lp;
2552 fcoe_ctlr_recv_flogi(fip, lport, fp);
2554 fcoe_update_src_mac(lport, mac);
2556 fc_lport_flogi_resp(seq, fp, lport);
2570 struct fc_lport *lport = arg;
2574 fcoe_update_src_mac(lport, zero_mac);
2575 fc_lport_logo_resp(seq, fp, lport);
2583 * the argument (the lport is still available from the exchange).
2587 static struct fc_seq *fcoe_elsct_send(struct fc_lport *lport, u32 did,
2594 struct fcoe_port *port = lport_priv(lport);
2602 if (lport->point_to_multipoint)
2604 return fc_elsct_send(lport, did, fp, op, fcoe_flogi_resp,
2610 return fc_elsct_send(lport, did, fp, op, fcoe_logo_resp,
2611 lport, timeout);
2613 return fc_elsct_send(lport, did, fp, op, resp, arg, timeout);
2692 * @lport: lport for which the vports should be removed
2694 static void fcoe_vport_remove(struct fc_lport *lport)
2702 shost = lport->host;
2728 struct fc_lport *lport = vport->dd_data;
2732 fc_fabric_logoff(lport);
2734 lport->boot_time = jiffies;
2735 fc_fabric_login(lport);
2736 fc_vport_setlink(lport);
2752 struct fc_lport *lport = vport->dd_data;
2756 snprintf(fc_host_symbolic_name(lport->host), FC_SYMBOLIC_NAME_SIZE,
2758 fcoe_netdev(lport)->name, vport->symbolic_name);
2760 if (lport->state != LPORT_ST_READY)
2763 len = strnlen(fc_host_symbolic_name(lport->host), 255);
2764 fp = fc_frame_alloc(lport,
2769 lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RSPN_ID,
2770 NULL, NULL, 3 * lport->r_a_tov);
2785 * @lport: the local port
2795 static void fcoe_set_port_id(struct fc_lport *lport,
2798 struct fcoe_port *port = lport_priv(lport);
2803 fcoe_ctlr_recv_flogi(ctlr, lport, fp);