[openib-general] port num in port priv

Hal Rosenstock halr at voltaire.com
Thu Feb 9 09:21:55 PST 2006


Hi Suresh,

On Thu, 2006-02-09 at 10:40, Suresh Shelvapille wrote:
> Hi:
> 
> For a switch 

Note that this is some new ground for this code.

> only one port_priv object is created in mad.c.

A switch only has one port through which all MADs are processed (switch
port 0 (either base or enhanced)) so I think this is correct.

>  As a result, it appears like the process_mad function is always called with a port number of
> zero. 

That should be OK. The switch external port it was received on should be
in the ib_wc as follows:

struct ib_wc {
        u64                     wr_id;
        enum ib_wc_status       status;
        enum ib_wc_opcode       opcode;
        u32                     vendor_err;
        u32                     byte_len;
        __be32                  imm_data;
        u32                     qp_num;
        u32                     src_qp;
        int                     wc_flags;
        u16                     pkey_index;
        u16                     slid;
        u8                      sl;
        u8                      dlid_path_bits;
        u8                      port_num;       /* valid only for DR SMPs on switches */
};

and that is the one that needs to be used in the DR return path.

> And the return path is always filled with zero as well (in smi.c).

For switches, the one from the WC needs to be filled in and passed so
that sounds wrong and needs fixing. Do you want to take a crack at this
or should I ?

>  Should
> not this be the physical port number from which the mad packet came?  

Yes.

> Do I have to do something with the return path attributes when I send the
> packet out in my switch driver? I am using linux 2.6.12.

There haven't been any changes here since then that would affect this.

-- Hal

> Am I not reading something right?
> 
> Thanks,
> Suri
> 
> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general




More information about the general mailing list