diff options
Diffstat (limited to 'drivers/scsi/fcoe/libfcoe.c')
-rw-r--r-- | drivers/scsi/fcoe/libfcoe.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index 1ea17a3c8749..99f583f40df3 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c | |||
@@ -74,9 +74,10 @@ do { \ | |||
74 | LIBFCOE_CHECK_LOGGING(LIBFCOE_LOGGING, \ | 74 | LIBFCOE_CHECK_LOGGING(LIBFCOE_LOGGING, \ |
75 | printk(KERN_INFO "libfcoe: " fmt, ##args);) | 75 | printk(KERN_INFO "libfcoe: " fmt, ##args);) |
76 | 76 | ||
77 | #define LIBFCOE_FIP_DBG(fmt, args...) \ | 77 | #define LIBFCOE_FIP_DBG(fip, fmt, args...) \ |
78 | LIBFCOE_CHECK_LOGGING(LIBFCOE_FIP_LOGGING, \ | 78 | LIBFCOE_CHECK_LOGGING(LIBFCOE_FIP_LOGGING, \ |
79 | printk(KERN_INFO "fip: " fmt, ##args);) | 79 | printk(KERN_INFO "host%d: fip: " fmt, \ |
80 | (fip)->lp->host->host_no, ##args);) | ||
80 | 81 | ||
81 | /** | 82 | /** |
82 | * fcoe_ctlr_mtu_valid() - Check if a FCF's MTU is valid | 83 | * fcoe_ctlr_mtu_valid() - Check if a FCF's MTU is valid |
@@ -267,7 +268,7 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip) | |||
267 | fip->link = 1; | 268 | fip->link = 1; |
268 | spin_unlock_bh(&fip->lock); | 269 | spin_unlock_bh(&fip->lock); |
269 | if (fip->state == FIP_ST_AUTO) | 270 | if (fip->state == FIP_ST_AUTO) |
270 | LIBFCOE_FIP_DBG("%s", "setting AUTO mode.\n"); | 271 | LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n"); |
271 | fc_linkup(fip->lp); | 272 | fc_linkup(fip->lp); |
272 | fcoe_ctlr_solicit(fip, NULL); | 273 | fcoe_ctlr_solicit(fip, NULL); |
273 | } else | 274 | } else |
@@ -604,13 +605,15 @@ static void fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) | |||
604 | 605 | ||
605 | /** | 606 | /** |
606 | * fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry | 607 | * fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry |
608 | * @fip: The FCoE controller receiving the advertisement | ||
607 | * @skb: The received FIP advertisement frame | 609 | * @skb: The received FIP advertisement frame |
608 | * @fcf: The resulting FCF entry | 610 | * @fcf: The resulting FCF entry |
609 | * | 611 | * |
610 | * Returns zero on a valid parsed advertisement, | 612 | * Returns zero on a valid parsed advertisement, |
611 | * otherwise returns non zero value. | 613 | * otherwise returns non zero value. |
612 | */ | 614 | */ |
613 | static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf) | 615 | static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip, |
616 | struct sk_buff *skb, struct fcoe_fcf *fcf) | ||
614 | { | 617 | { |
615 | struct fip_header *fiph; | 618 | struct fip_header *fiph; |
616 | struct fip_desc *desc = NULL; | 619 | struct fip_desc *desc = NULL; |
@@ -649,7 +652,7 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf) | |||
649 | ((struct fip_mac_desc *)desc)->fd_mac, | 652 | ((struct fip_mac_desc *)desc)->fd_mac, |
650 | ETH_ALEN); | 653 | ETH_ALEN); |
651 | if (!is_valid_ether_addr(fcf->fcf_mac)) { | 654 | if (!is_valid_ether_addr(fcf->fcf_mac)) { |
652 | LIBFCOE_FIP_DBG("Invalid MAC address " | 655 | LIBFCOE_FIP_DBG(fip, "Invalid MAC address " |
653 | "in FIP adv\n"); | 656 | "in FIP adv\n"); |
654 | return -EINVAL; | 657 | return -EINVAL; |
655 | } | 658 | } |
@@ -683,7 +686,7 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf) | |||
683 | case FIP_DT_LOGO: | 686 | case FIP_DT_LOGO: |
684 | case FIP_DT_ELP: | 687 | case FIP_DT_ELP: |
685 | default: | 688 | default: |
686 | LIBFCOE_FIP_DBG("unexpected descriptor type %x " | 689 | LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x " |
687 | "in FIP adv\n", desc->fip_dtype); | 690 | "in FIP adv\n", desc->fip_dtype); |
688 | /* standard says ignore unknown descriptors >= 128 */ | 691 | /* standard says ignore unknown descriptors >= 128 */ |
689 | if (desc->fip_dtype < FIP_DT_VENDOR_BASE) | 692 | if (desc->fip_dtype < FIP_DT_VENDOR_BASE) |
@@ -700,7 +703,7 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf) | |||
700 | return 0; | 703 | return 0; |
701 | 704 | ||
702 | len_err: | 705 | len_err: |
703 | LIBFCOE_FIP_DBG("FIP length error in descriptor type %x len %zu\n", | 706 | LIBFCOE_FIP_DBG(fip, "FIP length error in descriptor type %x len %zu\n", |
704 | desc->fip_dtype, dlen); | 707 | desc->fip_dtype, dlen); |
705 | return -EINVAL; | 708 | return -EINVAL; |
706 | } | 709 | } |
@@ -719,7 +722,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
719 | int first = 0; | 722 | int first = 0; |
720 | int mtu_valid; | 723 | int mtu_valid; |
721 | 724 | ||
722 | if (fcoe_ctlr_parse_adv(skb, &new)) | 725 | if (fcoe_ctlr_parse_adv(fip, skb, &new)) |
723 | return; | 726 | return; |
724 | 727 | ||
725 | spin_lock_bh(&fip->lock); | 728 | spin_lock_bh(&fip->lock); |
@@ -765,7 +768,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
765 | mtu_valid = fcoe_ctlr_mtu_valid(fcf); | 768 | mtu_valid = fcoe_ctlr_mtu_valid(fcf); |
766 | fcf->time = jiffies; | 769 | fcf->time = jiffies; |
767 | if (!found) { | 770 | if (!found) { |
768 | LIBFCOE_FIP_DBG("New FCF for fab %llx map %x val %d\n", | 771 | LIBFCOE_FIP_DBG(fip, "New FCF for fab %llx map %x val %d\n", |
769 | fcf->fabric_name, fcf->fc_map, mtu_valid); | 772 | fcf->fabric_name, fcf->fc_map, mtu_valid); |
770 | } | 773 | } |
771 | 774 | ||
@@ -844,7 +847,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
844 | ((struct fip_mac_desc *)desc)->fd_mac, | 847 | ((struct fip_mac_desc *)desc)->fd_mac, |
845 | ETH_ALEN); | 848 | ETH_ALEN); |
846 | if (!is_valid_ether_addr(granted_mac)) { | 849 | if (!is_valid_ether_addr(granted_mac)) { |
847 | LIBFCOE_FIP_DBG("Invalid MAC address " | 850 | LIBFCOE_FIP_DBG(fip, "Invalid MAC address " |
848 | "in FIP ELS\n"); | 851 | "in FIP ELS\n"); |
849 | goto drop; | 852 | goto drop; |
850 | } | 853 | } |
@@ -864,7 +867,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
864 | els_dtype = desc->fip_dtype; | 867 | els_dtype = desc->fip_dtype; |
865 | break; | 868 | break; |
866 | default: | 869 | default: |
867 | LIBFCOE_FIP_DBG("unexpected descriptor type %x " | 870 | LIBFCOE_FIP_DBG(fip, "unexpected descriptor type %x " |
868 | "in FIP adv\n", desc->fip_dtype); | 871 | "in FIP adv\n", desc->fip_dtype); |
869 | /* standard says ignore unknown descriptors >= 128 */ | 872 | /* standard says ignore unknown descriptors >= 128 */ |
870 | if (desc->fip_dtype < FIP_DT_VENDOR_BASE) | 873 | if (desc->fip_dtype < FIP_DT_VENDOR_BASE) |
@@ -903,7 +906,7 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
903 | return; | 906 | return; |
904 | 907 | ||
905 | len_err: | 908 | len_err: |
906 | LIBFCOE_FIP_DBG("FIP length error in descriptor type %x len %zu\n", | 909 | LIBFCOE_FIP_DBG(fip, "FIP length error in descriptor type %x len %zu\n", |
907 | desc->fip_dtype, dlen); | 910 | desc->fip_dtype, dlen); |
908 | drop: | 911 | drop: |
909 | kfree_skb(skb); | 912 | kfree_skb(skb); |
@@ -930,7 +933,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | |||
930 | struct fc_lport *lport = fip->lp; | 933 | struct fc_lport *lport = fip->lp; |
931 | u32 desc_mask; | 934 | u32 desc_mask; |
932 | 935 | ||
933 | LIBFCOE_FIP_DBG("Clear Virtual Link received\n"); | 936 | LIBFCOE_FIP_DBG(fip, "Clear Virtual Link received\n"); |
934 | if (!fcf) | 937 | if (!fcf) |
935 | return; | 938 | return; |
936 | if (!fcf || !fc_host_port_id(lport->host)) | 939 | if (!fcf || !fc_host_port_id(lport->host)) |
@@ -989,9 +992,10 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | |||
989 | * reset only if all required descriptors were present and valid. | 992 | * reset only if all required descriptors were present and valid. |
990 | */ | 993 | */ |
991 | if (desc_mask) { | 994 | if (desc_mask) { |
992 | LIBFCOE_FIP_DBG("missing descriptors mask %x\n", desc_mask); | 995 | LIBFCOE_FIP_DBG(fip, "missing descriptors mask %x\n", |
996 | desc_mask); | ||
993 | } else { | 997 | } else { |
994 | LIBFCOE_FIP_DBG("performing Clear Virtual Link\n"); | 998 | LIBFCOE_FIP_DBG(fip, "performing Clear Virtual Link\n"); |
995 | fcoe_ctlr_reset(fip, FIP_ST_ENABLED); | 999 | fcoe_ctlr_reset(fip, FIP_ST_ENABLED); |
996 | } | 1000 | } |
997 | } | 1001 | } |
@@ -1050,7 +1054,7 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
1050 | fip->map_dest = 0; | 1054 | fip->map_dest = 0; |
1051 | fip->state = FIP_ST_ENABLED; | 1055 | fip->state = FIP_ST_ENABLED; |
1052 | state = FIP_ST_ENABLED; | 1056 | state = FIP_ST_ENABLED; |
1053 | LIBFCOE_FIP_DBG("Using FIP mode\n"); | 1057 | LIBFCOE_FIP_DBG(fip, "Using FIP mode\n"); |
1054 | } | 1058 | } |
1055 | spin_unlock_bh(&fip->lock); | 1059 | spin_unlock_bh(&fip->lock); |
1056 | if (state != FIP_ST_ENABLED) | 1060 | if (state != FIP_ST_ENABLED) |
@@ -1085,11 +1089,11 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
1085 | struct fcoe_fcf *best = NULL; | 1089 | struct fcoe_fcf *best = NULL; |
1086 | 1090 | ||
1087 | list_for_each_entry(fcf, &fip->fcfs, list) { | 1091 | list_for_each_entry(fcf, &fip->fcfs, list) { |
1088 | LIBFCOE_FIP_DBG("consider FCF for fab %llx VFID %d map %x " | 1092 | LIBFCOE_FIP_DBG(fip, "consider FCF for fab %llx VFID %d map %x " |
1089 | "val %d\n", fcf->fabric_name, fcf->vfid, | 1093 | "val %d\n", fcf->fabric_name, fcf->vfid, |
1090 | fcf->fc_map, fcoe_ctlr_mtu_valid(fcf)); | 1094 | fcf->fc_map, fcoe_ctlr_mtu_valid(fcf)); |
1091 | if (!fcoe_ctlr_fcf_usable(fcf)) { | 1095 | if (!fcoe_ctlr_fcf_usable(fcf)) { |
1092 | LIBFCOE_FIP_DBG("FCF for fab %llx map %x %svalid " | 1096 | LIBFCOE_FIP_DBG(fip, "FCF for fab %llx map %x %svalid " |
1093 | "%savailable\n", fcf->fabric_name, | 1097 | "%savailable\n", fcf->fabric_name, |
1094 | fcf->fc_map, (fcf->flags & FIP_FL_SOL) | 1098 | fcf->fc_map, (fcf->flags & FIP_FL_SOL) |
1095 | ? "" : "in", (fcf->flags & FIP_FL_AVAIL) | 1099 | ? "" : "in", (fcf->flags & FIP_FL_AVAIL) |
@@ -1103,7 +1107,7 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
1103 | if (fcf->fabric_name != best->fabric_name || | 1107 | if (fcf->fabric_name != best->fabric_name || |
1104 | fcf->vfid != best->vfid || | 1108 | fcf->vfid != best->vfid || |
1105 | fcf->fc_map != best->fc_map) { | 1109 | fcf->fc_map != best->fc_map) { |
1106 | LIBFCOE_FIP_DBG("Conflicting fabric, VFID, " | 1110 | LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, " |
1107 | "or FC-MAP\n"); | 1111 | "or FC-MAP\n"); |
1108 | return; | 1112 | return; |
1109 | } | 1113 | } |
@@ -1292,7 +1296,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
1292 | return -EINVAL; | 1296 | return -EINVAL; |
1293 | } | 1297 | } |
1294 | fip->state = FIP_ST_NON_FIP; | 1298 | fip->state = FIP_ST_NON_FIP; |
1295 | LIBFCOE_FIP_DBG("received FLOGI LS_ACC using non-FIP mode\n"); | 1299 | LIBFCOE_FIP_DBG(fip, |
1300 | "received FLOGI LS_ACC using non-FIP mode\n"); | ||
1296 | 1301 | ||
1297 | /* | 1302 | /* |
1298 | * FLOGI accepted. | 1303 | * FLOGI accepted. |
@@ -1319,7 +1324,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
1319 | memcpy(fip->dest_addr, sa, ETH_ALEN); | 1324 | memcpy(fip->dest_addr, sa, ETH_ALEN); |
1320 | fip->map_dest = 0; | 1325 | fip->map_dest = 0; |
1321 | if (fip->state == FIP_ST_NON_FIP) | 1326 | if (fip->state == FIP_ST_NON_FIP) |
1322 | LIBFCOE_FIP_DBG("received FLOGI REQ, " | 1327 | LIBFCOE_FIP_DBG(fip, "received FLOGI REQ, " |
1323 | "using non-FIP mode\n"); | 1328 | "using non-FIP mode\n"); |
1324 | fip->state = FIP_ST_NON_FIP; | 1329 | fip->state = FIP_ST_NON_FIP; |
1325 | } | 1330 | } |