[openib-general] port num in port priv

Hal Rosenstock halr at voltaire.com
Thu Feb 9 14:43:23 PST 2006


Hi Suresh,

On Thu, 2006-02-09 at 17:22, Suresh Shelvapille wrote:
> Hal:
> 
> I am only addressing the process_mad issue here:
> 
>  
> 
> > >  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.
> > 
> [SS]  if we are supposed to get the port num from the ib_wc, in
> process_mad(0) I can do that for all SMP methods such as getportinfo()
> etc...
> But, the ib_wc parameter is null when process_mad is called from
> show_pma_counter() function in sysfs.c?

PMA uses LR (LID routed) rather than DR packets. LR packets do not fill
in port number. Note that there are both LR and DR SMPs. port_num is
only valid for DR SMPs.

> So should I be switching between the port_num parameter vs. sib_wc->port_num
> depending on whether ib_wc is NULL or not?

I think the driver needs to fill in the port_num field in the ib_wc and
this is only needed for DR SMPs (as the comment indicates).

-- Hal




More information about the general mailing list