[openib-general] [PATCH] ib_smi: Make agent names more meaningful

Hal Rosenstock halr at voltaire.com
Wed Oct 13 05:27:58 PDT 2004


ib_smi: Make agent names more meaningful

Index: ib_smi_priv.h
===================================================================
--- ib_smi_priv.h       (revision 970)
+++ ib_smi_priv.h       (working copy)
@@ -41,9 +41,9 @@
        struct list_head send_posted_smp_list;
        spinlock_t send_list_lock;
        int port_num;
-       struct ib_mad_agent *mad_agent; /* DR SM class */
-       struct ib_mad_agent *mad_agent2; /* LR SM class */
-       struct ib_mad_agent *pma_mad_agent; /* PerfMgt class */
+       struct ib_mad_agent *dr_smp_mad_agent; /* DR SM class */
+       struct ib_mad_agent *lr_smp_mad_agent; /* LR SM class */
+       struct ib_mad_agent *pma_mad_agent;    /* PerfMgt class */
        struct ib_mr *mr;
        u64 wr_id;
 };
Index: ib_smi.c
===================================================================
--- ib_smi.c    (revision 974)
+++ ib_smi.c    (working copy)
@@ -316,8 +316,8 @@
        /* Find matching MAD agent */
        spin_lock_irqsave(&ib_smi_port_list_lock, flags);
        list_for_each_entry(entry, &ib_smi_port_list, port_list) {
-               if ((entry->mad_agent == mad_agent) ||
-                   (entry->mad_agent2 == mad_agent) ||
+               if ((entry->dr_smp_mad_agent == mad_agent) ||
+                   (entry->lr_smp_mad_agent == mad_agent) ||
                    (entry->pma_mad_agent == mad_agent)) { 
                        port_priv = entry;
                        break;
@@ -460,8 +460,8 @@
        /* Find matching MAD agent */
        spin_lock_irqsave(&ib_smi_port_list_lock, flags);
        list_for_each_entry(entry, &ib_smi_port_list, port_list) {
-               if ((entry->mad_agent == mad_agent) ||
-                   (entry->mad_agent2 == mad_agent) ||
+               if ((entry->dr_smp_mad_agent == mad_agent) ||
+                   (entry->lr_smp_mad_agent == mad_agent) ||
                    (entry->pma_mad_agent == mad_agent)) {
                        port_priv = entry;
                        break;
@@ -530,7 +530,7 @@
        /* First, check if port already open for SMI */
        spin_lock_irqsave(&ib_smi_port_list_lock, flags);
        list_for_each_entry(entry, &ib_smi_port_list, port_list) {
-               if (entry->mad_agent->device == device && 
+               if (entry->dr_smp_mad_agent->device == device && 
                    entry->port_num == port_num) {
                        port_priv = entry;
                        break;
@@ -568,27 +568,27 @@
        set_bit(IB_MGMT_METHOD_TRAP_REPRESS, 
                (unsigned long *)&reg_req.method_mask);
 
-       port_priv->mad_agent = ib_register_mad_agent(device, port_num,
-                                                    IB_QPT_SMI,
-                                                   &reg_req, 0,
-                                                   &smi_send_handler,
-                                                   &smi_recv_handler,
-                                                    NULL);
-       if (IS_ERR(port_priv->mad_agent)) {
-               ret = PTR_ERR(port_priv->mad_agent);
+       port_priv->dr_smp_mad_agent = ib_register_mad_agent(device,
port_num,
+                                                           IB_QPT_SMI,
+                                                          &reg_req, 0,
+                                                         
&smi_send_handler,
+                                                         
&smi_recv_handler,
+                                                           NULL);
+       if (IS_ERR(port_priv->dr_smp_mad_agent)) {
+               ret = PTR_ERR(port_priv->dr_smp_mad_agent);
                goto error2;
        }
 
        /* Obtain MAD agent for LID routed SM class */
        reg_req.mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
-       port_priv->mad_agent2 = ib_register_mad_agent(device, port_num,
-                                                     IB_QPT_SMI,
-                                                    &reg_req, 0,
-                                                    &smi_send_handler,
-                                                    &smi_recv_handler,
-                                                     NULL);
-       if (IS_ERR(port_priv->mad_agent2)) {
-               ret = PTR_ERR(port_priv->mad_agent2);
+       port_priv->lr_smp_mad_agent = ib_register_mad_agent(device,
port_num,
+                                                           IB_QPT_SMI,
+                                                          &reg_req, 0,
+                                                         
&smi_send_handler,
+                                                         
&smi_recv_handler,
+                                                           NULL);
+       if (IS_ERR(port_priv->lr_smp_mad_agent)) {
+               ret = PTR_ERR(port_priv->lr_smp_mad_agent);
                goto error3;
        }
 
@@ -607,7 +607,7 @@
                goto error4;
        }
 
-       port_priv->mr = ib_reg_phys_mr(port_priv->mad_agent->qp->pd,
+       port_priv->mr =
ib_reg_phys_mr(port_priv->dr_smp_mad_agent->qp->pd,
                                      &buf_list, 1,
                                       IB_ACCESS_LOCAL_WRITE, &iova);
        if (IS_ERR(port_priv->mr)) {
@@ -625,9 +625,9 @@
 error5:
        ib_unregister_mad_agent(port_priv->pma_mad_agent);
 error4:
-       ib_unregister_mad_agent(port_priv->mad_agent2);
+       ib_unregister_mad_agent(port_priv->lr_smp_mad_agent);
 error3:
-       ib_unregister_mad_agent(port_priv->mad_agent);
+       ib_unregister_mad_agent(port_priv->dr_smp_mad_agent);
 error2:
        kfree(port_priv);
 error1:
@@ -641,7 +641,7 @@
 
        spin_lock_irqsave(&ib_smi_port_list_lock, flags);
        list_for_each_entry(entry, &ib_smi_port_list, port_list) {
-               if (entry->mad_agent->device == device && 
+               if (entry->dr_smp_mad_agent->device == device && 
                    entry->port_num == port_num) {
                        port_priv = entry;
                        break;
@@ -659,8 +659,8 @@
 
        ib_dereg_mr(port_priv->mr);
        ib_unregister_mad_agent(port_priv->pma_mad_agent);
-       ib_unregister_mad_agent(port_priv->mad_agent2);
-       ib_unregister_mad_agent(port_priv->mad_agent);
+       ib_unregister_mad_agent(port_priv->lr_smp_mad_agent);
+       ib_unregister_mad_agent(port_priv->dr_smp_mad_agent);
         kfree(port_priv);
 
        return 0;





More information about the general mailing list