Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1260801 > unrolled thread

Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support

Started byJohn Garry <john.garry@huawei.com>
First post2015-11-02 18:10 +0100
Last post2015-11-03 13:40 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support John Garry <john.garry@huawei.com> - 2015-11-02 18:10 +0100
    Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support Arnd Bergmann <arnd@arndb.de> - 2015-11-02 21:40 +0100
      Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support John Garry <john.garry@huawei.com> - 2015-11-03 12:50 +0100
        Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support Arnd Bergmann <arnd@arndb.de> - 2015-11-03 13:40 +0100

#1260801 — Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support

FromJohn Garry <john.garry@huawei.com>
Date2015-11-02 18:10 +0100
SubjectRe: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support
Message-ID<qqqMj-80G-23@gated-at.bofh.it>
On 30/10/2015 16:22, John Garry wrote:
> On 30/10/2015 13:53, Arnd Bergmann wrote:
>> On Monday 26 October 2015 22:14:58 John Garry wrote:
>>
>>> +       /*
>>> +       * DMA-map SMP request, response buffers
>>> +       */
>>> +       /* req */
>>> +       sg_req = &task->smp_task.smp_req;
>>> +       elem = dma_map_sg(dev, sg_req, 1, DMA_TO_DEVICE);
>>> +       if (!elem)
>>> +               return -ENOMEM;
>>> +       req_len = sg_dma_len(sg_req);
>>> +       req_dma_addr = sg_dma_address(sg_req);
>>
>> If you only use the first element, could you just use dma_map_single()?
>>
>
> Can do. Actually sg_req seems only ever has one element:
> expander.c, smp_execute_task()
> sg_init_one(&task->smp_task.smp_req, req, req_size);
>
>
I tried replacing with dma_map_single, but I feel the code is not as 
clean as I need to manually set sg_dma_len() and sg_dma_address():
     req_len = sg_dma_len(sg_req) = sg_req->length;
     sg_dma_address(sg_req) = dma_map_single(dev, sg_virt(sg_req),
  					 req_len, DMA_TO_DEVICE);
     if (dma_mapping_error(dev, sg_dma_address(sg_req)))
          return -ENOMEM;
sg_dma_address(sg_req) is used in another function for unmap.

opinion?
>
>
> _______________________________________________
> linuxarm mailing list
> linuxarm@huawei.com
> http://rnd-openeuler.huawei.com/mailman/listinfo/linuxarm
>
> .
>


cheers,
John

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1260945

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-02 21:40 +0100
Message-ID<qqu3v-1uH-1@gated-at.bofh.it>
In reply to#1260801
On Monday 02 November 2015 17:03:58 John Garry wrote:
> >
> > Can do. Actually sg_req seems only ever has one element:
> > expander.c, smp_execute_task()
> > sg_init_one(&task->smp_task.smp_req, req, req_size);
> >
> >
> I tried replacing with dma_map_single, but I feel the code is not as 
> clean as I need to manually set sg_dma_len() and sg_dma_address():
>      req_len = sg_dma_len(sg_req) = sg_req->length;
>      sg_dma_address(sg_req) = dma_map_single(dev, sg_virt(sg_req),
>                                          req_len, DMA_TO_DEVICE);
>      if (dma_mapping_error(dev, sg_dma_address(sg_req)))
>           return -ENOMEM;
> sg_dma_address(sg_req) is used in another function for unmap.
> 
> opinion?
> 

What I meant was not using a struct scatterlist at all:
replace the 'sg_req' variable with a normal pointer, and then
do

	hdr->cmd_table_addr = cpu_to_le64(dma_map_single(dev, req, len, DMA_TO_DEVICE));

Any reason this won't work?

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1261434

FromJohn Garry <john.garry@huawei.com>
Date2015-11-03 12:50 +0100
Message-ID<qqIga-2a9-19@gated-at.bofh.it>
In reply to#1260945
On 02/11/2015 20:29, Arnd Bergmann wrote:
> On Monday 02 November 2015 17:03:58 John Garry wrote:
>>>
>>> Can do. Actually sg_req seems only ever has one element:
>>> expander.c, smp_execute_task()
>>> sg_init_one(&task->smp_task.smp_req, req, req_size);
>>>
>>>
>> I tried replacing with dma_map_single, but I feel the code is not as
>> clean as I need to manually set sg_dma_len() and sg_dma_address():
>>       req_len = sg_dma_len(sg_req) = sg_req->length;
>>       sg_dma_address(sg_req) = dma_map_single(dev, sg_virt(sg_req),
>>                                           req_len, DMA_TO_DEVICE);
>>       if (dma_mapping_error(dev, sg_dma_address(sg_req)))
>>            return -ENOMEM;
>> sg_dma_address(sg_req) is used in another function for unmap.
>>
>> opinion?
>>
>
> What I meant was not using a struct scatterlist at all:
> replace the 'sg_req' variable with a normal pointer, and then
> do
>
> 	hdr->cmd_table_addr = cpu_to_le64(dma_map_single(dev, req, len, DMA_TO_DEVICE));
>
> Any reason this won't work?
>
> 	Arnd
>
> .
>
There seems to be some misunderstanding. Are you suggesting I change 
sas_smp_task?
./include/scsi/libsas.h
struct sas_smp_task {
	struct scatterlist smp_req;
	struct scatterlist smp_resp;
};

thanks,
John

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1261453

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-03 13:40 +0100
Message-ID<qqJ2x-2Hl-7@gated-at.bofh.it>
In reply to#1261434
On Tuesday 03 November 2015 11:42:30 John Garry wrote:
> >
> There seems to be some misunderstanding. Are you suggesting I change 
> sas_smp_task?
> ./include/scsi/libsas.h
> struct sas_smp_task {
>         struct scatterlist smp_req;
>         struct scatterlist smp_resp;
> };
> 

Ah, no. I had not realized this comes from another file.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web