[openib-general] [PATCH] ib_smi: Add physical port count into agent private structure

Hal Rosenstock halr at voltaire.com
Wed Oct 13 06:25:30 PDT 2004


ib_smi: Add physical port count into agent private structure
(Needed by switch SMI to validate port number in initial/return paths)

Index: ib_smi_priv.h
===================================================================
--- ib_smi_priv.h       (revision 977)
+++ ib_smi_priv.h       (working copy)
@@ -41,6 +41,7 @@
        struct list_head send_posted_list;
        spinlock_t send_list_lock;
        int port_num;
+       int phys_port_cnt;
        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 */
Index: ib_smi.c
===================================================================
--- ib_smi.c    (revision 977)
+++ ib_smi.c    (working copy)
@@ -517,7 +517,8 @@
        ib_free_recv_mad(mad_recv_wc);
 }
 
-static int ib_agent_port_open(struct ib_device *device, int port_num)
+static int ib_agent_port_open(struct ib_device *device, int port_num,
+                             int num_ports)
 {
        int ret;
        u64 iova = 0;
@@ -555,6 +556,7 @@
 
        memset(port_priv, 0, sizeof *port_priv);
        port_priv->port_num = port_num;
+       port_priv->phys_port_cnt = num_ports;
        port_priv->wr_id = 0;
        spin_lock_init(&port_priv->send_list_lock);
        INIT_LIST_HEAD(&port_priv->send_posted_list);
@@ -688,7 +690,7 @@
        }
 
        for (i = 0; i < num_ports; i++, cur_port++) {
-               ret = ib_agent_port_open(device, cur_port);
+               ret = ib_agent_port_open(device, cur_port, num_ports);
                if (ret) {
                        printk(KERN_ERR SPFX "Couldn't open %s port
%d\n",
                               device->name, cur_port);





More information about the general mailing list