2 * Copyright(c) 2009 Intel Corporation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 * Maintained at www.Open-FCoE.org
20 #include <linux/module.h>
21 #include <linux/netdevice.h>
23 #include <scsi/libfc.h>
25 MODULE_AUTHOR("Open-FCoE.org");
26 MODULE_DESCRIPTION("FCoE");
27 MODULE_LICENSE("GPL v2");
30 * fcoe_wwn_from_mac() - Converts 48-bit IEEE MAC address to 64-bit FC WWN.
33 * @port: port indicator for converting
35 * Returns: u64 fc world wide name
37 u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
38 unsigned int scheme, unsigned int port)
43 /* The MAC is in NO, so flip only the low 48 bits */
44 host_mac = ((u64) mac[0] << 40) |
45 ((u64) mac[1] << 32) |
46 ((u64) mac[2] << 24) |
47 ((u64) mac[3] << 16) |
51 WARN_ON(host_mac >= (1ULL << 48));
52 wwn = host_mac | ((u64) scheme << 60);
58 WARN_ON(port >= 0xfff);
59 wwn |= (u64) port << 48;
68 EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac);
71 * fcoe_libfc_config() - sets up libfc related properties for lport
72 * @lp: ptr to the fc_lport
73 * @tt: libfc function template
75 * Returns : 0 for success
77 int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt)
79 /* Set the function pointers set by the LLDD */
80 memcpy(&lp->tt, tt, sizeof(*tt));
91 EXPORT_SYMBOL_GPL(fcoe_libfc_config);