DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 7/8] net/bnxt: fix HWRM_*() macros and locking
Date: Tue, 29 Aug 2017 17:12:15 +0100	[thread overview]
Message-ID: <939529d4-6cf4-381c-7f22-8d8881da33fb@intel.com> (raw)
In-Reply-To: <20170824162956.62761-9-ajit.khaparde@broadcom.com>

On 8/24/2017 5:29 PM, Ajit Khaparde wrote:
> Obtain the spinlock in HWRM_PREP()
> Eliminate two unnecessary arguments in HWRM_PREP().
> Unlock the spinlock before returning in HWRM_ERROR_CHECK()
> Add new HWRM_UNLOCK() macro
> Update usage of the thre macros.
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

<...>

> -#define HWRM_PREP(req, type, cr, resp) \
> +/*
> + * HWRM_PREP() should be used to prepare *ALL* HWRM commands.  It grabs the
> + * spinlock, and does initial processing.
> + *
> + * HWRM_CHECK_RESULT() returns errors on failure and may not be used.  It
> + * releases the spinlock only if it returns.  If the regular int return codes
> + * are not used by the function, HWRM_CHECK_RESULT() should not be used
> + * directly, rather it should be copied and modified to suit the function.
> + *
> + * HWRM_UNLOCK() must be called after all response processing is completed.
> + */
> +#define HWRM_PREP(x, type) do { \
> +	typeof(x) req = (x); \
> +	rte_spinlock_lock(&bp->hwrm_lock); \
>  	memset(bp->hwrm_cmd_resp_addr, 0, bp->max_resp_len); \
>  	req.req_type = rte_cpu_to_le_16(HWRM_##type); \
> -	req.cmpl_ring = rte_cpu_to_le_16(cr); \
> +	req.cmpl_ring = rte_cpu_to_le_16(-1); \
>  	req.seq_id = rte_cpu_to_le_16(bp->hwrm_cmd_seq++); \
>  	req.target_id = rte_cpu_to_le_16(0xffff); \
> -	req.resp_addr = rte_cpu_to_le_64(bp->hwrm_cmd_resp_dma_addr)
> +	req.resp_addr = rte_cpu_to_le_64(bp->hwrm_cmd_resp_dma_addr); \
> +} while (0)
>  

<...>

> -	HWRM_PREP(req, CFA_L2_SET_RX_MASK, -1, resp);
> +	HWRM_PREP(req, CFA_L2_SET_RX_MASK);

Getting following build error [1] many times with clang (and icc).
I guess this is because using variable name in macro itself.

[1]
.../drivers/net/bnxt/bnxt_hwrm.c:235:12: error: variable 'req' is
uninitialized when used within its own initialization
[-Werror,-Wuninitialized]

        HWRM_PREP(req, CFA_L2_SET_RX_MASK);
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
.../drivers/net/bnxt/bnxt_hwrm.c:186:19: note: expanded from macro
'HWRM_PREP'
        typeof(x) req = (x); \
                  ~~~    ^

  reply	other threads:[~2017-08-29 16:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 16:29 [dpdk-dev] [PATCH 0/8] bnxt patchset Ajit Khaparde
2017-08-24 16:29 ` [dpdk-dev] [PATCH 1/8] net/bnxt: add support for xstats get by id Ajit Khaparde
2017-08-29 16:10   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 2/8] net/bnxt: add support for rx_queue_count Ajit Khaparde
2017-08-29 16:10   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 3/8] net/bnxt: add support for rx_descriptor_status Ajit Khaparde
2017-08-29 16:11   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 4/8] net/bnxt: add support for rx_descriptor_done Ajit Khaparde
2017-08-29 16:11   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 5/8] net/bnxt: add support for tx_descriptor_status Ajit Khaparde
2017-08-29 16:12   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 6/8] net/bnxt: add new HWRM structures Ajit Khaparde
2017-08-24 16:29 ` [dpdk-dev] [PATCH 7/8] net/bnxt: fix HWRM_*() macros and locking Ajit Khaparde
2017-08-29 16:12   ` Ferruh Yigit [this message]
2017-08-24 16:29 ` [dpdk-dev] [PATCH 8/8] net/bnxt: add support for flow filter ops Ajit Khaparde
2017-08-29 16:16   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=939529d4-6cf4-381c-7f22-8d8881da33fb@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).