[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [rhel6-branch] Support for IPoIB.



Seems to be allright, the logic looks okay to me. But I have no IB experience...

--
Martin Sivák
msivak redhat com
Red Hat Czech
Anaconda team / Brno, CZ

----- Original Message -----
> For now the support includes:
> - support for 20-byte MAC addresses
> - allowing detection of IB devices in devices.c
> - using libnl to detect the link layer type of a device
> 
> This all ensures we write out correct information into the ifcfg files
> (which are then used by NM).
> 
> This is an initial attempt, I am unable to fully test this now due to
> problems with missing IB support in NetworkManager.
> 
> Related: rhbz#660686
> ---
> isys/devices.c | 4 +++-
> isys/iface.c | 34 +++++++++++++++++++++++++++++++++-
> isys/iface.h | 5 +++++
> loader/loader.c | 3 +++
> loader/net.c | 29 +++++++++++++++++++++++++++++
> 5 files changed, 73 insertions(+), 2 deletions(-)
> 
> diff --git a/isys/devices.c b/isys/devices.c
> index 2a77ce4..819b2fb 100644
> --- a/isys/devices.c
> +++ b/isys/devices.c
> @@ -172,7 +172,9 @@ storagedone:
> return NULL;
> }
> 
> - if (type != ARPHRD_ETHER && type != ARPHRD_SLIP)
> + if (type != ARPHRD_ETHER &&
> + type != ARPHRD_INFINIBAND &&
> + type != ARPHRD_SLIP)
> continue;
> 
> new = calloc(1, sizeof(struct device));
> diff --git a/isys/iface.c b/isys/iface.c
> index 05446ee..db3027f 100644
> --- a/isys/iface.c
> +++ b/isys/iface.c
> @@ -275,7 +275,7 @@ char *iface_mac2device(char *mac) {
> * readable format (e.g., 00:11:52:12:D9:A0). Return NULL for no match.
> */
> char *iface_mac2str(char *ifname) {
> - int buflen = 20;
> + int buflen = 64;
> char *buf = NULL;
> struct nl_handle *handle = NULL;
> struct nl_cache *cache = NULL;
> @@ -569,3 +569,35 @@ ifacemtu_error1:
> 
> return ret;
> }
> +
> +/*
> + * Get the link layer type of the device.
> + */
> +int iface_get_arptype(const char *ifname)
> +{
> + int ret;
> + struct nl_cache *cache = NULL;
> + struct nl_handle *handle = NULL;
> + struct rtnl_link *link = NULL;
> +
> + if (ifname == NULL) {
> + return -1;
> + }
> +
> + if ((cache = _iface_get_link_cache(&handle)) == NULL) {
> + return -3;
> + }
> +
> + if ((link = rtnl_link_get_by_name(cache, ifname)) == NULL) {
> + ret = -4;
> + goto iface_get_arptype_error;
> + }
> +
> + ret = rtnl_link_get_arptype(link);
> +
> +iface_get_arptype_error:
> + nl_close(handle);
> + nl_handle_destroy(handle);
> +
> + return ret;
> +}
> diff --git a/isys/iface.h b/isys/iface.h
> index f7d073e..567f5ee 100644
> --- a/isys/iface.h
> +++ b/isys/iface.h
> @@ -164,4 +164,9 @@ int iface_start_NetworkManager(void);
> */
> int iface_set_interface_mtu(char *ifname, int mtu);
> 
> +/*
> + * Get the link layer type of the device.
> + */
> +int iface_get_arptype(const char *ifname);
> +
> #endif /* ISYSIFACE_H */
> diff --git a/loader/loader.c b/loader/loader.c
> index 0154ce0..81e1d68 100644
> --- a/loader/loader.c
> +++ b/loader/loader.c
> @@ -2073,6 +2073,9 @@ int main(int argc, char ** argv) {
> 
> mlLoadModuleSet("cramfs:squashfs:iscsi_tcp");
> 
> + /* Load all modules needed for IP over Infiniband */
> + mlLoadModuleSet("ib_ipoib:mlx4_core:mlx4_en");
> +
> loadScsiDhModules();
> 
> #if !defined(__s390__) && !defined(__s390x__)
> diff --git a/loader/net.c b/loader/net.c
> index 1531d4f..725c160 100644
> --- a/loader/net.c
> +++ b/loader/net.c
> @@ -30,6 +30,7 @@
> #include <errno.h>
> #include <resolv.h>
> #include <net/if.h>
> +#include <net/if_arp.h>
> #include <newt.h>
> #include <stdlib.h>
> #include <string.h>
> @@ -154,6 +155,31 @@ static void ipCallback(newtComponent co, void *
> dptr) {
> }
> }
> 
> +/*
> + * Return a newly allocated string with the network device type.
> + *
> + * This can directly be written into the ifcfg script's TYPE= field.
> + */
> +static char *netArpTypeStr(iface_t *iface)
> +{
> + char *ret = NULL;
> + int arptype = iface_get_arptype(iface->device);
> + switch (arptype) {
> + case ARPHRD_ETHER:
> + ret = strdup("Ethernet");
> + break;
> + case ARPHRD_INFINIBAND:
> + ret = strdup("Infiniband");
> + break;
> + case ARPHRD_SLIP:
> + break;
> + default:
> + logMessage(ERROR, "Unknown network device type: %d", arptype);
> + break;
> + }
> + return ret;
> +}
> +
> static void setMethodSensitivity(void *dptr, int radio_button_count) {
> int i = 0;
> 
> @@ -1295,6 +1321,9 @@ int writeEnabledNetInfo(iface_t *iface) {
> fprintf(fp, "HWADDR=%s\n", iface_mac2str(iface->device));
> #endif
> fprintf(fp, "ONBOOT=yes\n");
> + char *str_type = netArpTypeStr(iface);
> + if (str_type) fprintf(fp, "TYPE=%s\n", str_type);
> + free(str_type);
> 
> if (!FL_NOIPV4(flags)) {
> if (iface->ipv4method == IPV4_IBFT_METHOD) {
> --
> 1.7.3.3
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]