[ofa-general] Re: [PATCHv2] ibsim: Support short RMPP packets

Hal Rosenstock hrosenstock at xsigo.com
Mon Jun 23 06:53:46 PDT 2008


On Fri, 2008-06-20 at 20:58 +0300, Sasha Khapyorsky wrote:
> On 07:35 Thu 19 Jun     , Hal Rosenstock wrote:
> > ibsim: Support for short RMPP packets (up thru 256 bytes total)
> > 
> > Changes from v1:
> > - Added length to simulation header (by reducing context size so as not
> > to break ABI) and encoded length on sends and decoded and checked
> > lengths on receive
> 
> RMPP supports transactions up to 2^^32 256 byte packets in size. 

Not quite 256 and depends on RMPP "mode" in use.

> So length must be more that 32-bit (or later we will need to break ABI).

OK but not sure this is really supported. Also, 64 bits is overkill for
length.

> Also it should transferred in network byte order.
> 
> > - Restored short/partial packet read check in umad2sim_read
> > - In umad2sim_write, fixed setting of umad->length
> > - Eliminated sim_req256 typedef
> 
> Entire patch still be huge for what it tries to accomplish, I think it
> is mostly due to "to malloc()" and data types conversions and it still
> unclear for me why it was needed if packets are limited in size anyway.

Because there were additional changes to get ready for long RMPP but
they can wait.

> For me it looks that something simpler like a patch below will do the
> same. What do you think?

An additional change is needed to umad2sim/umad2sim.c:

@@ -425,7 +425,7 @@ static ssize_t umad2sim_read(struct umad2sim_dev *dev, void 
                cnt = count - umad_size();
        memcpy(umad_get_mad(umad), req.mad, cnt);
 
-       return cnt + umad_size();
+       return umad->length;
 }

-- Hal

> Sasha
> 
> 
> diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
> index 675d95b..6c5add9 100644
> --- a/ibsim/sim_mad.c
> +++ b/ibsim/sim_mad.c
> @@ -1306,7 +1306,7 @@ int send_trap(Port * port, int trapnum)
>  	req.sqp = 0;
>  	req.dqp = 0;
>  	req.status = 0;
> -	req.context = 0;
> +	req.length = htonll(sizeof(req.mad));
>  
>  	// find SM client
>  	cl = find_client(destport, 0, 1, 0);
> diff --git a/include/ibsim.h b/include/ibsim.h
> index 84568e6..ba1e3dd 100644
> --- a/include/ibsim.h
> +++ b/include/ibsim.h
> @@ -67,7 +67,7 @@ struct sim_request {
>  	uint32_t dqp;
>  	uint32_t sqp;
>  	uint32_t status;
> -	uint64_t context;
> +	uint64_t length;
>  	char mad[256];
>  };
>  
> diff --git a/umad2sim/umad2sim.c b/umad2sim/umad2sim.c
> index 4cbf8da..f8fa50a 100644
> --- a/umad2sim/umad2sim.c
> +++ b/umad2sim/umad2sim.c
> @@ -411,7 +411,7 @@ static ssize_t umad2sim_read(struct umad2sim_dev *dev, void *buf, size_t count)
>  	umad->status = ntohl(req.status);
>  	umad->timeout_ms = 0;
>  	umad->retries = 0;
> -	umad->length = umad_size() + sizeof(req.mad);
> +	umad->length = umad_size() + ntohll(req.length);
>  
>  	umad->addr.qpn = req.sqp;
>  	umad->addr.qkey = 0;	// agent->qkey;
> @@ -470,13 +470,14 @@ static ssize_t umad2sim_write(struct umad2sim_dev *dev,
>  	req.dqp = umad->addr.qpn;
>  	req.sqp = htonl(dev->agents[umad->agent_id].qpn);
>  	req.status = 0;
> -	req.context = 0;
>  
>  	cnt = count - umad_size();
>  	if (cnt > sizeof(req.mad))
>  		cnt = sizeof(req.mad);
>  	memcpy(req.mad, umad_get_mad(umad), cnt);
>  
> +	req.length = htonll(cnt);
> +
>  	cnt = write(dev->sim_client.fd_pktout, (void *)&req, sizeof(req));
>  	if (cnt < 0) {
>  		ERROR("umad2sim_write: cannot write\n");
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general




More information about the general mailing list