diff --git a/src/drivers/net/mlx_ipoib/cmdif_mt25218.c b/src/drivers/net/mlx_ipoib/cmdif_mt25218.c index fb95edbe..704fb1fc 100644 --- a/src/drivers/net/mlx_ipoib/cmdif_mt25218.c +++ b/src/drivers/net/mlx_ipoib/cmdif_mt25218.c @@ -22,14 +22,6 @@ #include "cmdif_priv.h" #include "mt25218.h" -/* - * cmd_sys_dis - */ -static int cmd_sys_dis(void) -{ - return 0; -} - /* * cmd_write_mgm */ @@ -325,6 +317,24 @@ static int cmd_map_icm_aux(struct map_icm_st *map_icm_aux_p) return rc; } + +/* + * cmd_unmap_icm_aux + */ +static int cmd_unmap_icm_aux(void) +{ + int rc; + command_fields_t cmd_desc; + + memset(&cmd_desc, 0, sizeof cmd_desc); + + cmd_desc.opcode = MEMFREE_CMD_UNMAP_ICM_AUX; + + rc = cmd_invoke(&cmd_desc); + + return rc; +} + /* * cmd_map_icm */ @@ -371,6 +381,31 @@ static int cmd_map_icm(struct map_icm_st *map_icm_p) return rc; } + + +/* + * cmd_unmap_icm + */ +static int cmd_unmap_icm(struct map_icm_st *map_icm_p) +{ + int rc; + command_fields_t cmd_desc; + __u32 iprm[2]; + + memset(&cmd_desc, 0, sizeof cmd_desc); + + cmd_desc.opcode = MEMFREE_CMD_UNMAP_ICM; + iprm[0] = map_icm_p->vpm_arr[0].va_h; + iprm[1] = map_icm_p->vpm_arr[0].va_l; + cmd_desc.in_param = iprm; + cmd_desc.in_trans = TRANS_IMMEDIATE; + cmd_desc.input_modifier = 1 << map_icm_p->vpm_arr[0].log2_size; + + rc = cmd_invoke(&cmd_desc); + + return rc; +} + /* * cmd_query_dev_lim */ diff --git a/src/drivers/net/mlx_ipoib/doc/README.boot_over_ib b/src/drivers/net/mlx_ipoib/doc/README.boot_over_ib index 07738628..062abd3f 100644 --- a/src/drivers/net/mlx_ipoib/doc/README.boot_over_ib +++ b/src/drivers/net/mlx_ipoib/doc/README.boot_over_ib @@ -92,13 +92,11 @@ files with .mlx extension also available from Mellanox's web site. 6. Preparing the DHCP Server ----------------------------- -DHCP messages over IP Over IB are transmitted as broadcasts. In order to -distinguish between messages belonging to a certain DHCP session, the messages -must carry the client identifier option (see ietf documentation referred to -above). As of November 2005, ISC DHCP servers do not support this feature. -They are expected to support this at the end of 2005. In order to work this -out, the appropriate patch must be applied (see patches directory). It has -been tested on version isc-dhcpd-V3.0.4b2. +The DHCP server may need to be modified in order to work on IPOIB. Some +distributuions alreay support this (Some SUSE distributuions) while others +do not. If the pre-installed server does not support IPOIB, the user can download +the sources from ISC http://www.isc.org/ and apply the appropriate patch in +the patches directory. The DHCP server must run on a machine which supports IP Over IB. The Mellanox IBGD package (gen1 or gen2) can be used to provide this. @@ -171,6 +169,14 @@ PXE_IB_PORT. 14. Installing a package from Mellanox -------------------------------------- +The package comes as a compressed file with extension .bz2 or .gz. Follow +these steps: +1. Create a directory +2. cd to this directory +3. tar jxf for .bz2 files or + tar zxf for .gz files + +The binaries can be found under src/bin When using a package obtained from Mellanox Technologies' web site, the directory src/bin will contain the driver binary files. The files have a .bin extension and are equivalent to the same files with .zrom extension. diff --git a/src/drivers/net/mlx_ipoib/ib_driver.c b/src/drivers/net/mlx_ipoib/ib_driver.c index a46db7fc..a3015ba2 100644 --- a/src/drivers/net/mlx_ipoib/ib_driver.c +++ b/src/drivers/net/mlx_ipoib/ib_driver.c @@ -248,12 +248,10 @@ static int ib_driver_close(int fw_fatal) ret = 1; } - if (!fw_fatal) { - rc = cmd_sys_dis(); - if (rc) { - eprintf(""); - ret = 1; - } + rc = unset_hca(); + if (rc) { + eprintf(""); + ret = 1; } return ret; diff --git a/src/drivers/net/mlx_ipoib/ib_mt23108.c b/src/drivers/net/mlx_ipoib/ib_mt23108.c index ca3abb10..e09eabfe 100644 --- a/src/drivers/net/mlx_ipoib/ib_mt23108.c +++ b/src/drivers/net/mlx_ipoib/ib_mt23108.c @@ -21,7 +21,7 @@ #include "mt23108.h" #include "ib_driver.h" -#include +#include "pci.h" struct device_buffers_st { union recv_wqe_u mads_qp_rcv_queue[NUM_MADS_RCV_WQES] @@ -799,6 +799,20 @@ static int setup_hca(__u8 port, void **eq_p) return ret; } + +static int unset_hca(void) +{ + int rc = 0; + + if (!fw_fatal) { + rc = cmd_sys_dis(); + if (rc) + eprintf(""); + } + + return rc; +} + static void *get_inprm_buf(void) { return dev_buffers_p->inprm_buf; diff --git a/src/drivers/net/mlx_ipoib/ib_mt25218.c b/src/drivers/net/mlx_ipoib/ib_mt25218.c index f16577f1..8b6b9945 100644 --- a/src/drivers/net/mlx_ipoib/ib_mt25218.c +++ b/src/drivers/net/mlx_ipoib/ib_mt25218.c @@ -21,7 +21,7 @@ #include "mt25218.h" #include "ib_driver.h" -#include +#include "pci.h" #define MOD_INC(counter, max_count) (counter) = ((counter)+1) & ((max_count) - 1) @@ -89,6 +89,10 @@ static struct dev_pci_struct memfree_pci_dev; static struct device_buffers_st *dev_buffers_p; static struct device_ib_data_st dev_ib_data; + + +struct map_icm_st icm_map_obj; + static int gw_write_cr(__u32 addr, __u32 data) { writel(htonl(data), memfree_pci_dev.cr_space + addr); @@ -850,6 +854,8 @@ static int setup_hca(__u8 port, void **eq_p) eprintf(""); goto undo_map_fa; } + icm_map_obj = map_obj; + phys_mem.offset += (1 << (map_obj.vpm_arr[0].log2_size + 12)); init_hca.log_max_uars = log_max_uars; @@ -978,6 +984,30 @@ static int setup_hca(__u8 port, void **eq_p) return ret; } + +static int unset_hca(void) +{ + int rc, ret = 0; + + rc = cmd_unmap_icm(&icm_map_obj); + if (rc) + eprintf(""); + ret |= rc; + + + rc = cmd_unmap_icm_aux(); + if (rc) + eprintf(""); + ret |= rc; + + rc = cmd_unmap_fa(); + if (rc) + eprintf(""); + ret |= rc; + + return ret; +} + static void *get_inprm_buf(void) { return dev_buffers_p->inprm_buf; diff --git a/src/drivers/net/mlx_ipoib/ipoib.c b/src/drivers/net/mlx_ipoib/ipoib.c index 85eaac7a..33472de3 100644 --- a/src/drivers/net/mlx_ipoib/ipoib.c +++ b/src/drivers/net/mlx_ipoib/ipoib.c @@ -357,52 +357,12 @@ static void modify_dhcp_resp(void *buf, __u16 size) modify_udp_csum(buf, size); } -static void get_my_client_id(__u8 * my_client_id) -{ - - my_client_id[0] = 0; - qpn2buf(ipoib_data.ipoib_qpn, my_client_id + 1); - memcpy(my_client_id + 4, ipoib_data.port_gid_raw, 16); -} - -static const __u8 *get_client_id(const void *buf, int len) -{ - const __u8 *ptr; - int delta; - - if (len < 268) - return NULL; - - /* pointer to just after magic cookie */ - ptr = (const __u8 *)buf + 268; - - /* find last client identifier option */ - do { - if (ptr[0] == 255) { - /* found end of options list */ - return NULL; - } - - if (ptr[0] == 0x3d) { - /* client identifer option */ - return ptr + 3; - } - - delta = ptr[1] + 2; - ptr += delta; - len -= delta; - } while (len > 0); - - return NULL; -} - static int handle_ipv4_packet(void *buf, void **out_buf_p, unsigned int *new_size_p, int *is_bcast_p) { void *new_buf; __u16 new_size; __u8 msg_type; - __u8 my_client_id[20]; new_buf = (void *)(((__u8 *) buf) + 4); new_size = (*new_size_p) - 4; @@ -411,7 +371,6 @@ static int handle_ipv4_packet(void *buf, void **out_buf_p, if (get_ip_protocl(new_buf) == IP_PROT_UDP) { __u16 udp_dst_port; - const __u8 *client_id; udp_dst_port = get_udp_dst_port(new_buf); @@ -420,22 +379,6 @@ static int handle_ipv4_packet(void *buf, void **out_buf_p, *out_buf_p = 0; return 0; } - - if (udp_dst_port == 68) { - get_my_client_id(my_client_id); - - /* packet client id */ - client_id = get_client_id(new_buf, new_size); - if (!client_id) { - *out_buf_p = 0; - return 0; - } - - if (memcmp(client_id, my_client_id, 20)) { - *out_buf_p = 0; - return 0; - } - } } msg_type = get_dhcp_msg_type(new_buf); @@ -515,8 +458,9 @@ static int ipoib_handle_rcv(void *buf, void **out_buf_p, rc = handle_ipv4_packet(buf, out_buf_p, new_size_p, is_bcast_p); return rc; } - eprintf("prot=0x%x", prot_type); - return -1; + tprintf("prot=0x%x", prot_type); + *out_buf_p = NULL; + return 0; } static int is_null_mac(const __u8 * mac) diff --git a/src/drivers/net/mlx_ipoib/mt23108.c b/src/drivers/net/mlx_ipoib/mt23108.c index 492bc901..157995d7 100644 --- a/src/drivers/net/mlx_ipoib/mt23108.c +++ b/src/drivers/net/mlx_ipoib/mt23108.c @@ -15,9 +15,9 @@ Skeleton NIC driver for Etherboot /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include +#include "pci.h" /* to get the ISA support functions, if this is an ISA NIC */ -#include +#include "isa.h" #include "mt_version.c" #include "mt23108_imp.c" @@ -235,7 +235,7 @@ static struct pci_id tavor_nics[] = { PCI_ROM(0x15b3, 0x6278, "MT25208", "MT25208 HCA driver"), }; -struct pci_driver tavor_driver __pci_driver = { +static struct pci_driver tavor_driver __pci_driver = { .type = NIC_DRIVER, .name = "MT23108/MT25208", .probe = tavor_probe, diff --git a/src/drivers/net/mlx_ipoib/mt25218.c b/src/drivers/net/mlx_ipoib/mt25218.c index a603cdeb..7866bf60 100644 --- a/src/drivers/net/mlx_ipoib/mt25218.c +++ b/src/drivers/net/mlx_ipoib/mt25218.c @@ -15,9 +15,9 @@ Skeleton NIC driver for Etherboot /* to get the interface to the body of the program */ #include "nic.h" /* to get the PCI support functions, if this is a PCI NIC */ -#include +#include "pci.h" /* to get the ISA support functions, if this is an ISA NIC */ -#include +#include "isa.h" #include "mt_version.c" #include "mt25218_imp.c" @@ -235,7 +235,7 @@ static struct pci_id mt25218_nics[] = { PCI_ROM(0x15b3, 0x6274, "MT25204", "MT25204 HCA driver"), }; -struct pci_driver mt25218_driver __pci_driver = { +static struct pci_driver mt25218_driver __pci_driver = { .type = NIC_DRIVER, .name = "MT25218", .probe = mt25218_probe, diff --git a/src/drivers/net/mlx_ipoib/mt25218.h b/src/drivers/net/mlx_ipoib/mt25218.h index 15a3feaf..1e7c8d8b 100644 --- a/src/drivers/net/mlx_ipoib/mt25218.h +++ b/src/drivers/net/mlx_ipoib/mt25218.h @@ -26,7 +26,9 @@ #define MEMFREE_CMD_RUN_FW 0xff6 #define MEMFREE_CMD_SET_ICM_SIZE 0xffd #define MEMFREE_CMD_MAP_ICM_AUX 0xffc +#define MEMFREE_CMD_UNMAP_ICM_AUX 0xffb #define MEMFREE_CMD_MAP_ICM 0xffa +#define MEMFREE_CMD_UNMAP_ICM 0xff9 #define MEMFREE_CMD_QUERY_DEV_LIM 0x003 /* diff --git a/src/drivers/net/mlx_ipoib/mt_version.c b/src/drivers/net/mlx_ipoib/mt_version.c index 2dbd67a6..bae860c3 100644 --- a/src/drivers/net/mlx_ipoib/mt_version.c +++ b/src/drivers/net/mlx_ipoib/mt_version.c @@ -20,4 +20,4 @@ */ /* definition of the build version goes here */ -const char *build_revision= "113"; +const char *build_revision= "191"; diff --git a/src/drivers/net/mlx_ipoib/patches/dhcpd.patch b/src/drivers/net/mlx_ipoib/patches/dhcpd.patch index e2d0a202..3f6269bf 100644 --- a/src/drivers/net/mlx_ipoib/patches/dhcpd.patch +++ b/src/drivers/net/mlx_ipoib/patches/dhcpd.patch @@ -1,17 +1,7 @@ -diff -ru ../../orig/dhcp-3.0.4b2/common/options.c ./common/options.c ---- ../../orig/dhcp-3.0.4b2/common/options.c 2005-11-02 01:19:03.000000000 +0200 -+++ ./common/options.c 2005-12-06 14:38:17.000000000 +0200 -@@ -537,6 +537,7 @@ - priority_list [priority_len++] = DHO_DHCP_LEASE_TIME; - priority_list [priority_len++] = DHO_DHCP_MESSAGE; - priority_list [priority_len++] = DHO_DHCP_REQUESTED_ADDRESS; -+ priority_list [priority_len++] = DHO_DHCP_CLIENT_IDENTIFIER; - priority_list [priority_len++] = DHO_FQDN; - - if (prl && prl -> len > 0) { -diff -ru ../../orig/dhcp-3.0.4b2/includes/site.h ./includes/site.h ---- ../../orig/dhcp-3.0.4b2/includes/site.h 2002-03-12 20:33:39.000000000 +0200 -+++ ./includes/site.h 2005-12-06 14:36:55.000000000 +0200 +Index: dhcp-3.0.4b3/includes/site.h +=================================================================== +--- dhcp-3.0.4b3.orig/includes/site.h 2002-03-12 20:33:39.000000000 +0200 ++++ dhcp-3.0.4b3/includes/site.h 2006-03-15 12:50:00.000000000 +0200 @@ -135,7 +135,7 @@ the aforementioned problems do not matter to you, or if no other API is supported for your system, you may want to go with it. */