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


Groups > linux.kernel > #1574994

Re: [PATCH 5/6] dmaengine: Add Broadcom SBA RAID driver

From Vinod Koul <vinod.koul@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/6] dmaengine: Add Broadcom SBA RAID driver
Date 2017-02-06 18:00 +0100
Message-ID <t7UNZ-7sP-23@gated-at.bofh.it> (permalink)
References <t6hvj-7m6-7@gated-at.bofh.it> <t6hvj-7m6-21@gated-at.bofh.it> <t7obn-3sh-1@gated-at.bofh.it> <t7Qhk-4M3-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Feb 06, 2017 at 05:31:15PM +0530, Anup Patel wrote:

> >> +
> >> +/* SBA C_MDATA helper macros */
> >> +#define SBA_C_MDATA_LOAD_VAL(__bnum0)                ((__bnum0) & 0x3)
> >> +#define SBA_C_MDATA_WRITE_VAL(__bnum0)               ((__bnum0) & 0x3)
> >> +#define SBA_C_MDATA_XOR_VAL(__bnum1, __bnum0)                        \
> >> +                     ({      u32 __v = ((__bnum0) & 0x3);    \
> >> +                             __v |= ((__bnum1) & 0x3) << 2;  \
> >> +                             __v;                            \
> >> +                     })
> >> +#define SBA_C_MDATA_PQ_VAL(__dnum, __bnum1, __bnum0)         \
> >> +                     ({      u32 __v = ((__bnum0) & 0x3);    \
> >> +                             __v |= ((__bnum1) & 0x3) << 2;  \
> >> +                             __v |= ((__dnum) & 0x1f) << 5;  \
> >> +                             __v;                            \
> >> +                     })
> >
> > ah why are we usig complex macros, why can't these be simple functions..
> 
> "static inline functions" seemed too complicated here because most of
> these macros are two lines of c-code.

and thats where I have an issue with this. Macros for simple things is fine
but not for couple of line of logic!

> 
> Do you still insist on using "static inline functions"?

Yes

> 
> >
> >> +#define SBA_C_MDATA_LS(__c_mdata_val)        ((__c_mdata_val) & 0xff)
> >> +#define SBA_C_MDATA_MS(__c_mdata_val)        (((__c_mdata_val) >> 8) & 0x3)
> >> +
> >> +/* Driver helper macros */
> >> +#define to_sba_request(tx)           \
> >> +     container_of(tx, struct sba_request, tx)
> >> +#define to_sba_device(dchan)         \
> >> +     container_of(dchan, struct sba_device, dma_chan)
> >> +
> >> +enum sba_request_state {
> >> +     SBA_REQUEST_STATE_FREE = 1,
> >> +     SBA_REQUEST_STATE_ALLOCED = 2,
> >> +     SBA_REQUEST_STATE_PENDING = 3,
> >> +     SBA_REQUEST_STATE_ACTIVE = 4,
> >> +     SBA_REQUEST_STATE_COMPLETED = 5,
> >> +     SBA_REQUEST_STATE_ABORTED = 6,
> >
> > whats up with a very funny indentation setting, we use 8 chars.
> >
> > Please re-read the Documentation/process/coding-style.rst
> 
> I have double checked this enum. The indentation is fine
> and as-per coding style. Am I missing anything else?

Somehow the initial indent doesnt seem to be 8 chars to me.

> >> +static enum dma_status sba_tx_status(struct dma_chan *dchan,
> >> +                                  dma_cookie_t cookie,
> >> +                                  struct dma_tx_state *txstate)
> >> +{
> >> +     int mchan_idx;
> >> +     enum dma_status ret;
> >> +     struct sba_device *sba = to_sba_device(dchan);
> >> +
> >> +     ret = dma_cookie_status(dchan, cookie, txstate);
> >> +     if (ret == DMA_COMPLETE)
> >> +             return ret;
> >> +
> >> +     for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++)
> >> +             mbox_client_peek_data(sba->mchans[mchan_idx]);
> >
> > what is this achieving?
> 
> The mbox_client_peek_data() is a hint to mailbox controller driver
> to check for available messages.
> 
> This gives good performance improvement when some DMA client
> code is polling using tx_status() callback.

Then why do it before and then check status.

-- 
~Vinod

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Broadcom SBA RAID support Anup Patel <anup.patel@broadcom.com> - 2017-02-02 05:50 +0100
  [PATCH 3/6] async_tx: Handle DMA devices having support for fewer PQ coefficients Anup Patel <anup.patel@broadcom.com> - 2017-02-02 05:50 +0100
    Re: [PATCH 3/6] async_tx: Handle DMA devices having support for fewer  PQ coefficients Dan Williams <dan.j.williams@intel.com> - 2017-02-02 07:10 +0100
      Re: [PATCH 3/6] async_tx: Handle DMA devices having support for fewer  PQ coefficients Anup Patel <anup.patel@broadcom.com> - 2017-02-03 12:10 +0100
      Re: [PATCH 3/6] async_tx: Handle DMA devices having support for fewer  PQ coefficients Dan Williams <dan.j.williams@intel.com> - 2017-02-03 19:50 +0100
        Re: [PATCH 3/6] async_tx: Handle DMA devices having support for fewer  PQ coefficients Anup Patel <anup.patel@broadcom.com> - 2017-02-06 05:00 +0100
  [PATCH 1/6] mailbox: Add new API mbox_channel_device() for clients Anup Patel <anup.patel@broadcom.com> - 2017-02-02 05:50 +0100
    Re: [PATCH 1/6] mailbox: Add new API mbox_channel_device() for clients Jassi Brar <jassisinghbrar@gmail.com> - 2017-02-03 13:10 +0100
      Re: [PATCH 1/6] mailbox: Add new API mbox_channel_device() for clients Anup Patel <anup.patel@broadcom.com> - 2017-02-06 05:30 +0100
  [PATCH 4/6] async_tx: Fix DMA_PREP_FENCE usage in do_async_gen_syndrome() Anup Patel <anup.patel@broadcom.com> - 2017-02-02 05:50 +0100
  [PATCH 6/6] dt-bindings: Add DT bindings document for Broadcom SBA RAID driver Anup Patel <anup.patel@broadcom.com> - 2017-02-02 05:50 +0100
  Re: [PATCH 5/6] dmaengine: Add Broadcom SBA RAID driver Vinod Koul <vinod.koul@intel.com> - 2017-02-05 07:10 +0100
    Re: [PATCH 5/6] dmaengine: Add Broadcom SBA RAID driver Anup Patel <anup.patel@broadcom.com> - 2017-02-06 13:10 +0100
      Re: [PATCH 5/6] dmaengine: Add Broadcom SBA RAID driver Vinod Koul <vinod.koul@intel.com> - 2017-02-06 18:00 +0100
        Re: [PATCH 5/6] dmaengine: Add Broadcom SBA RAID driver Anup Patel <anup.patel@broadcom.com> - 2017-02-07 07:10 +0100

csiph-web