diff options
| author | Robert Love <robert.w.love@intel.com> | 2009-11-03 14:47:45 -0500 |
|---|---|---|
| committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:01:07 -0500 |
| commit | 70b51aabf3b03fbf8d61c14847ccce4c69fb0cdd (patch) | |
| tree | fbb86fc791fccbfdcd931ec37409d8da2c88c81c | |
| parent | 3a3b42bf89a9b90ae9ed2c57fdc378e5473a0ef9 (diff) | |
[SCSI] libfcoe: formatting and comment cleanups
Ensures that there are kernel-doc style comments for all
routines and structures.
There were also a few instances of fc_lport's named 'lp'
which were switched to 'lport' as per the libfc/libfcoe/fcoe
naming convention.
Also, emacs 'indent-region' and 'tabify' were ran on libfcoe.c.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
| -rw-r--r-- | drivers/scsi/fcoe/libfcoe.c | 216 | ||||
| -rw-r--r-- | include/scsi/libfcoe.h | 84 |
2 files changed, 153 insertions, 147 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index 6a93ba96569f..6b07a8400889 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c | |||
| @@ -59,15 +59,15 @@ unsigned int libfcoe_debug_logging; | |||
| 59 | module_param_named(debug_logging, libfcoe_debug_logging, int, S_IRUGO|S_IWUSR); | 59 | module_param_named(debug_logging, libfcoe_debug_logging, int, S_IRUGO|S_IWUSR); |
| 60 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); | 60 | MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); |
| 61 | 61 | ||
| 62 | #define LIBFCOE_LOGGING 0x01 /* General logging, not categorized */ | 62 | #define LIBFCOE_LOGGING 0x01 /* General logging, not categorized */ |
| 63 | #define LIBFCOE_FIP_LOGGING 0x02 /* FIP logging */ | 63 | #define LIBFCOE_FIP_LOGGING 0x02 /* FIP logging */ |
| 64 | 64 | ||
| 65 | #define LIBFCOE_CHECK_LOGGING(LEVEL, CMD) \ | 65 | #define LIBFCOE_CHECK_LOGGING(LEVEL, CMD) \ |
| 66 | do { \ | 66 | do { \ |
| 67 | if (unlikely(libfcoe_debug_logging & LEVEL)) \ | 67 | if (unlikely(libfcoe_debug_logging & LEVEL)) \ |
| 68 | do { \ | 68 | do { \ |
| 69 | CMD; \ | 69 | CMD; \ |
| 70 | } while (0); \ | 70 | } while (0); \ |
| 71 | } while (0) | 71 | } while (0) |
| 72 | 72 | ||
| 73 | #define LIBFCOE_DBG(fmt, args...) \ | 73 | #define LIBFCOE_DBG(fmt, args...) \ |
| @@ -78,7 +78,10 @@ do { \ | |||
| 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 "fip: " fmt, ##args);) |
| 80 | 80 | ||
| 81 | /* | 81 | /** |
| 82 | * fcoe_ctlr_mtu_valid() - Check if a FCF's MTU is valid | ||
| 83 | * @fcf: The FCF to check | ||
| 84 | * | ||
| 82 | * Return non-zero if FCF fcoe_size has been validated. | 85 | * Return non-zero if FCF fcoe_size has been validated. |
| 83 | */ | 86 | */ |
| 84 | static inline int fcoe_ctlr_mtu_valid(const struct fcoe_fcf *fcf) | 87 | static inline int fcoe_ctlr_mtu_valid(const struct fcoe_fcf *fcf) |
| @@ -86,7 +89,10 @@ static inline int fcoe_ctlr_mtu_valid(const struct fcoe_fcf *fcf) | |||
| 86 | return (fcf->flags & FIP_FL_SOL) != 0; | 89 | return (fcf->flags & FIP_FL_SOL) != 0; |
| 87 | } | 90 | } |
| 88 | 91 | ||
| 89 | /* | 92 | /** |
| 93 | * fcoe_ctlr_fcf_usable() - Check if a FCF is usable | ||
| 94 | * @fcf: The FCF to check | ||
| 95 | * | ||
| 90 | * Return non-zero if the FCF is usable. | 96 | * Return non-zero if the FCF is usable. |
| 91 | */ | 97 | */ |
| 92 | static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf) | 98 | static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf) |
| @@ -97,8 +103,8 @@ static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf) | |||
| 97 | } | 103 | } |
| 98 | 104 | ||
| 99 | /** | 105 | /** |
| 100 | * fcoe_ctlr_init() - Initialize the FCoE Controller instance. | 106 | * fcoe_ctlr_init() - Initialize the FCoE Controller instance |
| 101 | * @fip: FCoE controller. | 107 | * @fip: The FCoE controller to initialize |
| 102 | */ | 108 | */ |
| 103 | void fcoe_ctlr_init(struct fcoe_ctlr *fip) | 109 | void fcoe_ctlr_init(struct fcoe_ctlr *fip) |
| 104 | { | 110 | { |
| @@ -114,8 +120,8 @@ void fcoe_ctlr_init(struct fcoe_ctlr *fip) | |||
| 114 | EXPORT_SYMBOL(fcoe_ctlr_init); | 120 | EXPORT_SYMBOL(fcoe_ctlr_init); |
| 115 | 121 | ||
| 116 | /** | 122 | /** |
| 117 | * fcoe_ctlr_reset_fcfs() - Reset and free all FCFs for a controller. | 123 | * fcoe_ctlr_reset_fcfs() - Reset and free all FCFs for a controller |
| 118 | * @fip: FCoE controller. | 124 | * @fip: The FCoE controller whose FCFs are to be reset |
| 119 | * | 125 | * |
| 120 | * Called with &fcoe_ctlr lock held. | 126 | * Called with &fcoe_ctlr lock held. |
| 121 | */ | 127 | */ |
| @@ -134,8 +140,8 @@ static void fcoe_ctlr_reset_fcfs(struct fcoe_ctlr *fip) | |||
| 134 | } | 140 | } |
| 135 | 141 | ||
| 136 | /** | 142 | /** |
| 137 | * fcoe_ctlr_destroy() - Disable and tear-down the FCoE controller. | 143 | * fcoe_ctlr_destroy() - Disable and tear down a FCoE controller |
| 138 | * @fip: FCoE controller. | 144 | * @fip: The FCoE controller to tear down |
| 139 | * | 145 | * |
| 140 | * This is called by FCoE drivers before freeing the &fcoe_ctlr. | 146 | * This is called by FCoE drivers before freeing the &fcoe_ctlr. |
| 141 | * | 147 | * |
| @@ -162,8 +168,8 @@ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip) | |||
| 162 | EXPORT_SYMBOL(fcoe_ctlr_destroy); | 168 | EXPORT_SYMBOL(fcoe_ctlr_destroy); |
| 163 | 169 | ||
| 164 | /** | 170 | /** |
| 165 | * fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port. | 171 | * fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port |
| 166 | * @fip: FCoE controller. | 172 | * @fip: The FCoE controller to get the maximum FCoE size from |
| 167 | * | 173 | * |
| 168 | * Returns the maximum packet size including the FCoE header and trailer, | 174 | * Returns the maximum packet size including the FCoE header and trailer, |
| 169 | * but not including any Ethernet or VLAN headers. | 175 | * but not including any Ethernet or VLAN headers. |
| @@ -180,9 +186,9 @@ static inline u32 fcoe_ctlr_fcoe_size(struct fcoe_ctlr *fip) | |||
| 180 | } | 186 | } |
| 181 | 187 | ||
| 182 | /** | 188 | /** |
| 183 | * fcoe_ctlr_solicit() - Send a solicitation. | 189 | * fcoe_ctlr_solicit() - Send a FIP solicitation |
| 184 | * @fip: FCoE controller. | 190 | * @fip: The FCoE controller to send the solicitation on |
| 185 | * @fcf: Destination FCF. If NULL, a multicast solicitation is sent. | 191 | * @fcf: The destination FCF (if NULL, a multicast solicitation is sent) |
| 186 | */ | 192 | */ |
| 187 | static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) | 193 | static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) |
| 188 | { | 194 | { |
| @@ -241,8 +247,8 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) | |||
| 241 | } | 247 | } |
| 242 | 248 | ||
| 243 | /** | 249 | /** |
| 244 | * fcoe_ctlr_link_up() - Start FCoE controller. | 250 | * fcoe_ctlr_link_up() - Start FCoE controller |
| 245 | * @fip: FCoE controller. | 251 | * @fip: The FCoE controller to start |
| 246 | * | 252 | * |
| 247 | * Called from the LLD when the network link is ready. | 253 | * Called from the LLD when the network link is ready. |
| 248 | */ | 254 | */ |
| @@ -268,15 +274,15 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip) | |||
| 268 | EXPORT_SYMBOL(fcoe_ctlr_link_up); | 274 | EXPORT_SYMBOL(fcoe_ctlr_link_up); |
| 269 | 275 | ||
| 270 | /** | 276 | /** |
| 271 | * fcoe_ctlr_reset() - Reset FIP. | 277 | * fcoe_ctlr_reset() - Reset a FCoE controller |
| 272 | * @fip: FCoE controller. | 278 | * @fip: The FCoE controller to reset |
| 273 | * @new_state: FIP state to be entered. | 279 | * @new_state: The FIP state to be entered |
| 274 | * | 280 | * |
| 275 | * Returns non-zero if the link was up and now isn't. | 281 | * Returns non-zero if the link was up and now isn't. |
| 276 | */ | 282 | */ |
| 277 | static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state) | 283 | static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state) |
| 278 | { | 284 | { |
| 279 | struct fc_lport *lp = fip->lp; | 285 | struct fc_lport *lport = fip->lp; |
| 280 | int link_dropped; | 286 | int link_dropped; |
| 281 | 287 | ||
| 282 | spin_lock_bh(&fip->lock); | 288 | spin_lock_bh(&fip->lock); |
| @@ -294,19 +300,19 @@ static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state) | |||
| 294 | spin_unlock_bh(&fip->lock); | 300 | spin_unlock_bh(&fip->lock); |
| 295 | 301 | ||
| 296 | if (link_dropped) | 302 | if (link_dropped) |
| 297 | fc_linkdown(lp); | 303 | fc_linkdown(lport); |
| 298 | 304 | ||
| 299 | if (new_state == FIP_ST_ENABLED) { | 305 | if (new_state == FIP_ST_ENABLED) { |
| 300 | fcoe_ctlr_solicit(fip, NULL); | 306 | fcoe_ctlr_solicit(fip, NULL); |
| 301 | fc_linkup(lp); | 307 | fc_linkup(lport); |
| 302 | link_dropped = 0; | 308 | link_dropped = 0; |
| 303 | } | 309 | } |
| 304 | return link_dropped; | 310 | return link_dropped; |
| 305 | } | 311 | } |
| 306 | 312 | ||
| 307 | /** | 313 | /** |
| 308 | * fcoe_ctlr_link_down() - Stop FCoE controller. | 314 | * fcoe_ctlr_link_down() - Stop a FCoE controller |
| 309 | * @fip: FCoE controller. | 315 | * @fip: The FCoE controller to be stopped |
| 310 | * | 316 | * |
| 311 | * Returns non-zero if the link was up and now isn't. | 317 | * Returns non-zero if the link was up and now isn't. |
| 312 | * | 318 | * |
| @@ -320,11 +326,11 @@ int fcoe_ctlr_link_down(struct fcoe_ctlr *fip) | |||
| 320 | EXPORT_SYMBOL(fcoe_ctlr_link_down); | 326 | EXPORT_SYMBOL(fcoe_ctlr_link_down); |
| 321 | 327 | ||
| 322 | /** | 328 | /** |
| 323 | * fcoe_ctlr_send_keep_alive() - Send a keep-alive to the selected FCF. | 329 | * fcoe_ctlr_send_keep_alive() - Send a keep-alive to the selected FCF |
| 324 | * @fip: FCoE controller. | 330 | * @fip: The FCoE controller to send the FKA on |
| 325 | * @lport: libfc fc_lport to send from | 331 | * @lport: libfc fc_lport to send from |
| 326 | * @ports: 0 for controller keep-alive, 1 for port keep-alive. | 332 | * @ports: 0 for controller keep-alive, 1 for port keep-alive |
| 327 | * @sa: source MAC address. | 333 | * @sa: The source MAC address |
| 328 | * | 334 | * |
| 329 | * A controller keep-alive is sent every fka_period (typically 8 seconds). | 335 | * A controller keep-alive is sent every fka_period (typically 8 seconds). |
| 330 | * The source MAC is the native MAC address. | 336 | * The source MAC is the native MAC address. |
| @@ -369,7 +375,7 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, | |||
| 369 | kal->fip.fip_op = htons(FIP_OP_CTRL); | 375 | kal->fip.fip_op = htons(FIP_OP_CTRL); |
| 370 | kal->fip.fip_subcode = FIP_SC_KEEP_ALIVE; | 376 | kal->fip.fip_subcode = FIP_SC_KEEP_ALIVE; |
| 371 | kal->fip.fip_dl_len = htons((sizeof(kal->mac) + | 377 | kal->fip.fip_dl_len = htons((sizeof(kal->mac) + |
| 372 | ports * sizeof(*vn)) / FIP_BPW); | 378 | ports * sizeof(*vn)) / FIP_BPW); |
| 373 | kal->fip.fip_flags = htons(FIP_FL_FPMA); | 379 | kal->fip.fip_flags = htons(FIP_FL_FPMA); |
| 374 | if (fip->spma) | 380 | if (fip->spma) |
| 375 | kal->fip.fip_flags |= htons(FIP_FL_SPMA); | 381 | kal->fip.fip_flags |= htons(FIP_FL_SPMA); |
| @@ -393,11 +399,10 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, | |||
| 393 | } | 399 | } |
| 394 | 400 | ||
| 395 | /** | 401 | /** |
| 396 | * fcoe_ctlr_encaps() - Encapsulate an ELS frame for FIP, without sending it. | 402 | * fcoe_ctlr_encaps() - Encapsulate an ELS frame for FIP, without sending it |
| 397 | * @fip: FCoE controller. | 403 | * @fip: The FCoE controller for the ELS frame |
| 398 | * @lport: libfc fc_lport to use for the source address | 404 | * @dtype: The FIP descriptor type for the frame |
| 399 | * @dtype: FIP descriptor type for the frame. | 405 | * @skb: The FCoE ELS frame including FC header but no FCoE headers |
| 400 | * @skb: FCoE ELS frame including FC header but no FCoE headers. | ||
| 401 | * | 406 | * |
| 402 | * Returns non-zero error code on failure. | 407 | * Returns non-zero error code on failure. |
| 403 | * | 408 | * |
| @@ -553,9 +558,9 @@ drop: | |||
| 553 | } | 558 | } |
| 554 | EXPORT_SYMBOL(fcoe_ctlr_els_send); | 559 | EXPORT_SYMBOL(fcoe_ctlr_els_send); |
| 555 | 560 | ||
| 556 | /* | 561 | /** |
| 557 | * fcoe_ctlr_age_fcfs() - Reset and free all old FCFs for a controller. | 562 | * fcoe_ctlr_age_fcfs() - Reset and free all old FCFs for a controller |
| 558 | * @fip: FCoE controller. | 563 | * @fip: The FCoE controller to free FCFs on |
| 559 | * | 564 | * |
| 560 | * Called with lock held. | 565 | * Called with lock held. |
| 561 | * | 566 | * |
| @@ -596,9 +601,9 @@ static void fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) | |||
| 596 | } | 601 | } |
| 597 | 602 | ||
| 598 | /** | 603 | /** |
| 599 | * fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry. | 604 | * fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry |
| 600 | * @skb: received FIP advertisement frame | 605 | * @skb: The received FIP advertisement frame |
| 601 | * @fcf: resulting FCF entry. | 606 | * @fcf: The resulting FCF entry |
| 602 | * | 607 | * |
| 603 | * Returns zero on a valid parsed advertisement, | 608 | * Returns zero on a valid parsed advertisement, |
| 604 | * otherwise returns non zero value. | 609 | * otherwise returns non zero value. |
| @@ -699,9 +704,9 @@ len_err: | |||
| 699 | } | 704 | } |
| 700 | 705 | ||
| 701 | /** | 706 | /** |
| 702 | * fcoe_ctlr_recv_adv() - Handle an incoming advertisement. | 707 | * fcoe_ctlr_recv_adv() - Handle an incoming advertisement |
| 703 | * @fip: FCoE controller. | 708 | * @fip: The FCoE controller receiving the advertisement |
| 704 | * @skb: Received FIP packet. | 709 | * @skb: The received FIP packet |
| 705 | */ | 710 | */ |
| 706 | static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) | 711 | static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) |
| 707 | { | 712 | { |
| @@ -784,7 +789,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
| 784 | */ | 789 | */ |
| 785 | if (mtu_valid && !fip->sel_time && fcoe_ctlr_fcf_usable(fcf)) { | 790 | if (mtu_valid && !fip->sel_time && fcoe_ctlr_fcf_usable(fcf)) { |
| 786 | fip->sel_time = jiffies + | 791 | fip->sel_time = jiffies + |
| 787 | msecs_to_jiffies(FCOE_CTLR_START_DELAY); | 792 | msecs_to_jiffies(FCOE_CTLR_START_DELAY); |
| 788 | if (!timer_pending(&fip->timer) || | 793 | if (!timer_pending(&fip->timer) || |
| 789 | time_before(fip->sel_time, fip->timer.expires)) | 794 | time_before(fip->sel_time, fip->timer.expires)) |
| 790 | mod_timer(&fip->timer, fip->sel_time); | 795 | mod_timer(&fip->timer, fip->sel_time); |
| @@ -794,13 +799,13 @@ out: | |||
| 794 | } | 799 | } |
| 795 | 800 | ||
| 796 | /** | 801 | /** |
| 797 | * fcoe_ctlr_recv_els() - Handle an incoming FIP-encapsulated ELS frame. | 802 | * fcoe_ctlr_recv_els() - Handle an incoming FIP encapsulated ELS frame |
| 798 | * @fip: FCoE controller. | 803 | * @fip: The FCoE controller which received the packet |
| 799 | * @skb: Received FIP packet. | 804 | * @skb: The received FIP packet |
| 800 | */ | 805 | */ |
| 801 | static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) | 806 | static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) |
| 802 | { | 807 | { |
| 803 | struct fc_lport *lp = fip->lp; | 808 | struct fc_lport *lport = fip->lp; |
| 804 | struct fip_header *fiph; | 809 | struct fip_header *fiph; |
| 805 | struct fc_frame *fp = (struct fc_frame *)skb; | 810 | struct fc_frame *fp = (struct fc_frame *)skb; |
| 806 | struct fc_frame_header *fh = NULL; | 811 | struct fc_frame_header *fh = NULL; |
| @@ -886,13 +891,13 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
| 886 | fc_frame_init(fp); | 891 | fc_frame_init(fp); |
| 887 | fr_sof(fp) = FC_SOF_I3; | 892 | fr_sof(fp) = FC_SOF_I3; |
| 888 | fr_eof(fp) = FC_EOF_T; | 893 | fr_eof(fp) = FC_EOF_T; |
| 889 | fr_dev(fp) = lp; | 894 | fr_dev(fp) = lport; |
| 890 | 895 | ||
| 891 | stats = fc_lport_get_stats(lp); | 896 | stats = fc_lport_get_stats(lport); |
| 892 | stats->RxFrames++; | 897 | stats->RxFrames++; |
| 893 | stats->RxWords += skb->len / FIP_BPW; | 898 | stats->RxWords += skb->len / FIP_BPW; |
| 894 | 899 | ||
| 895 | fc_exch_recv(lp, fp); | 900 | fc_exch_recv(lport, fp); |
| 896 | return; | 901 | return; |
| 897 | 902 | ||
| 898 | len_err: | 903 | len_err: |
| @@ -903,15 +908,15 @@ drop: | |||
| 903 | } | 908 | } |
| 904 | 909 | ||
| 905 | /** | 910 | /** |
| 906 | * fcoe_ctlr_recv_els() - Handle an incoming link reset frame. | 911 | * fcoe_ctlr_recv_els() - Handle an incoming link reset frame |
| 907 | * @fip: FCoE controller. | 912 | * @fip: The FCoE controller that received the frame |
| 908 | * @fh: Received FIP header. | 913 | * @fh: The received FIP header |
| 909 | * | 914 | * |
| 910 | * There may be multiple VN_Port descriptors. | 915 | * There may be multiple VN_Port descriptors. |
| 911 | * The overall length has already been checked. | 916 | * The overall length has already been checked. |
| 912 | */ | 917 | */ |
| 913 | static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | 918 | static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, |
| 914 | struct fip_header *fh) | 919 | struct fip_header *fh) |
| 915 | { | 920 | { |
| 916 | struct fip_desc *desc; | 921 | struct fip_desc *desc; |
| 917 | struct fip_mac_desc *mp; | 922 | struct fip_mac_desc *mp; |
| @@ -920,13 +925,13 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | |||
| 920 | size_t rlen; | 925 | size_t rlen; |
| 921 | size_t dlen; | 926 | size_t dlen; |
| 922 | struct fcoe_fcf *fcf = fip->sel_fcf; | 927 | struct fcoe_fcf *fcf = fip->sel_fcf; |
| 923 | struct fc_lport *lp = fip->lp; | 928 | struct fc_lport *lport = fip->lp; |
| 924 | u32 desc_mask; | 929 | u32 desc_mask; |
| 925 | 930 | ||
| 926 | LIBFCOE_FIP_DBG("Clear Virtual Link received\n"); | 931 | LIBFCOE_FIP_DBG("Clear Virtual Link received\n"); |
| 927 | if (!fcf) | 932 | if (!fcf) |
| 928 | return; | 933 | return; |
| 929 | if (!fcf || !fc_host_port_id(lp->host)) | 934 | if (!fcf || !fc_host_port_id(lport->host)) |
| 930 | return; | 935 | return; |
| 931 | 936 | ||
| 932 | /* | 937 | /* |
| @@ -962,9 +967,10 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | |||
| 962 | if (dlen < sizeof(*vp)) | 967 | if (dlen < sizeof(*vp)) |
| 963 | return; | 968 | return; |
| 964 | if (compare_ether_addr(vp->fd_mac, | 969 | if (compare_ether_addr(vp->fd_mac, |
| 965 | fip->get_src_addr(lp)) == 0 && | 970 | fip->get_src_addr(lport)) == 0 && |
| 966 | get_unaligned_be64(&vp->fd_wwpn) == lp->wwpn && | 971 | get_unaligned_be64(&vp->fd_wwpn) == lport->wwpn && |
| 967 | ntoh24(vp->fd_fc_id) == fc_host_port_id(lp->host)) | 972 | ntoh24(vp->fd_fc_id) == |
| 973 | fc_host_port_id(lport->host)) | ||
| 968 | desc_mask &= ~BIT(FIP_DT_VN_ID); | 974 | desc_mask &= ~BIT(FIP_DT_VN_ID); |
| 969 | break; | 975 | break; |
| 970 | default: | 976 | default: |
| @@ -989,9 +995,9 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, | |||
| 989 | } | 995 | } |
| 990 | 996 | ||
| 991 | /** | 997 | /** |
| 992 | * fcoe_ctlr_recv() - Receive a FIP frame. | 998 | * fcoe_ctlr_recv() - Receive a FIP packet |
| 993 | * @fip: FCoE controller. | 999 | * @fip: The FCoE controller that received the packet |
| 994 | * @skb: Received FIP packet. | 1000 | * @skb: The received FIP packet |
| 995 | * | 1001 | * |
| 996 | * This is called from NET_RX_SOFTIRQ. | 1002 | * This is called from NET_RX_SOFTIRQ. |
| 997 | */ | 1003 | */ |
| @@ -1005,9 +1011,9 @@ void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
| 1005 | EXPORT_SYMBOL(fcoe_ctlr_recv); | 1011 | EXPORT_SYMBOL(fcoe_ctlr_recv); |
| 1006 | 1012 | ||
| 1007 | /** | 1013 | /** |
| 1008 | * fcoe_ctlr_recv_handler() - Receive a FIP frame. | 1014 | * fcoe_ctlr_recv_handler() - Receive a FIP frame |
| 1009 | * @fip: FCoE controller. | 1015 | * @fip: The FCoE controller that received the frame |
| 1010 | * @skb: Received FIP packet. | 1016 | * @skb: The received FIP frame |
| 1011 | * | 1017 | * |
| 1012 | * Returns non-zero if the frame is dropped. | 1018 | * Returns non-zero if the frame is dropped. |
| 1013 | */ | 1019 | */ |
| @@ -1064,8 +1070,8 @@ drop: | |||
| 1064 | } | 1070 | } |
| 1065 | 1071 | ||
| 1066 | /** | 1072 | /** |
| 1067 | * fcoe_ctlr_select() - Select the best FCF, if possible. | 1073 | * fcoe_ctlr_select() - Select the best FCF (if possible) |
| 1068 | * @fip: FCoE controller. | 1074 | * @fip: The FCoE controller |
| 1069 | * | 1075 | * |
| 1070 | * If there are conflicting advertisements, no FCF can be chosen. | 1076 | * If there are conflicting advertisements, no FCF can be chosen. |
| 1071 | * | 1077 | * |
| @@ -1106,8 +1112,8 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
| 1106 | } | 1112 | } |
| 1107 | 1113 | ||
| 1108 | /** | 1114 | /** |
| 1109 | * fcoe_ctlr_timeout() - FIP timer function. | 1115 | * fcoe_ctlr_timeout() - FIP timeout handler |
| 1110 | * @arg: &fcoe_ctlr pointer. | 1116 | * @arg: The FCoE controller that timed out |
| 1111 | * | 1117 | * |
| 1112 | * Ages FCFs. Triggers FCF selection if possible. Sends keep-alives. | 1118 | * Ages FCFs. Triggers FCF selection if possible. Sends keep-alives. |
| 1113 | */ | 1119 | */ |
| @@ -1142,12 +1148,12 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
| 1142 | fip->lp->host->host_no, sel->fcf_mac); | 1148 | fip->lp->host->host_no, sel->fcf_mac); |
| 1143 | memcpy(fip->dest_addr, sel->fcf_mac, ETH_ALEN); | 1149 | memcpy(fip->dest_addr, sel->fcf_mac, ETH_ALEN); |
| 1144 | fip->port_ka_time = jiffies + | 1150 | fip->port_ka_time = jiffies + |
| 1145 | msecs_to_jiffies(FIP_VN_KA_PERIOD); | 1151 | msecs_to_jiffies(FIP_VN_KA_PERIOD); |
| 1146 | fip->ctlr_ka_time = jiffies + sel->fka_period; | 1152 | fip->ctlr_ka_time = jiffies + sel->fka_period; |
| 1147 | fip->link = 1; | 1153 | fip->link = 1; |
| 1148 | } else { | 1154 | } else { |
| 1149 | printk(KERN_NOTICE "libfcoe: host%d: " | 1155 | printk(KERN_NOTICE "libfcoe: host%d: " |
| 1150 | "FIP Fibre-Channel Forwarder timed out. " | 1156 | "FIP Fibre-Channel Forwarder timed out. " |
| 1151 | "Starting FCF discovery.\n", | 1157 | "Starting FCF discovery.\n", |
| 1152 | fip->lp->host->host_no); | 1158 | fip->lp->host->host_no); |
| 1153 | fip->link = 0; | 1159 | fip->link = 0; |
| @@ -1165,7 +1171,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
| 1165 | 1171 | ||
| 1166 | if (time_after_eq(jiffies, fip->port_ka_time)) { | 1172 | if (time_after_eq(jiffies, fip->port_ka_time)) { |
| 1167 | fip->port_ka_time += jiffies + | 1173 | fip->port_ka_time += jiffies + |
| 1168 | msecs_to_jiffies(FIP_VN_KA_PERIOD); | 1174 | msecs_to_jiffies(FIP_VN_KA_PERIOD); |
| 1169 | fip->send_port_ka = 1; | 1175 | fip->send_port_ka = 1; |
| 1170 | } | 1176 | } |
| 1171 | if (time_after(next_timer, fip->port_ka_time)) | 1177 | if (time_after(next_timer, fip->port_ka_time)) |
| @@ -1173,7 +1179,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
| 1173 | mod_timer(&fip->timer, next_timer); | 1179 | mod_timer(&fip->timer, next_timer); |
| 1174 | } else if (fip->sel_time) { | 1180 | } else if (fip->sel_time) { |
| 1175 | next_timer = fip->sel_time + | 1181 | next_timer = fip->sel_time + |
| 1176 | msecs_to_jiffies(FCOE_CTLR_START_DELAY); | 1182 | msecs_to_jiffies(FCOE_CTLR_START_DELAY); |
| 1177 | mod_timer(&fip->timer, next_timer); | 1183 | mod_timer(&fip->timer, next_timer); |
| 1178 | } | 1184 | } |
| 1179 | if (fip->send_ctlr_ka || fip->send_port_ka) | 1185 | if (fip->send_ctlr_ka || fip->send_port_ka) |
| @@ -1182,8 +1188,8 @@ static void fcoe_ctlr_timeout(unsigned long arg) | |||
| 1182 | } | 1188 | } |
| 1183 | 1189 | ||
| 1184 | /** | 1190 | /** |
| 1185 | * fcoe_ctlr_link_work() - worker thread function for link changes. | 1191 | * fcoe_ctlr_link_work() - Worker thread function for link changes |
| 1186 | * @work: pointer to link_work member inside &fcoe_ctlr. | 1192 | * @work: Handle to a FCoE controller |
| 1187 | * | 1193 | * |
| 1188 | * See if the link status has changed and if so, report it. | 1194 | * See if the link status has changed and if so, report it. |
| 1189 | * | 1195 | * |
| @@ -1230,8 +1236,8 @@ static void fcoe_ctlr_link_work(struct work_struct *work) | |||
| 1230 | } | 1236 | } |
| 1231 | 1237 | ||
| 1232 | /** | 1238 | /** |
| 1233 | * fcoe_ctlr_recv_work() - Worker thread function for receiving FIP frames. | 1239 | * fcoe_ctlr_recv_work() - Worker thread function for receiving FIP frames |
| 1234 | * @recv_work: pointer to recv_work member inside &fcoe_ctlr. | 1240 | * @recv_work: Handle to a FCoE controller |
| 1235 | */ | 1241 | */ |
| 1236 | static void fcoe_ctlr_recv_work(struct work_struct *recv_work) | 1242 | static void fcoe_ctlr_recv_work(struct work_struct *recv_work) |
| 1237 | { | 1243 | { |
| @@ -1249,11 +1255,10 @@ static void fcoe_ctlr_recv_work(struct work_struct *recv_work) | |||
| 1249 | } | 1255 | } |
| 1250 | 1256 | ||
| 1251 | /** | 1257 | /** |
| 1252 | * fcoe_ctlr_recv_flogi() - snoop Pre-FIP receipt of FLOGI response or request. | 1258 | * fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response or request |
| 1253 | * @fip: FCoE controller. | 1259 | * @fip: The FCoE controller |
| 1254 | * @lport: libfc fc_lport instance received on | 1260 | * @fp: The FC frame to snoop |
| 1255 | * @fp: FC frame. | 1261 | * @sa: Ethernet source MAC address from received FCoE frame |
| 1256 | * @sa: Ethernet source MAC address from received FCoE frame. | ||
| 1257 | * | 1262 | * |
| 1258 | * Snoop potential response to FLOGI or even incoming FLOGI. | 1263 | * Snoop potential response to FLOGI or even incoming FLOGI. |
| 1259 | * | 1264 | * |
| @@ -1323,10 +1328,10 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
| 1323 | EXPORT_SYMBOL(fcoe_ctlr_recv_flogi); | 1328 | EXPORT_SYMBOL(fcoe_ctlr_recv_flogi); |
| 1324 | 1329 | ||
| 1325 | /** | 1330 | /** |
| 1326 | * fcoe_wwn_from_mac() - Converts 48-bit IEEE MAC address to 64-bit FC WWN. | 1331 | * fcoe_wwn_from_mac() - Converts a 48-bit IEEE MAC address to a 64-bit FC WWN |
| 1327 | * @mac: mac address | 1332 | * @mac: The MAC address to convert |
| 1328 | * @scheme: check port | 1333 | * @scheme: The scheme to use when converting |
| 1329 | * @port: port indicator for converting | 1334 | * @port: The port indicator for converting |
| 1330 | * | 1335 | * |
| 1331 | * Returns: u64 fc world wide name | 1336 | * Returns: u64 fc world wide name |
| 1332 | */ | 1337 | */ |
| @@ -1364,23 +1369,24 @@ u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], | |||
| 1364 | EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); | 1369 | EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); |
| 1365 | 1370 | ||
| 1366 | /** | 1371 | /** |
| 1367 | * fcoe_libfc_config() - sets up libfc related properties for lport | 1372 | * fcoe_libfc_config() - Sets up libfc related properties for local port |
| 1368 | * @lp: ptr to the fc_lport | 1373 | * @lp: The local port to configure libfc for |
| 1369 | * @tt: libfc function template | 1374 | * @tt: The libfc function template |
| 1370 | * | 1375 | * |
| 1371 | * Returns : 0 for success | 1376 | * Returns : 0 for success |
| 1372 | */ | 1377 | */ |
| 1373 | int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt) | 1378 | int fcoe_libfc_config(struct fc_lport *lport, |
| 1379 | struct libfc_function_template *tt) | ||
| 1374 | { | 1380 | { |
| 1375 | /* Set the function pointers set by the LLDD */ | 1381 | /* Set the function pointers set by the LLDD */ |
| 1376 | memcpy(&lp->tt, tt, sizeof(*tt)); | 1382 | memcpy(&lport->tt, tt, sizeof(*tt)); |
| 1377 | if (fc_fcp_init(lp)) | 1383 | if (fc_fcp_init(lport)) |
| 1378 | return -ENOMEM; | 1384 | return -ENOMEM; |
| 1379 | fc_exch_init(lp); | 1385 | fc_exch_init(lport); |
| 1380 | fc_elsct_init(lp); | 1386 | fc_elsct_init(lport); |
| 1381 | fc_lport_init(lp); | 1387 | fc_lport_init(lport); |
| 1382 | fc_rport_init(lp); | 1388 | fc_rport_init(lport); |
| 1383 | fc_disc_init(lp); | 1389 | fc_disc_init(lport); |
| 1384 | 1390 | ||
| 1385 | return 0; | 1391 | return 0; |
| 1386 | } | 1392 | } |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 8ef5e209c216..76d08c9a7678 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
| @@ -53,35 +53,35 @@ enum fip_state { | |||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * struct fcoe_ctlr - FCoE Controller and FIP state. | 56 | * struct fcoe_ctlr - FCoE Controller and FIP state |
| 57 | * @state: internal FIP state for network link and FIP or non-FIP mode. | 57 | * @state: internal FIP state for network link and FIP or non-FIP mode. |
| 58 | * @lp: &fc_lport: libfc local port. | 58 | * @lp: &fc_lport: libfc local port. |
| 59 | * @sel_fcf: currently selected FCF, or NULL. | 59 | * @sel_fcf: currently selected FCF, or NULL. |
| 60 | * @fcfs: list of discovered FCFs. | 60 | * @fcfs: list of discovered FCFs. |
| 61 | * @fcf_count: number of discovered FCF entries. | 61 | * @fcf_count: number of discovered FCF entries. |
| 62 | * @sol_time: time when a multicast solicitation was last sent. | 62 | * @sol_time: time when a multicast solicitation was last sent. |
| 63 | * @sel_time: time after which to select an FCF. | 63 | * @sel_time: time after which to select an FCF. |
| 64 | * @port_ka_time: time of next port keep-alive. | 64 | * @port_ka_time: time of next port keep-alive. |
| 65 | * @ctlr_ka_time: time of next controller keep-alive. | 65 | * @ctlr_ka_time: time of next controller keep-alive. |
| 66 | * @timer: timer struct used for all delayed events. | 66 | * @timer: timer struct used for all delayed events. |
| 67 | * @link_work: &work_struct for doing FCF selection. | 67 | * @link_work: &work_struct for doing FCF selection. |
| 68 | * @recv_work: &work_struct for receiving FIP frames. | 68 | * @recv_work: &work_struct for receiving FIP frames. |
| 69 | * @fip_recv_list: list of received FIP frames. | 69 | * @fip_recv_list: list of received FIP frames. |
| 70 | * @user_mfs: configured maximum FC frame size, including FC header. | 70 | * @user_mfs: configured maximum FC frame size, including FC header. |
| 71 | * @flogi_oxid: exchange ID of most recent fabric login. | 71 | * @flogi_oxid: exchange ID of most recent fabric login. |
| 72 | * @flogi_count: number of FLOGI attempts in AUTO mode. | 72 | * @flogi_count: number of FLOGI attempts in AUTO mode. |
| 73 | * @link: current link status for libfc. | 73 | * @link: current link status for libfc. |
| 74 | * @last_link: last link state reported to libfc. | 74 | * @last_link: last link state reported to libfc. |
| 75 | * @map_dest: use the FC_MAP mode for destination MAC addresses. | 75 | * @map_dest: use the FC_MAP mode for destination MAC addresses. |
| 76 | * @spma: supports SPMA server-provided MACs mode | 76 | * @spma: supports SPMA server-provided MACs mode |
| 77 | * @send_ctlr_ka: need to send controller keep alive | 77 | * @send_ctlr_ka: need to send controller keep alive |
| 78 | * @send_port_ka: need to send port keep alives | 78 | * @send_port_ka: need to send port keep alives |
| 79 | * @dest_addr: MAC address of the selected FC forwarder. | 79 | * @dest_addr: MAC address of the selected FC forwarder. |
| 80 | * @ctl_src_addr: the native MAC address of our local port. | 80 | * @ctl_src_addr: the native MAC address of our local port. |
| 81 | * @send: LLD-supplied function to handle sending of FIP Ethernet frames. | 81 | * @send: LLD-supplied function to handle sending FIP Ethernet frames |
| 82 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. | 82 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. |
| 83 | * @get_src_addr: LLD-supplied function to supply a source MAC address. | 83 | * @get_src_addr: LLD-supplied function to supply a source MAC address. |
| 84 | * @lock: lock protecting this structure. | 84 | * @lock: lock protecting this structure. |
| 85 | * | 85 | * |
| 86 | * This structure is used by all FCoE drivers. It contains information | 86 | * This structure is used by all FCoE drivers. It contains information |
| 87 | * needed by all FCoE low-level drivers (LLDs) as well as internal state | 87 | * needed by all FCoE low-level drivers (LLDs) as well as internal state |
| @@ -119,18 +119,18 @@ struct fcoe_ctlr { | |||
| 119 | spinlock_t lock; | 119 | spinlock_t lock; |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | /* | 122 | /** |
| 123 | * struct fcoe_fcf - Fibre-Channel Forwarder. | 123 | * struct fcoe_fcf - Fibre-Channel Forwarder |
| 124 | * @list: list linkage. | 124 | * @list: list linkage |
| 125 | * @time: system time (jiffies) when an advertisement was last received. | 125 | * @time: system time (jiffies) when an advertisement was last received |
| 126 | * @switch_name: WWN of switch from advertisement. | 126 | * @switch_name: WWN of switch from advertisement |
| 127 | * @fabric_name: WWN of fabric from advertisement. | 127 | * @fabric_name: WWN of fabric from advertisement |
| 128 | * @fc_map: FC_MAP value from advertisement. | 128 | * @fc_map: FC_MAP value from advertisement |
| 129 | * @fcf_mac: Ethernet address of the FCF. | 129 | * @fcf_mac: Ethernet address of the FCF |
| 130 | * @vfid: virtual fabric ID. | 130 | * @vfid: virtual fabric ID |
| 131 | * @pri: seletion priority, smaller values are better. | 131 | * @pri: selection priority, smaller values are better |
| 132 | * @flags: flags received from advertisement. | 132 | * @flags: flags received from advertisement |
| 133 | * @fka_period: keep-alive period, in jiffies. | 133 | * @fka_period: keep-alive period, in jiffies |
| 134 | * | 134 | * |
| 135 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that | 135 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that |
| 136 | * passes FCoE frames on to an FC fabric. This structure represents | 136 | * passes FCoE frames on to an FC fabric. This structure represents |
| @@ -161,8 +161,8 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *); | |||
| 161 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); | 161 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); |
| 162 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *); | 162 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *); |
| 163 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); | 163 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); |
| 164 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *lport, | 164 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *, |
| 165 | struct fc_frame *fp, u8 *sa); | 165 | struct fc_frame *, u8 *); |
| 166 | 166 | ||
| 167 | /* libfcoe funcs */ | 167 | /* libfcoe funcs */ |
| 168 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); | 168 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); |
