Hi,

I have implemented the 4 dell oem commands delloem lcd, mac lan and 
powermonitor.
There are 5 patches to enable them.

This is the 4th patch out 5 patches.
The purpose of this patch is to add support for dell specific lan commands.

Regards,
Deepaganesh Paulraj


diff -Naurp 04_ipmitool-1.8.11_mac/include/ipmitool/ipmi_delloem.h 
05_ipmitool-1.8.11_lan/include/ipmitool/ipmi_delloem.h
--- 04_ipmitool-1.8.11_mac/include/ipmitool/ipmi_delloem.h      2010-02-23 
20:40:26.000000000 +0530
+++ 05_ipmitool-1.8.11_lan/include/ipmitool/ipmi_delloem.h      2010-02-23 
20:40:27.000000000 +0530
@@ -211,6 +211,14 @@ typedef struct
 #define IDRAC_NIC_NUMBER            (uint8_t)(0x8)
 
 #define TOTAL_N0_NICS_INDEX         (uint8_t)(0x1)
+
+#define SET_NIC_SELECTION_CMD       (uint8_t)(0x24)
+#define GET_NIC_SELECTION_CMD       (uint8_t)(0x25)
+#define GET_ACTIVE_NIC_CMD          (uint8_t)(0xc1)
+
+
+
+
 int ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv);
 
 #endif /*IPMI_DELLOEM_H*/
diff -Naurp 04_ipmitool-1.8.11_mac/lib/ipmi_delloem.c 
05_ipmitool-1.8.11_lan/lib/ipmi_delloem.c
--- 04_ipmitool-1.8.11_mac/lib/ipmi_delloem.c   2010-02-23 20:40:26.000000000 
+0530
+++ 05_ipmitool-1.8.11_lan/lib/ipmi_delloem.c   2010-02-23 20:40:27.000000000 
+0530
@@ -70,6 +70,11 @@ POSSIBILITY OF SUCH DAMAGE. 
 
 #define DELL_OEM_NETFN             (uint8_t)(0x30)
 #define GET_IDRAC_VIRTUAL_MAC      (uint8_t)(0xC9)
+#define INVALID -1
+#define SHARED 0
+#define SHARED_WITH_FAILOVER_LOM2 1
+#define DEDICATED 2
+#define SHARED_WITH_FAILOVER_ALL_LOMS 3
 
 static int current_arg =0;
 uint8_t iDRAC_FLAG=0;
@@ -120,6 +125,14 @@ static int ipmi_macinfo_11g (struct ipmi
 static int ipmi_macinfo (struct ipmi_intf* intf, uint8_t NicNum);
 static void ipmi_mac_usage(void);
 
+static int ipmi_delloem_lan_main (struct ipmi_intf * intf, int argc, char ** 
argv);
+static int IsLANSupported ();
+static int get_nic_selection_mode (int current_arg, char ** argv);
+static int ipmi_lan_set_nic_selection (struct ipmi_intf* intf, uint8_t 
nic_selection);
+static int ipmi_lan_get_nic_selection (struct ipmi_intf* intf);
+static int ipmi_lan_get_active_nic (struct ipmi_intf* intf);
+static void ipmi_lan_usage(void);
+
 
 /*****************************************************************
 * Function Name:       ipmi_delloem_main
@@ -158,6 +171,11 @@ ipmi_delloem_main(struct ipmi_intf * int
     {
         ipmi_delloem_mac_main (intf,argc,argv);
     }
+    /* lan address*/
+    else if (IsLANSupported() && strncmp(argv[current_arg], "lan\0", 4) == 0) 
+    {
+        ipmi_delloem_lan_main (intf,argc,argv);
+    }       
     else
     {
         usage();
@@ -186,6 +204,8 @@ static void usage(void)
     if (IsLCDSupported())
         lprintf(LOG_NOTICE, "    lcd"); 
     lprintf(LOG_NOTICE, "    mac");         
+    if (IsLANSupported())
+        lprintf(LOG_NOTICE, "    lan");         
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "For help on individual commands type:");
     lprintf(LOG_NOTICE, "delloem <command> help");
@@ -1747,6 +1767,7 @@ ipmi_lcd_usage(void)
 static int ipmi_delloem_mac_main (struct ipmi_intf * intf, int argc, char ** 
argv)
 {
     int rc = 0;
+
     current_arg++;
     if (argc == 1)
     {
@@ -2252,3 +2273,274 @@ ipmi_mac_usage(void)
     lprintf(LOG_NOTICE, "      Shows the MAC address of specified LOM. 0-7 
System LOM, 8- DRAC/iDRAC.");
     lprintf(LOG_NOTICE, "");
 }
+
+/*****************************************************************
+* Function Name:       ipmi_delloem_lan_main
+*
+* Description:         This function processes the delloem lan command
+* Input:               intf    - ipmi interface
+                       argc    - no of arguments
+                       argv    - argument string array
+* Output:        
+*
+* Return:              return code     0 - success
+*                         -1 - failure
+*
+******************************************************************/
+
+static int ipmi_delloem_lan_main (struct ipmi_intf * intf, int argc, char ** 
argv)
+{
+    int rc = 0;
+
+    int nic_selection = 0;
+    current_arg++;
+    if (argv[current_arg] == NULL)
+    {
+        ipmi_lan_usage();
+        return -1;
+    }               
+    else if (strncmp(argv[current_arg], "set\0", 4) == 0)
+    {
+        current_arg++;
+        if (argv[current_arg] == NULL)
+        {
+            ipmi_lan_usage();
+            return -1;
+        }
+        nic_selection = get_nic_selection_mode(current_arg,argv);
+
+
+        if (INVALID == nic_selection)
+        {
+            ipmi_lan_usage();
+            return -1;
+        }                               
+        rc = ipmi_lan_set_nic_selection(intf,nic_selection);
+        return 0;                       
+    }
+    else if (strncmp(argv[current_arg], "get\0", 4) == 0)
+    {
+        current_arg++;
+        if (argv[current_arg] == NULL)
+        {
+            rc = ipmi_lan_get_nic_selection(intf);
+            return rc;
+        }
+        else if (strncmp(argv[current_arg], "active\0", 7) == 0)               
 
+        {
+            rc = ipmi_lan_get_active_nic(intf);
+            return rc;
+        }
+        else
+        {
+            ipmi_lan_usage();
+        }
+
+    }
+    else
+    {
+        ipmi_lan_usage();
+    }
+}
+
+
+static int IsLANSupported ()
+{
+    if (IMC_IDRAC_11G_MODULAR == IMC_Type)
+        return 0;
+    return 1;
+}
+
+char NIC_Selection_Mode_String [4] [50] =     {       "shared",  
+"shared with failover lom2",
+"dedicated",
+"shared with Failover all loms"
+};
+
+
+char AciveLOM_String [5] [10] =       {"dedicated","LOM1","LOM2","LOM3","LOM4" 
};
+
+
+
+
+static int get_nic_selection_mode (int current_arg, char ** argv)
+{
+    int nic_selection_mode = 0;
+    if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], 
"dedicated\0", 10)) 
+    {
+        return DEDICATED;
+    }
+    if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], 
"shared\0", 7)) 
+    {
+        if (NULL == argv[current_arg+1] )
+            return SHARED;          
+    }
+    current_arg++;  
+    if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], "with\0", 
5)) 
+    {
+    }       
+    else
+        return INVALID;         
+
+    current_arg++;  
+    if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], 
"failover\0", 9)) 
+    {
+    }       
+    else
+        return INVALID;         
+
+    current_arg++;  
+    if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], "lom2\0", 
5)) 
+    {
+        return SHARED_WITH_FAILOVER_LOM2;
+    }       
+    else if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], 
"all\0", 4)) 
+    {
+    }       
+    else
+        return INVALID; 
+
+    current_arg++;  
+    if (NULL!= argv[current_arg] && 0 == strncmp(argv[current_arg], "loms\0", 
5)) 
+    {
+        return SHARED_WITH_FAILOVER_ALL_LOMS;
+    }       
+
+    return INVALID;
+
+}
+
+
+static int ipmi_lan_set_nic_selection (struct ipmi_intf* intf, uint8_t 
nic_selection)
+{
+    struct ipmi_rs * rsp;
+    struct ipmi_rq req;
+
+    uint8_t msg_data[30];
+    uint8_t input_length=0;
+    uint8_t j;
+
+    input_length = 0;
+
+    msg_data[input_length++] = nic_selection; 
+
+    req.msg.netfn = DELL_OEM_NETFN;
+    req.msg.lun = 0;                
+    req.msg.cmd = SET_NIC_SELECTION_CMD;
+    req.msg.data = msg_data;
+    req.msg.data_len = input_length;
+
+    rsp = intf->sendrecv(intf, &req);
+    if (rsp == NULL)
+    {
+        lprintf(LOG_ERR, " Error in setting nic selection");
+        return -1;
+    }
+    else if (rsp->ccode > 0) 
+    {
+        lprintf(LOG_ERR, " Error in setting nic selection (%s) \n",
+            val2str(rsp->ccode, completion_code_vals) );
+        return -1;
+    }
+    printf("configured successfully");
+
+    return 0;
+}      
+
+static int ipmi_lan_get_nic_selection (struct ipmi_intf* intf)
+{
+    uint8_t nic_selection=-1;
+
+    struct ipmi_rs * rsp;
+    struct ipmi_rq req;
+
+    uint8_t msg_data[30];
+    uint8_t input_length=0;
+    uint8_t j;
+
+    input_length = 0;
+
+    req.msg.netfn = DELL_OEM_NETFN;
+    req.msg.lun = 0;                
+    req.msg.cmd = GET_NIC_SELECTION_CMD;
+    req.msg.data = msg_data;
+    req.msg.data_len = input_length;
+
+    rsp = intf->sendrecv(intf, &req);
+    if (rsp == NULL)
+    {
+        lprintf(LOG_ERR, " Error in getting nic selection");
+        return -1;
+    }
+    else if (rsp->ccode > 0) 
+    {
+        lprintf(LOG_ERR, " Error in getting nic selection (%s) \n",
+            val2str(rsp->ccode, completion_code_vals) );
+        return -1;
+    }
+    nic_selection = rsp->data[0];
+
+    printf ("\n%s",NIC_Selection_Mode_String[nic_selection]);
+
+    return 0;
+}      
+
+static int ipmi_lan_get_active_nic (struct ipmi_intf* intf)
+{
+    uint8_t active_nic=0;
+
+    struct ipmi_rs * rsp;
+    struct ipmi_rq req;
+
+    uint8_t msg_data[30];
+    uint8_t input_length=0;
+    uint8_t j;
+
+    input_length = 0;
+
+    msg_data[input_length++] = 0; /*Get Status*/
+    msg_data[input_length++] = 0; /*Reserved*/
+    msg_data[input_length++] = 0; /*Reserved*/        
+
+    req.msg.netfn = DELL_OEM_NETFN;
+    req.msg.lun = 0;                
+    req.msg.cmd = GET_ACTIVE_NIC_CMD;
+    req.msg.data = msg_data;
+    req.msg.data_len = input_length;
+
+    rsp = intf->sendrecv(intf, &req);
+    if (rsp == NULL)
+    {
+        lprintf(LOG_ERR, " Error in getting Active LOM Status");
+        return -1;
+    }
+    else if (rsp->ccode > 0) 
+    {
+        lprintf(LOG_ERR, " Error in getting Active LOM Status (%s) \n",
+            val2str(rsp->ccode, completion_code_vals) );
+        return -1;
+    }
+    active_nic = rsp->data[0];
+    if (active_nic < 5)
+        printf ("\n%s",AciveLOM_String[active_nic]);
+
+    return 0;
+}      
+
+
+static void
+ipmi_lan_usage(void)
+{
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "   lan set <Mode> ");
+    lprintf(LOG_NOTICE, "      sets the NIC Selection Mode (dedicated, shared, 
shared with failover lom2, shared with Failover all loms).");
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "   lan get ");
+    lprintf(LOG_NOTICE, "      returns the current NIC Selection Mode 
(dedicated, shared, shared with failover lom2, shared with Failover all 
loms).");
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "   lan get active");
+    lprintf(LOG_NOTICE, "      returns the current active NIC (dedicated, 
LOM1, LOM2, LOM3, LOM4).");       
+    lprintf(LOG_NOTICE, "");
+}
+
+

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to