Lines Matching refs:fcoe

172 	struct fcoe_port *fcoe;  in fcoe_demux()  local
174 list_for_each_entry ( fcoe, &fcoe_ports, list ) { in fcoe_demux()
175 if ( fcoe->netdev == netdev ) in fcoe_demux()
176 return fcoe; in fcoe_demux()
186 static void fcoe_reset ( struct fcoe_port *fcoe ) { in fcoe_reset() argument
189 intf_restart ( &fcoe->transport, -ECANCELED ); in fcoe_reset()
192 stop_timer ( &fcoe->timer ); in fcoe_reset()
193 fcoe->timeouts = 0; in fcoe_reset()
194 fcoe->flags = 0; in fcoe_reset()
195 fcoe->priority = ( FIP_LOWEST_PRIORITY + 1 ); in fcoe_reset()
196 fcoe->keepalive = 0; in fcoe_reset()
197 memcpy ( fcoe->fcf_mac, default_fcf_mac, in fcoe_reset()
198 sizeof ( fcoe->fcf_mac ) ); in fcoe_reset()
199 memcpy ( fcoe->local_mac, fcoe->netdev->ll_addr, in fcoe_reset()
200 sizeof ( fcoe->local_mac ) ); in fcoe_reset()
203 if ( netdev_is_open ( fcoe->netdev ) && in fcoe_reset()
204 netdev_link_ok ( fcoe->netdev ) ) { in fcoe_reset()
205 fcoe->flags |= FCOE_HAVE_NETWORK; in fcoe_reset()
206 start_timer_nodelay ( &fcoe->timer ); in fcoe_reset()
207 DBGC ( fcoe, "FCoE %s starting %s\n", fcoe->netdev->name, in fcoe_reset()
208 ( vlan_can_be_trunk ( fcoe->netdev ) ? in fcoe_reset()
213 xfer_window_changed ( &fcoe->transport ); in fcoe_reset()
224 static int fcoe_deliver ( struct fcoe_port *fcoe, in fcoe_deliver() argument
242 ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) { in fcoe_deliver()
256 if ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) { in fcoe_deliver()
257 memcpy ( fipmac->mac, fcoe->netdev->ll_addr, in fcoe_deliver()
269 fiphdr->flags = ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ? in fcoe_deliver()
274 ll_source = fcoe->netdev->ll_addr; in fcoe_deliver()
297 ll_source = fcoe->local_mac; in fcoe_deliver()
301 if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, net_protocol, in fcoe_deliver()
302 fcoe->fcf_mac, ll_source ) ) != 0 ) { in fcoe_deliver()
303 DBGC ( fcoe, "FCoE %s could not transmit: %s\n", in fcoe_deliver()
304 fcoe->netdev->name, strerror ( rc ) ); in fcoe_deliver()
319 static struct io_buffer * fcoe_alloc_iob ( struct fcoe_port *fcoe __unused, in fcoe_alloc_iob()
347 struct fcoe_port *fcoe; in fcoe_rx() local
351 if ( ( fcoe = fcoe_demux ( netdev ) ) == NULL ) { in fcoe_rx()
359 if ( ( memcmp ( fcoe->local_mac, ll_dest, in fcoe_rx()
360 sizeof ( fcoe->local_mac ) ) != 0 ) && in fcoe_rx()
363 DBGC2 ( fcoe, "FCoE %s ignoring packet for %s\n", in fcoe_rx()
364 fcoe->netdev->name, eth_ntoa ( ll_dest ) ); in fcoe_rx()
371 DBGC ( fcoe, "FCoE %s received under-length frame (%zd " in fcoe_rx()
372 "bytes)\n", fcoe->netdev->name, iob_len ( iobuf ) ); in fcoe_rx()
385 DBGC ( fcoe, "FCoE %s received unsupported frame version " in fcoe_rx()
386 "%02x\n", fcoe->netdev->name, fcoehdr->version ); in fcoe_rx()
392 DBGC ( fcoe, "FCoE %s received unsupported start-of-frame " in fcoe_rx()
393 "delimiter %02x\n", fcoe->netdev->name, fcoehdr->sof ); in fcoe_rx()
399 DBGC ( fcoe, "FCoE %s received invalid CRC\n", in fcoe_rx()
400 fcoe->netdev->name ); in fcoe_rx()
406 DBGC ( fcoe, "FCoE %s received unsupported end-of-frame " in fcoe_rx()
407 "delimiter %02x\n", fcoe->netdev->name, fcoeftr->eof ); in fcoe_rx()
413 if ( ( fcoe->flags & FCOE_HAVE_FCF ) && in fcoe_rx()
414 ( ! ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) ) { in fcoe_rx()
415 memcpy ( &fcoe->fcf_mac, ll_source, sizeof ( fcoe->fcf_mac ) ); in fcoe_rx()
419 if ( ( rc = xfer_deliver_iob ( &fcoe->transport, in fcoe_rx()
421 DBGC ( fcoe, "FCoE %s could not deliver frame: %s\n", in fcoe_rx()
422 fcoe->netdev->name, strerror ( rc ) ); in fcoe_rx()
437 static size_t fcoe_window ( struct fcoe_port *fcoe ) { in fcoe_window() argument
438 return ( ( fcoe->flags & FCOE_HAVE_FCF ) ? ~( ( size_t ) 0 ) : 0 ); in fcoe_window()
447 static void fcoe_close ( struct fcoe_port *fcoe, int rc ) { in fcoe_close() argument
449 stop_timer ( &fcoe->timer ); in fcoe_close()
450 intf_shutdown ( &fcoe->transport, rc ); in fcoe_close()
451 netdev_put ( fcoe->netdev ); in fcoe_close()
452 list_del ( &fcoe->list ); in fcoe_close()
453 ref_put ( &fcoe->refcnt ); in fcoe_close()
462 static struct device * fcoe_identify_device ( struct fcoe_port *fcoe ) { in fcoe_identify_device() argument
463 return fcoe->netdev->dev; in fcoe_identify_device()
496 static int fcoe_fip_parse ( struct fcoe_port *fcoe, struct fip_header *fiphdr, in fcoe_fip_parse() argument
506 DBGC ( fcoe, "FCoE %s received unsupported FIP version %02x\n", in fcoe_fip_parse()
507 fcoe->netdev->name, fiphdr->version ); in fcoe_fip_parse()
514 DBGC ( fcoe, "FCoE %s received bad descriptor list length\n", in fcoe_fip_parse()
515 fcoe->netdev->name ); in fcoe_fip_parse()
530 DBGC ( fcoe, "FCoE %s received zero-length " in fcoe_fip_parse()
531 "descriptor\n", fcoe->netdev->name ); in fcoe_fip_parse()
535 DBGC ( fcoe, "FCoE %s descriptor overrun\n", in fcoe_fip_parse()
536 fcoe->netdev->name ); in fcoe_fip_parse()
551 DBGC ( fcoe, "FCoE %s cannot understand critical " in fcoe_fip_parse()
553 fcoe->netdev->name, desc_type ); in fcoe_fip_parse()
569 static int fcoe_fip_tx_vlan ( struct fcoe_port *fcoe ) { in fcoe_fip_tx_vlan() argument
594 memcpy ( request->mac_address.mac, fcoe->netdev->ll_addr, in fcoe_fip_tx_vlan()
598 if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, in fcoe_fip_tx_vlan()
600 fcoe->netdev->ll_addr ) ) != 0 ) { in fcoe_fip_tx_vlan()
601 DBGC ( fcoe, "FCoE %s could not send VLAN request: " in fcoe_fip_tx_vlan()
602 "%s\n", fcoe->netdev->name, strerror ( rc ) ); in fcoe_fip_tx_vlan()
617 static int fcoe_fip_rx_vlan ( struct fcoe_port *fcoe, in fcoe_fip_rx_vlan() argument
627 DBGC ( fcoe, "FCoE %s received VLAN notification missing MAC " in fcoe_fip_rx_vlan()
628 "address\n", fcoe->netdev->name ); in fcoe_fip_rx_vlan()
632 DBGC ( fcoe, "FCoE %s received VLAN notification missing VLAN " in fcoe_fip_rx_vlan()
633 "tag\n", fcoe->netdev->name ); in fcoe_fip_rx_vlan()
639 DBGC ( fcoe, "FCoE %s creating VLAN %d for FCF %s\n", in fcoe_fip_rx_vlan()
640 fcoe->netdev->name, tag, eth_ntoa ( mac_address->mac ) ); in fcoe_fip_rx_vlan()
641 if ( ( rc = vlan_create ( fcoe->netdev, tag, in fcoe_fip_rx_vlan()
643 DBGC ( fcoe, "FCoE %s could not create VLAN %d: %s\n", in fcoe_fip_rx_vlan()
644 fcoe->netdev->name, tag, strerror ( rc ) ); in fcoe_fip_rx_vlan()
652 fcoe->flags |= FCOE_VLAN_FOUND; in fcoe_fip_rx_vlan()
663 static int fcoe_fip_tx_solicitation ( struct fcoe_port *fcoe ) { in fcoe_fip_tx_solicitation() argument
691 memcpy ( solicitation->mac_address.mac, fcoe->netdev->ll_addr, in fcoe_fip_tx_solicitation()
695 memcpy ( &solicitation->name_id.name, &fcoe->node_wwn.fc, in fcoe_fip_tx_solicitation()
705 if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, in fcoe_fip_tx_solicitation()
707 fcoe->netdev->ll_addr ) ) != 0 ) { in fcoe_fip_tx_solicitation()
708 DBGC ( fcoe, "FCoE %s could not send discovery solicitation: " in fcoe_fip_tx_solicitation()
709 "%s\n", fcoe->netdev->name, strerror ( rc ) ); in fcoe_fip_tx_solicitation()
724 static int fcoe_fip_rx_advertisement ( struct fcoe_port *fcoe, in fcoe_fip_rx_advertisement() argument
733 DBGC ( fcoe, "FCoE %s received advertisement missing " in fcoe_fip_rx_advertisement()
734 "priority\n", fcoe->netdev->name ); in fcoe_fip_rx_advertisement()
738 DBGC ( fcoe, "FCoE %s received advertisement missing MAC " in fcoe_fip_rx_advertisement()
739 "address\n", fcoe->netdev->name ); in fcoe_fip_rx_advertisement()
743 DBGC ( fcoe, "FCoE %s received advertisement missing FKA ADV " in fcoe_fip_rx_advertisement()
744 "period\n", fcoe->netdev->name ); in fcoe_fip_rx_advertisement()
748 if ( ! ( fcoe->flags & FCOE_HAVE_FCF ) ) { in fcoe_fip_rx_advertisement()
756 ( priority->priority < fcoe->priority ) ) { in fcoe_fip_rx_advertisement()
758 fcoe->flags |= FCOE_HAVE_FIP_FCF; in fcoe_fip_rx_advertisement()
759 fcoe->priority = priority->priority; in fcoe_fip_rx_advertisement()
761 fcoe->keepalive = 0; in fcoe_fip_rx_advertisement()
763 fcoe->keepalive = ntohl ( fka_adv_p->period ); in fcoe_fip_rx_advertisement()
765 fcoe->flags &= ~FCOE_FCF_ALLOWS_SPMA; in fcoe_fip_rx_advertisement()
767 fcoe->flags |= FCOE_FCF_ALLOWS_SPMA; in fcoe_fip_rx_advertisement()
768 memcpy ( fcoe->fcf_mac, mac_address->mac, in fcoe_fip_rx_advertisement()
769 sizeof ( fcoe->fcf_mac ) ); in fcoe_fip_rx_advertisement()
770 DBGC ( fcoe, "FCoE %s selected FCF %s (pri %d", in fcoe_fip_rx_advertisement()
771 fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ), in fcoe_fip_rx_advertisement()
772 fcoe->priority ); in fcoe_fip_rx_advertisement()
773 if ( fcoe->keepalive ) { in fcoe_fip_rx_advertisement()
774 DBGC ( fcoe, ", FKA ADV %dms", in fcoe_fip_rx_advertisement()
775 fcoe->keepalive ); in fcoe_fip_rx_advertisement()
777 DBGC ( fcoe, ", %cPMA)\n", in fcoe_fip_rx_advertisement()
778 ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ? in fcoe_fip_rx_advertisement()
782 } else if ( fcoe->flags & FCOE_HAVE_FIP_FCF ) { in fcoe_fip_rx_advertisement()
788 if ( memcmp ( fcoe->fcf_mac, mac_address->mac, in fcoe_fip_rx_advertisement()
789 sizeof ( fcoe->fcf_mac ) ) == 0 ) { in fcoe_fip_rx_advertisement()
790 fcoe->timeouts = 0; in fcoe_fip_rx_advertisement()
799 fcoe_reset ( fcoe ); in fcoe_fip_rx_advertisement()
814 static int fcoe_fip_rx_els_response ( struct fcoe_port *fcoe, in fcoe_fip_rx_els_response() argument
825 DBGC ( fcoe, "FCoE %s received ELS response missing FLOGI\n", in fcoe_fip_rx_els_response()
826 fcoe->netdev->name ); in fcoe_fip_rx_els_response()
830 DBGC ( fcoe, "FCoE %s received ELS response missing MAC " in fcoe_fip_rx_els_response()
831 "address\n", fcoe->netdev->name ); in fcoe_fip_rx_els_response()
836 memcpy ( fcoe->local_mac, mac_address->mac, sizeof ( fcoe->local_mac )); in fcoe_fip_rx_els_response()
837 DBGC ( fcoe, "FCoE %s using local MAC %s\n", in fcoe_fip_rx_els_response()
838 fcoe->netdev->name, eth_ntoa ( fcoe->local_mac ) ); in fcoe_fip_rx_els_response()
843 if ( ( rc = xfer_deliver_raw ( &fcoe->transport, frame, in fcoe_fip_rx_els_response()
845 DBGC ( fcoe, "FCoE %s could not deliver FIP FLOGI frame: %s\n", in fcoe_fip_rx_els_response()
846 fcoe->netdev->name, strerror ( rc ) ); in fcoe_fip_rx_els_response()
859 static int fcoe_fip_tx_keepalive ( struct fcoe_port *fcoe ) { in fcoe_fip_tx_keepalive() argument
884 memcpy ( keepalive->mac_address.mac, fcoe->netdev->ll_addr, in fcoe_fip_tx_keepalive()
888 if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, in fcoe_fip_tx_keepalive()
889 &fip_protocol, fcoe->fcf_mac, in fcoe_fip_tx_keepalive()
890 fcoe->netdev->ll_addr ) ) != 0 ) { in fcoe_fip_tx_keepalive()
891 DBGC ( fcoe, "FCoE %s could not send keepalive: %s\n", in fcoe_fip_tx_keepalive()
892 fcoe->netdev->name, strerror ( rc ) ); in fcoe_fip_tx_keepalive()
913 int ( * rx ) ( struct fcoe_port *fcoe, struct fip_descriptors *descs,
945 struct fcoe_port *fcoe; in fcoe_fip_rx() local
950 if ( ( fcoe = fcoe_demux ( netdev ) ) == NULL ) { in fcoe_fip_rx()
958 if ( ( memcmp ( fcoe->netdev->ll_addr, ll_dest, ETH_ALEN ) != 0 ) && in fcoe_fip_rx()
963 DBGC2 ( fcoe, "FCoE %s ignoring FIP packet for %s\n", in fcoe_fip_rx()
964 fcoe->netdev->name, eth_ntoa ( ll_dest ) ); in fcoe_fip_rx()
970 if ( ( rc = fcoe_fip_parse ( fcoe, fiphdr, iob_len ( iobuf ), in fcoe_fip_rx()
980 rc = handler->rx ( fcoe, &descs, in fcoe_fip_rx()
985 DBGC ( fcoe, "FCoE %s received unsupported FIP code %04x.%02x\n", in fcoe_fip_rx()
986 fcoe->netdev->name, ntohs ( fiphdr->code ), fiphdr->subcode ); in fcoe_fip_rx()
1008 struct fcoe_port *fcoe = in fcoe_expired() local
1013 assert ( fcoe->flags & FCOE_HAVE_NETWORK ); in fcoe_expired()
1016 fcoe->timeouts++; in fcoe_expired()
1018 if ( vlan_can_be_trunk ( fcoe->netdev ) && in fcoe_expired()
1019 ! ( fcoe->flags & FCOE_VLAN_TIMED_OUT ) ) { in fcoe_expired()
1024 if ( fcoe->flags & FCOE_VLAN_FOUND ) { in fcoe_expired()
1025 fcoe->flags &= ~FCOE_VLAN_FOUND; in fcoe_expired()
1026 fcoe->timeouts = 0; in fcoe_expired()
1027 start_timer_fixed ( &fcoe->timer, in fcoe_expired()
1029 fcoe_fip_tx_vlan ( fcoe ); in fcoe_expired()
1037 if ( fcoe->timeouts <= FCOE_MAX_VLAN_REQUESTS ) { in fcoe_expired()
1038 start_timer_fixed ( &fcoe->timer, in fcoe_expired()
1040 fcoe_fip_tx_vlan ( fcoe ); in fcoe_expired()
1047 fcoe->flags |= FCOE_VLAN_TIMED_OUT; in fcoe_expired()
1048 fcoe->timeouts = 0; in fcoe_expired()
1049 DBGC ( fcoe, "FCoE %s giving up on VLAN discovery\n", in fcoe_expired()
1050 fcoe->netdev->name ); in fcoe_expired()
1051 start_timer_nodelay ( &fcoe->timer ); in fcoe_expired()
1053 } else if ( ! ( fcoe->flags & FCOE_HAVE_FCF ) ) { in fcoe_expired()
1059 start_timer_fixed ( &fcoe->timer, FCOE_FIP_RETRY_DELAY ); in fcoe_expired()
1060 if ( ( ! ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) && in fcoe_expired()
1061 ( fcoe->timeouts <= FCOE_MAX_FIP_SOLICITATIONS ) ) { in fcoe_expired()
1062 fcoe_fip_tx_solicitation ( fcoe ); in fcoe_expired()
1067 if ( ( rc = fc_port_open ( &fcoe->transport, &fcoe->node_wwn.fc, in fcoe_expired()
1068 &fcoe->port_wwn.fc, in fcoe_expired()
1069 fcoe->netdev->name ) ) != 0 ) { in fcoe_expired()
1070 DBGC ( fcoe, "FCoE %s could not create FC port: %s\n", in fcoe_expired()
1071 fcoe->netdev->name, strerror ( rc ) ); in fcoe_expired()
1075 stop_timer ( &fcoe->timer ); in fcoe_expired()
1080 fcoe->flags |= FCOE_HAVE_FCF; in fcoe_expired()
1081 fcoe->timeouts = 0; in fcoe_expired()
1082 DBGC ( fcoe, "FCoE %s using %sFIP FCF %s\n", fcoe->netdev->name, in fcoe_expired()
1083 ( ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ? "" : "non-" ), in fcoe_expired()
1084 eth_ntoa ( fcoe->fcf_mac ) ); in fcoe_expired()
1087 if ( fcoe->keepalive ) in fcoe_expired()
1088 start_timer_nodelay ( &fcoe->timer ); in fcoe_expired()
1091 xfer_window_changed ( &fcoe->transport ); in fcoe_expired()
1096 start_timer_fixed ( &fcoe->timer, in fcoe_expired()
1097 ( fcoe->keepalive * TICKS_PER_MS ) ); in fcoe_expired()
1098 fcoe_fip_tx_keepalive ( fcoe ); in fcoe_expired()
1101 if ( fcoe->timeouts > FCOE_MAX_FIP_MISSING_KEEPALIVES ) { in fcoe_expired()
1102 DBGC ( fcoe, "FCoE %s abandoning FCF %s\n", in fcoe_expired()
1103 fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac )); in fcoe_expired()
1104 fcoe_reset ( fcoe ); in fcoe_expired()
1117 struct fcoe_port *fcoe; in fcoe_probe() local
1129 fcoe = zalloc ( sizeof ( *fcoe ) ); in fcoe_probe()
1130 if ( ! fcoe ) { in fcoe_probe()
1134 ref_init ( &fcoe->refcnt, NULL ); in fcoe_probe()
1135 intf_init ( &fcoe->transport, &fcoe_transport_desc, &fcoe->refcnt ); in fcoe_probe()
1136 timer_init ( &fcoe->timer, fcoe_expired, &fcoe->refcnt ); in fcoe_probe()
1137 fcoe->netdev = netdev_get ( netdev ); in fcoe_probe()
1140 fcoe->node_wwn.fcoe.authority = htons ( FCOE_AUTHORITY_IEEE ); in fcoe_probe()
1141 memcpy ( &fcoe->node_wwn.fcoe.mac, netdev->ll_addr, in fcoe_probe()
1142 sizeof ( fcoe->node_wwn.fcoe.mac ) ); in fcoe_probe()
1143 fcoe->port_wwn.fcoe.authority = htons ( FCOE_AUTHORITY_IEEE_EXTENDED ); in fcoe_probe()
1144 memcpy ( &fcoe->port_wwn.fcoe.mac, netdev->ll_addr, in fcoe_probe()
1145 sizeof ( fcoe->port_wwn.fcoe.mac ) ); in fcoe_probe()
1147 DBGC ( fcoe, "FCoE %s is %s", fcoe->netdev->name, in fcoe_probe()
1148 fc_ntoa ( &fcoe->node_wwn.fc ) ); in fcoe_probe()
1149 DBGC ( fcoe, " port %s\n", fc_ntoa ( &fcoe->port_wwn.fc ) ); in fcoe_probe()
1152 list_add ( &fcoe->list, &fcoe_ports ); in fcoe_probe()
1155 netdev_put ( fcoe->netdev ); in fcoe_probe()
1167 struct fcoe_port *fcoe; in fcoe_notify() local
1170 if ( ( fcoe = fcoe_demux ( netdev ) ) == NULL ) { in fcoe_notify()
1179 ( fcoe->flags & FCOE_HAVE_NETWORK ) ) ) { in fcoe_notify()
1180 fcoe_reset ( fcoe ); in fcoe_notify()
1190 struct fcoe_port *fcoe; in fcoe_remove() local
1193 if ( ( fcoe = fcoe_demux ( netdev ) ) == NULL ) { in fcoe_remove()
1200 fcoe_close ( fcoe, 0 ); in fcoe_remove()