[openib-general] RE: [RFC] [PATCH] mad.c: Add support for switch SMI

Hal Rosenstock halr at voltaire.com
Mon Feb 13 14:03:17 PST 2006


On Mon, 2006-02-13 at 15:45, Suresh Shelvapille wrote:
> Sorry Hal:
> 
> But I don't understand...
>  
> > 
> > When create AH is called, it should be saved. It should be available
> > from the AV for this AH.
> >
> are you saying I should save the port number in ah_attr.port_num which is
> passed as a parameter to the create_ah(pd, ah_attr) method?

Yes.
 
> If so, ah_attr.port_num is set to mad_agent->port_num which is going to be
> zero on a switch!

Why ? The port_num in the ah_attr passed to create_ah needs to be set to
the switch external port number on the send side for switches:

struct ib_ah_attr {
        struct ib_global_route  grh;
        u16                     dlid;
        u8                      sl;
        u8                      src_path_bits;
        u8                      static_rate;
        u8                      ah_flags;
        u8                      port_num;
};

It would be filled in from the send_wr which is posted (see ib_post_send_mad).

struct ib_send_wr {
        struct ib_send_wr      *next;
        u64                     wr_id;
        struct ib_sge          *sg_list;
        int                     num_sge;
        enum ib_wr_opcode       opcode;
        int                     send_flags;
        __be32                  imm_data;
        union {
...
                struct {
                        struct ib_ah *ah;
                        u32     remote_qpn;
                        u32     remote_qkey;
                        u16     pkey_index; /* valid for GSI only */
                        u8      port_num;   /* valid for DR SMPs on switch only */
                } ud;
        } wr;
};

On the receive side, it comes from the WC:

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 */
};

If you are seeing this called with port_num 0, I missed another place
where this should be set. Is that what you are saying ?

> Otherwise, if you are saying I should determine this in create_ah() and save
> it then I would need access to init_path, return_path etc....right??

That's not what I'm saying.

-- Hal

> Thanks a lot,
> Suri
> 




More information about the general mailing list