提交 70b51aab 编写于 作者: R Robert Love 提交者: James Bottomley

[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: NRobert Love <robert.w.love@intel.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 3a3b42bf
...@@ -59,15 +59,15 @@ unsigned int libfcoe_debug_logging; ...@@ -59,15 +59,15 @@ unsigned int libfcoe_debug_logging;
module_param_named(debug_logging, libfcoe_debug_logging, int, S_IRUGO|S_IWUSR); module_param_named(debug_logging, libfcoe_debug_logging, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
#define LIBFCOE_LOGGING 0x01 /* General logging, not categorized */ #define LIBFCOE_LOGGING 0x01 /* General logging, not categorized */
#define LIBFCOE_FIP_LOGGING 0x02 /* FIP logging */ #define LIBFCOE_FIP_LOGGING 0x02 /* FIP logging */
#define LIBFCOE_CHECK_LOGGING(LEVEL, CMD) \ #define LIBFCOE_CHECK_LOGGING(LEVEL, CMD) \
do { \ do { \
if (unlikely(libfcoe_debug_logging & LEVEL)) \ if (unlikely(libfcoe_debug_logging & LEVEL)) \
do { \ do { \
CMD; \ CMD; \
} while (0); \ } while (0); \
} while (0) } while (0)
#define LIBFCOE_DBG(fmt, args...) \ #define LIBFCOE_DBG(fmt, args...) \
...@@ -78,7 +78,10 @@ do { \ ...@@ -78,7 +78,10 @@ do { \
LIBFCOE_CHECK_LOGGING(LIBFCOE_FIP_LOGGING, \ LIBFCOE_CHECK_LOGGING(LIBFCOE_FIP_LOGGING, \
printk(KERN_INFO "fip: " fmt, ##args);) printk(KERN_INFO "fip: " fmt, ##args);)
/* /**
* fcoe_ctlr_mtu_valid() - Check if a FCF's MTU is valid
* @fcf: The FCF to check
*
* Return non-zero if FCF fcoe_size has been validated. * Return non-zero if FCF fcoe_size has been validated.
*/ */
static inline int fcoe_ctlr_mtu_valid(const struct fcoe_fcf *fcf) 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,7 +89,10 @@ static inline int fcoe_ctlr_mtu_valid(const struct fcoe_fcf *fcf)
return (fcf->flags & FIP_FL_SOL) != 0; return (fcf->flags & FIP_FL_SOL) != 0;
} }
/* /**
* fcoe_ctlr_fcf_usable() - Check if a FCF is usable
* @fcf: The FCF to check
*
* Return non-zero if the FCF is usable. * Return non-zero if the FCF is usable.
*/ */
static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf) 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,8 +103,8 @@ static inline int fcoe_ctlr_fcf_usable(struct fcoe_fcf *fcf)
} }
/** /**
* fcoe_ctlr_init() - Initialize the FCoE Controller instance. * fcoe_ctlr_init() - Initialize the FCoE Controller instance
* @fip: FCoE controller. * @fip: The FCoE controller to initialize
*/ */
void fcoe_ctlr_init(struct fcoe_ctlr *fip) void fcoe_ctlr_init(struct fcoe_ctlr *fip)
{ {
...@@ -114,8 +120,8 @@ void fcoe_ctlr_init(struct fcoe_ctlr *fip) ...@@ -114,8 +120,8 @@ void fcoe_ctlr_init(struct fcoe_ctlr *fip)
EXPORT_SYMBOL(fcoe_ctlr_init); EXPORT_SYMBOL(fcoe_ctlr_init);
/** /**
* fcoe_ctlr_reset_fcfs() - Reset and free all FCFs for a controller. * fcoe_ctlr_reset_fcfs() - Reset and free all FCFs for a controller
* @fip: FCoE controller. * @fip: The FCoE controller whose FCFs are to be reset
* *
* Called with &fcoe_ctlr lock held. * Called with &fcoe_ctlr lock held.
*/ */
...@@ -134,8 +140,8 @@ static void fcoe_ctlr_reset_fcfs(struct fcoe_ctlr *fip) ...@@ -134,8 +140,8 @@ static void fcoe_ctlr_reset_fcfs(struct fcoe_ctlr *fip)
} }
/** /**
* fcoe_ctlr_destroy() - Disable and tear-down the FCoE controller. * fcoe_ctlr_destroy() - Disable and tear down a FCoE controller
* @fip: FCoE controller. * @fip: The FCoE controller to tear down
* *
* This is called by FCoE drivers before freeing the &fcoe_ctlr. * This is called by FCoE drivers before freeing the &fcoe_ctlr.
* *
...@@ -162,8 +168,8 @@ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip) ...@@ -162,8 +168,8 @@ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip)
EXPORT_SYMBOL(fcoe_ctlr_destroy); EXPORT_SYMBOL(fcoe_ctlr_destroy);
/** /**
* fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port. * fcoe_ctlr_fcoe_size() - Return the maximum FCoE size required for VN_Port
* @fip: FCoE controller. * @fip: The FCoE controller to get the maximum FCoE size from
* *
* Returns the maximum packet size including the FCoE header and trailer, * Returns the maximum packet size including the FCoE header and trailer,
* but not including any Ethernet or VLAN headers. * but not including any Ethernet or VLAN headers.
...@@ -180,9 +186,9 @@ static inline u32 fcoe_ctlr_fcoe_size(struct fcoe_ctlr *fip) ...@@ -180,9 +186,9 @@ static inline u32 fcoe_ctlr_fcoe_size(struct fcoe_ctlr *fip)
} }
/** /**
* fcoe_ctlr_solicit() - Send a solicitation. * fcoe_ctlr_solicit() - Send a FIP solicitation
* @fip: FCoE controller. * @fip: The FCoE controller to send the solicitation on
* @fcf: Destination FCF. If NULL, a multicast solicitation is sent. * @fcf: The destination FCF (if NULL, a multicast solicitation is sent)
*/ */
static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf)
{ {
...@@ -241,8 +247,8 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) ...@@ -241,8 +247,8 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf)
} }
/** /**
* fcoe_ctlr_link_up() - Start FCoE controller. * fcoe_ctlr_link_up() - Start FCoE controller
* @fip: FCoE controller. * @fip: The FCoE controller to start
* *
* Called from the LLD when the network link is ready. * Called from the LLD when the network link is ready.
*/ */
...@@ -268,15 +274,15 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip) ...@@ -268,15 +274,15 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
EXPORT_SYMBOL(fcoe_ctlr_link_up); EXPORT_SYMBOL(fcoe_ctlr_link_up);
/** /**
* fcoe_ctlr_reset() - Reset FIP. * fcoe_ctlr_reset() - Reset a FCoE controller
* @fip: FCoE controller. * @fip: The FCoE controller to reset
* @new_state: FIP state to be entered. * @new_state: The FIP state to be entered
* *
* Returns non-zero if the link was up and now isn't. * Returns non-zero if the link was up and now isn't.
*/ */
static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state) static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state)
{ {
struct fc_lport *lp = fip->lp; struct fc_lport *lport = fip->lp;
int link_dropped; int link_dropped;
spin_lock_bh(&fip->lock); spin_lock_bh(&fip->lock);
...@@ -294,19 +300,19 @@ static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state) ...@@ -294,19 +300,19 @@ static int fcoe_ctlr_reset(struct fcoe_ctlr *fip, enum fip_state new_state)
spin_unlock_bh(&fip->lock); spin_unlock_bh(&fip->lock);
if (link_dropped) if (link_dropped)
fc_linkdown(lp); fc_linkdown(lport);
if (new_state == FIP_ST_ENABLED) { if (new_state == FIP_ST_ENABLED) {
fcoe_ctlr_solicit(fip, NULL); fcoe_ctlr_solicit(fip, NULL);
fc_linkup(lp); fc_linkup(lport);
link_dropped = 0; link_dropped = 0;
} }
return link_dropped; return link_dropped;
} }
/** /**
* fcoe_ctlr_link_down() - Stop FCoE controller. * fcoe_ctlr_link_down() - Stop a FCoE controller
* @fip: FCoE controller. * @fip: The FCoE controller to be stopped
* *
* Returns non-zero if the link was up and now isn't. * Returns non-zero if the link was up and now isn't.
* *
...@@ -320,11 +326,11 @@ int fcoe_ctlr_link_down(struct fcoe_ctlr *fip) ...@@ -320,11 +326,11 @@ int fcoe_ctlr_link_down(struct fcoe_ctlr *fip)
EXPORT_SYMBOL(fcoe_ctlr_link_down); EXPORT_SYMBOL(fcoe_ctlr_link_down);
/** /**
* fcoe_ctlr_send_keep_alive() - Send a keep-alive to the selected FCF. * fcoe_ctlr_send_keep_alive() - Send a keep-alive to the selected FCF
* @fip: FCoE controller. * @fip: The FCoE controller to send the FKA on
* @lport: libfc fc_lport to send from * @lport: libfc fc_lport to send from
* @ports: 0 for controller keep-alive, 1 for port keep-alive. * @ports: 0 for controller keep-alive, 1 for port keep-alive
* @sa: source MAC address. * @sa: The source MAC address
* *
* A controller keep-alive is sent every fka_period (typically 8 seconds). * A controller keep-alive is sent every fka_period (typically 8 seconds).
* The source MAC is the native MAC address. * The source MAC is the native MAC address.
...@@ -369,7 +375,7 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, ...@@ -369,7 +375,7 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip,
kal->fip.fip_op = htons(FIP_OP_CTRL); kal->fip.fip_op = htons(FIP_OP_CTRL);
kal->fip.fip_subcode = FIP_SC_KEEP_ALIVE; kal->fip.fip_subcode = FIP_SC_KEEP_ALIVE;
kal->fip.fip_dl_len = htons((sizeof(kal->mac) + kal->fip.fip_dl_len = htons((sizeof(kal->mac) +
ports * sizeof(*vn)) / FIP_BPW); ports * sizeof(*vn)) / FIP_BPW);
kal->fip.fip_flags = htons(FIP_FL_FPMA); kal->fip.fip_flags = htons(FIP_FL_FPMA);
if (fip->spma) if (fip->spma)
kal->fip.fip_flags |= htons(FIP_FL_SPMA); kal->fip.fip_flags |= htons(FIP_FL_SPMA);
...@@ -393,11 +399,10 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, ...@@ -393,11 +399,10 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip,
} }
/** /**
* fcoe_ctlr_encaps() - Encapsulate an ELS frame for FIP, without sending it. * fcoe_ctlr_encaps() - Encapsulate an ELS frame for FIP, without sending it
* @fip: FCoE controller. * @fip: The FCoE controller for the ELS frame
* @lport: libfc fc_lport to use for the source address * @dtype: The FIP descriptor type for the frame
* @dtype: FIP descriptor type for the frame. * @skb: The FCoE ELS frame including FC header but no FCoE headers
* @skb: FCoE ELS frame including FC header but no FCoE headers.
* *
* Returns non-zero error code on failure. * Returns non-zero error code on failure.
* *
...@@ -553,9 +558,9 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, ...@@ -553,9 +558,9 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport,
} }
EXPORT_SYMBOL(fcoe_ctlr_els_send); EXPORT_SYMBOL(fcoe_ctlr_els_send);
/* /**
* fcoe_ctlr_age_fcfs() - Reset and free all old FCFs for a controller. * fcoe_ctlr_age_fcfs() - Reset and free all old FCFs for a controller
* @fip: FCoE controller. * @fip: The FCoE controller to free FCFs on
* *
* Called with lock held. * Called with lock held.
* *
...@@ -596,9 +601,9 @@ static void fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) ...@@ -596,9 +601,9 @@ static void fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip)
} }
/** /**
* fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry. * fcoe_ctlr_parse_adv() - Decode a FIP advertisement into a new FCF entry
* @skb: received FIP advertisement frame * @skb: The received FIP advertisement frame
* @fcf: resulting FCF entry. * @fcf: The resulting FCF entry
* *
* Returns zero on a valid parsed advertisement, * Returns zero on a valid parsed advertisement,
* otherwise returns non zero value. * otherwise returns non zero value.
...@@ -699,9 +704,9 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf) ...@@ -699,9 +704,9 @@ static int fcoe_ctlr_parse_adv(struct sk_buff *skb, struct fcoe_fcf *fcf)
} }
/** /**
* fcoe_ctlr_recv_adv() - Handle an incoming advertisement. * fcoe_ctlr_recv_adv() - Handle an incoming advertisement
* @fip: FCoE controller. * @fip: The FCoE controller receiving the advertisement
* @skb: Received FIP packet. * @skb: The received FIP packet
*/ */
static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
{ {
...@@ -784,7 +789,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -784,7 +789,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
*/ */
if (mtu_valid && !fip->sel_time && fcoe_ctlr_fcf_usable(fcf)) { if (mtu_valid && !fip->sel_time && fcoe_ctlr_fcf_usable(fcf)) {
fip->sel_time = jiffies + fip->sel_time = jiffies +
msecs_to_jiffies(FCOE_CTLR_START_DELAY); msecs_to_jiffies(FCOE_CTLR_START_DELAY);
if (!timer_pending(&fip->timer) || if (!timer_pending(&fip->timer) ||
time_before(fip->sel_time, fip->timer.expires)) time_before(fip->sel_time, fip->timer.expires))
mod_timer(&fip->timer, fip->sel_time); mod_timer(&fip->timer, fip->sel_time);
...@@ -794,13 +799,13 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -794,13 +799,13 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, struct sk_buff *skb)
} }
/** /**
* fcoe_ctlr_recv_els() - Handle an incoming FIP-encapsulated ELS frame. * fcoe_ctlr_recv_els() - Handle an incoming FIP encapsulated ELS frame
* @fip: FCoE controller. * @fip: The FCoE controller which received the packet
* @skb: Received FIP packet. * @skb: The received FIP packet
*/ */
static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)
{ {
struct fc_lport *lp = fip->lp; struct fc_lport *lport = fip->lp;
struct fip_header *fiph; struct fip_header *fiph;
struct fc_frame *fp = (struct fc_frame *)skb; struct fc_frame *fp = (struct fc_frame *)skb;
struct fc_frame_header *fh = NULL; 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,13 +891,13 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)
fc_frame_init(fp); fc_frame_init(fp);
fr_sof(fp) = FC_SOF_I3; fr_sof(fp) = FC_SOF_I3;
fr_eof(fp) = FC_EOF_T; fr_eof(fp) = FC_EOF_T;
fr_dev(fp) = lp; fr_dev(fp) = lport;
stats = fc_lport_get_stats(lp); stats = fc_lport_get_stats(lport);
stats->RxFrames++; stats->RxFrames++;
stats->RxWords += skb->len / FIP_BPW; stats->RxWords += skb->len / FIP_BPW;
fc_exch_recv(lp, fp); fc_exch_recv(lport, fp);
return; return;
len_err: len_err:
...@@ -903,15 +908,15 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -903,15 +908,15 @@ static void fcoe_ctlr_recv_els(struct fcoe_ctlr *fip, struct sk_buff *skb)
} }
/** /**
* fcoe_ctlr_recv_els() - Handle an incoming link reset frame. * fcoe_ctlr_recv_els() - Handle an incoming link reset frame
* @fip: FCoE controller. * @fip: The FCoE controller that received the frame
* @fh: Received FIP header. * @fh: The received FIP header
* *
* There may be multiple VN_Port descriptors. * There may be multiple VN_Port descriptors.
* The overall length has already been checked. * The overall length has already been checked.
*/ */
static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
struct fip_header *fh) struct fip_header *fh)
{ {
struct fip_desc *desc; struct fip_desc *desc;
struct fip_mac_desc *mp; struct fip_mac_desc *mp;
...@@ -920,13 +925,13 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, ...@@ -920,13 +925,13 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
size_t rlen; size_t rlen;
size_t dlen; size_t dlen;
struct fcoe_fcf *fcf = fip->sel_fcf; struct fcoe_fcf *fcf = fip->sel_fcf;
struct fc_lport *lp = fip->lp; struct fc_lport *lport = fip->lp;
u32 desc_mask; u32 desc_mask;
LIBFCOE_FIP_DBG("Clear Virtual Link received\n"); LIBFCOE_FIP_DBG("Clear Virtual Link received\n");
if (!fcf) if (!fcf)
return; return;
if (!fcf || !fc_host_port_id(lp->host)) if (!fcf || !fc_host_port_id(lport->host))
return; return;
/* /*
...@@ -962,9 +967,10 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, ...@@ -962,9 +967,10 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
if (dlen < sizeof(*vp)) if (dlen < sizeof(*vp))
return; return;
if (compare_ether_addr(vp->fd_mac, if (compare_ether_addr(vp->fd_mac,
fip->get_src_addr(lp)) == 0 && fip->get_src_addr(lport)) == 0 &&
get_unaligned_be64(&vp->fd_wwpn) == lp->wwpn && get_unaligned_be64(&vp->fd_wwpn) == lport->wwpn &&
ntoh24(vp->fd_fc_id) == fc_host_port_id(lp->host)) ntoh24(vp->fd_fc_id) ==
fc_host_port_id(lport->host))
desc_mask &= ~BIT(FIP_DT_VN_ID); desc_mask &= ~BIT(FIP_DT_VN_ID);
break; break;
default: default:
...@@ -989,9 +995,9 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip, ...@@ -989,9 +995,9 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
} }
/** /**
* fcoe_ctlr_recv() - Receive a FIP frame. * fcoe_ctlr_recv() - Receive a FIP packet
* @fip: FCoE controller. * @fip: The FCoE controller that received the packet
* @skb: Received FIP packet. * @skb: The received FIP packet
* *
* This is called from NET_RX_SOFTIRQ. * This is called from NET_RX_SOFTIRQ.
*/ */
...@@ -1005,9 +1011,9 @@ void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -1005,9 +1011,9 @@ void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb)
EXPORT_SYMBOL(fcoe_ctlr_recv); EXPORT_SYMBOL(fcoe_ctlr_recv);
/** /**
* fcoe_ctlr_recv_handler() - Receive a FIP frame. * fcoe_ctlr_recv_handler() - Receive a FIP frame
* @fip: FCoE controller. * @fip: The FCoE controller that received the frame
* @skb: Received FIP packet. * @skb: The received FIP frame
* *
* Returns non-zero if the frame is dropped. * Returns non-zero if the frame is dropped.
*/ */
...@@ -1064,8 +1070,8 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -1064,8 +1070,8 @@ static int fcoe_ctlr_recv_handler(struct fcoe_ctlr *fip, struct sk_buff *skb)
} }
/** /**
* fcoe_ctlr_select() - Select the best FCF, if possible. * fcoe_ctlr_select() - Select the best FCF (if possible)
* @fip: FCoE controller. * @fip: The FCoE controller
* *
* If there are conflicting advertisements, no FCF can be chosen. * If there are conflicting advertisements, no FCF can be chosen.
* *
...@@ -1106,8 +1112,8 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip) ...@@ -1106,8 +1112,8 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
} }
/** /**
* fcoe_ctlr_timeout() - FIP timer function. * fcoe_ctlr_timeout() - FIP timeout handler
* @arg: &fcoe_ctlr pointer. * @arg: The FCoE controller that timed out
* *
* Ages FCFs. Triggers FCF selection if possible. Sends keep-alives. * Ages FCFs. Triggers FCF selection if possible. Sends keep-alives.
*/ */
...@@ -1142,12 +1148,12 @@ static void fcoe_ctlr_timeout(unsigned long arg) ...@@ -1142,12 +1148,12 @@ static void fcoe_ctlr_timeout(unsigned long arg)
fip->lp->host->host_no, sel->fcf_mac); fip->lp->host->host_no, sel->fcf_mac);
memcpy(fip->dest_addr, sel->fcf_mac, ETH_ALEN); memcpy(fip->dest_addr, sel->fcf_mac, ETH_ALEN);
fip->port_ka_time = jiffies + fip->port_ka_time = jiffies +
msecs_to_jiffies(FIP_VN_KA_PERIOD); msecs_to_jiffies(FIP_VN_KA_PERIOD);
fip->ctlr_ka_time = jiffies + sel->fka_period; fip->ctlr_ka_time = jiffies + sel->fka_period;
fip->link = 1; fip->link = 1;
} else { } else {
printk(KERN_NOTICE "libfcoe: host%d: " printk(KERN_NOTICE "libfcoe: host%d: "
"FIP Fibre-Channel Forwarder timed out. " "FIP Fibre-Channel Forwarder timed out. "
"Starting FCF discovery.\n", "Starting FCF discovery.\n",
fip->lp->host->host_no); fip->lp->host->host_no);
fip->link = 0; fip->link = 0;
...@@ -1165,7 +1171,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) ...@@ -1165,7 +1171,7 @@ static void fcoe_ctlr_timeout(unsigned long arg)
if (time_after_eq(jiffies, fip->port_ka_time)) { if (time_after_eq(jiffies, fip->port_ka_time)) {
fip->port_ka_time += jiffies + fip->port_ka_time += jiffies +
msecs_to_jiffies(FIP_VN_KA_PERIOD); msecs_to_jiffies(FIP_VN_KA_PERIOD);
fip->send_port_ka = 1; fip->send_port_ka = 1;
} }
if (time_after(next_timer, fip->port_ka_time)) if (time_after(next_timer, fip->port_ka_time))
...@@ -1173,7 +1179,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) ...@@ -1173,7 +1179,7 @@ static void fcoe_ctlr_timeout(unsigned long arg)
mod_timer(&fip->timer, next_timer); mod_timer(&fip->timer, next_timer);
} else if (fip->sel_time) { } else if (fip->sel_time) {
next_timer = fip->sel_time + next_timer = fip->sel_time +
msecs_to_jiffies(FCOE_CTLR_START_DELAY); msecs_to_jiffies(FCOE_CTLR_START_DELAY);
mod_timer(&fip->timer, next_timer); mod_timer(&fip->timer, next_timer);
} }
if (fip->send_ctlr_ka || fip->send_port_ka) if (fip->send_ctlr_ka || fip->send_port_ka)
...@@ -1182,8 +1188,8 @@ static void fcoe_ctlr_timeout(unsigned long arg) ...@@ -1182,8 +1188,8 @@ static void fcoe_ctlr_timeout(unsigned long arg)
} }
/** /**
* fcoe_ctlr_link_work() - worker thread function for link changes. * fcoe_ctlr_link_work() - Worker thread function for link changes
* @work: pointer to link_work member inside &fcoe_ctlr. * @work: Handle to a FCoE controller
* *
* See if the link status has changed and if so, report it. * See if the link status has changed and if so, report it.
* *
...@@ -1230,8 +1236,8 @@ static void fcoe_ctlr_link_work(struct work_struct *work) ...@@ -1230,8 +1236,8 @@ static void fcoe_ctlr_link_work(struct work_struct *work)
} }
/** /**
* fcoe_ctlr_recv_work() - Worker thread function for receiving FIP frames. * fcoe_ctlr_recv_work() - Worker thread function for receiving FIP frames
* @recv_work: pointer to recv_work member inside &fcoe_ctlr. * @recv_work: Handle to a FCoE controller
*/ */
static void fcoe_ctlr_recv_work(struct work_struct *recv_work) static void fcoe_ctlr_recv_work(struct work_struct *recv_work)
{ {
...@@ -1249,11 +1255,10 @@ static void fcoe_ctlr_recv_work(struct work_struct *recv_work) ...@@ -1249,11 +1255,10 @@ static void fcoe_ctlr_recv_work(struct work_struct *recv_work)
} }
/** /**
* fcoe_ctlr_recv_flogi() - snoop Pre-FIP receipt of FLOGI response or request. * fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response or request
* @fip: FCoE controller. * @fip: The FCoE controller
* @lport: libfc fc_lport instance received on * @fp: The FC frame to snoop
* @fp: FC frame. * @sa: Ethernet source MAC address from received FCoE frame
* @sa: Ethernet source MAC address from received FCoE frame.
* *
* Snoop potential response to FLOGI or even incoming FLOGI. * Snoop potential response to FLOGI or even incoming FLOGI.
* *
...@@ -1323,10 +1328,10 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport, ...@@ -1323,10 +1328,10 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *fip, struct fc_lport *lport,
EXPORT_SYMBOL(fcoe_ctlr_recv_flogi); EXPORT_SYMBOL(fcoe_ctlr_recv_flogi);
/** /**
* fcoe_wwn_from_mac() - Converts 48-bit IEEE MAC address to 64-bit FC WWN. * fcoe_wwn_from_mac() - Converts a 48-bit IEEE MAC address to a 64-bit FC WWN
* @mac: mac address * @mac: The MAC address to convert
* @scheme: check port * @scheme: The scheme to use when converting
* @port: port indicator for converting * @port: The port indicator for converting
* *
* Returns: u64 fc world wide name * Returns: u64 fc world wide name
*/ */
...@@ -1364,23 +1369,24 @@ u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], ...@@ -1364,23 +1369,24 @@ u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac);
/** /**
* fcoe_libfc_config() - sets up libfc related properties for lport * fcoe_libfc_config() - Sets up libfc related properties for local port
* @lp: ptr to the fc_lport * @lp: The local port to configure libfc for
* @tt: libfc function template * @tt: The libfc function template
* *
* Returns : 0 for success * Returns : 0 for success
*/ */
int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt) int fcoe_libfc_config(struct fc_lport *lport,
struct libfc_function_template *tt)
{ {
/* Set the function pointers set by the LLDD */ /* Set the function pointers set by the LLDD */
memcpy(&lp->tt, tt, sizeof(*tt)); memcpy(&lport->tt, tt, sizeof(*tt));
if (fc_fcp_init(lp)) if (fc_fcp_init(lport))
return -ENOMEM; return -ENOMEM;
fc_exch_init(lp); fc_exch_init(lport);
fc_elsct_init(lp); fc_elsct_init(lport);
fc_lport_init(lp); fc_lport_init(lport);
fc_rport_init(lp); fc_rport_init(lport);
fc_disc_init(lp); fc_disc_init(lport);
return 0; return 0;
} }
......
...@@ -53,35 +53,35 @@ enum fip_state { ...@@ -53,35 +53,35 @@ enum fip_state {
}; };
/** /**
* struct fcoe_ctlr - FCoE Controller and FIP state. * struct fcoe_ctlr - FCoE Controller and FIP state
* @state: internal FIP state for network link and FIP or non-FIP mode. * @state: internal FIP state for network link and FIP or non-FIP mode.
* @lp: &fc_lport: libfc local port. * @lp: &fc_lport: libfc local port.
* @sel_fcf: currently selected FCF, or NULL. * @sel_fcf: currently selected FCF, or NULL.
* @fcfs: list of discovered FCFs. * @fcfs: list of discovered FCFs.
* @fcf_count: number of discovered FCF entries. * @fcf_count: number of discovered FCF entries.
* @sol_time: time when a multicast solicitation was last sent. * @sol_time: time when a multicast solicitation was last sent.
* @sel_time: time after which to select an FCF. * @sel_time: time after which to select an FCF.
* @port_ka_time: time of next port keep-alive. * @port_ka_time: time of next port keep-alive.
* @ctlr_ka_time: time of next controller keep-alive. * @ctlr_ka_time: time of next controller keep-alive.
* @timer: timer struct used for all delayed events. * @timer: timer struct used for all delayed events.
* @link_work: &work_struct for doing FCF selection. * @link_work: &work_struct for doing FCF selection.
* @recv_work: &work_struct for receiving FIP frames. * @recv_work: &work_struct for receiving FIP frames.
* @fip_recv_list: list of received FIP frames. * @fip_recv_list: list of received FIP frames.
* @user_mfs: configured maximum FC frame size, including FC header. * @user_mfs: configured maximum FC frame size, including FC header.
* @flogi_oxid: exchange ID of most recent fabric login. * @flogi_oxid: exchange ID of most recent fabric login.
* @flogi_count: number of FLOGI attempts in AUTO mode. * @flogi_count: number of FLOGI attempts in AUTO mode.
* @link: current link status for libfc. * @link: current link status for libfc.
* @last_link: last link state reported to libfc. * @last_link: last link state reported to libfc.
* @map_dest: use the FC_MAP mode for destination MAC addresses. * @map_dest: use the FC_MAP mode for destination MAC addresses.
* @spma: supports SPMA server-provided MACs mode * @spma: supports SPMA server-provided MACs mode
* @send_ctlr_ka: need to send controller keep alive * @send_ctlr_ka: need to send controller keep alive
* @send_port_ka: need to send port keep alives * @send_port_ka: need to send port keep alives
* @dest_addr: MAC address of the selected FC forwarder. * @dest_addr: MAC address of the selected FC forwarder.
* @ctl_src_addr: the native MAC address of our local port. * @ctl_src_addr: the native MAC address of our local port.
* @send: LLD-supplied function to handle sending of FIP Ethernet frames. * @send: LLD-supplied function to handle sending FIP Ethernet frames
* @update_mac: LLD-supplied function to handle changes to MAC addresses. * @update_mac: LLD-supplied function to handle changes to MAC addresses.
* @get_src_addr: LLD-supplied function to supply a source MAC address. * @get_src_addr: LLD-supplied function to supply a source MAC address.
* @lock: lock protecting this structure. * @lock: lock protecting this structure.
* *
* This structure is used by all FCoE drivers. It contains information * This structure is used by all FCoE drivers. It contains information
* needed by all FCoE low-level drivers (LLDs) as well as internal state * needed by all FCoE low-level drivers (LLDs) as well as internal state
...@@ -119,18 +119,18 @@ struct fcoe_ctlr { ...@@ -119,18 +119,18 @@ struct fcoe_ctlr {
spinlock_t lock; spinlock_t lock;
}; };
/* /**
* struct fcoe_fcf - Fibre-Channel Forwarder. * struct fcoe_fcf - Fibre-Channel Forwarder
* @list: list linkage. * @list: list linkage
* @time: system time (jiffies) when an advertisement was last received. * @time: system time (jiffies) when an advertisement was last received
* @switch_name: WWN of switch from advertisement. * @switch_name: WWN of switch from advertisement
* @fabric_name: WWN of fabric from advertisement. * @fabric_name: WWN of fabric from advertisement
* @fc_map: FC_MAP value from advertisement. * @fc_map: FC_MAP value from advertisement
* @fcf_mac: Ethernet address of the FCF. * @fcf_mac: Ethernet address of the FCF
* @vfid: virtual fabric ID. * @vfid: virtual fabric ID
* @pri: seletion priority, smaller values are better. * @pri: selection priority, smaller values are better
* @flags: flags received from advertisement. * @flags: flags received from advertisement
* @fka_period: keep-alive period, in jiffies. * @fka_period: keep-alive period, in jiffies
* *
* A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that
* passes FCoE frames on to an FC fabric. This structure represents * passes FCoE frames on to an FC fabric. This structure represents
...@@ -161,8 +161,8 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *); ...@@ -161,8 +161,8 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *);
int fcoe_ctlr_link_down(struct fcoe_ctlr *); int fcoe_ctlr_link_down(struct fcoe_ctlr *);
int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *); int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *);
void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *lport, int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
struct fc_frame *fp, u8 *sa); struct fc_frame *, u8 *);
/* libfcoe funcs */ /* libfcoe funcs */
u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册