public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: sunil.kovvuri@gmail.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, mkubecek@suse.cz,
	Sunil Goutham <sgoutham@marvell.com>,
	Geetha sowjanya <gakula@marvell.com>,
	Christina Jacob <cjacob@marvell.com>,
	Subbaraya Sundeep <sbhatta@marvell.com>,
	Aleksey Makarov <amakarov@marvell.com>
Subject: Re: [PATCH v4 02/17] octeontx2-pf: Mailbox communication with AF
Date: Tue, 21 Jan 2020 08:00:29 -0800	[thread overview]
Message-ID: <20200121080029.42b6ea7d@cakuba> (raw)
In-Reply-To: <1579612911-24497-3-git-send-email-sunil.kovvuri@gmail.com>

On Tue, 21 Jan 2020 18:51:36 +0530, sunil.kovvuri@gmail.com wrote:
> From: Sunil Goutham <sgoutham@marvell.com>
> 
> In the resource virtualization unit (RVU) each of the PF and AF
> (admin function) share a 64KB of reserved memory region for
> communication. This patch initializes PF <=> AF mailbox IRQs,
> registers handlers for processing these communication messages.
> Also adds support to process these messages in both directions
> ie responses to PF initiated DOWN (PF => AF) messages and AF
> initiated UP messages (AF => PF).
> 
> Mbox communication APIs and message formats are defined in AF driver
> (drivers/net/ethernet/marvell/octeontx2/af), mbox.h from AF driver is
> included here to avoid duplication.
> 
> Signed-off-by: Geetha sowjanya <gakula@marvell.com>
> Signed-off-by: Christina Jacob <cjacob@marvell.com>
> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
> Signed-off-by: Aleksey Makarov <amakarov@marvell.com>
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>

> +struct  mbox {
         ^^
> +	struct otx2_mbox	mbox;
> +	struct work_struct	mbox_wrk;
> +	struct otx2_mbox	mbox_up;
> +	struct work_struct	mbox_up_wrk;
> +	struct otx2_nic		*pfvf;
> +	void			*bbuf_base; /* Bounce buffer for mbox memory */
> +	struct mutex		lock;	/* serialize mailbox access */
> +	int			num_msgs; /*mbox number of messages*/
                                           ^                       ^
> +	int			up_num_msgs;/* mbox_up number of messages*/
                                            ^                            ^
> +};
>  
>  struct otx2_hw {
>  	struct pci_dev		*pdev;
>  	u16                     rx_queues;
>  	u16                     tx_queues;
>  	u16			max_queues;
> +
> +	/* MSI-X*/
                ^

The white space here is fairly loose 

> +	char			*irq_name;
> +	cpumask_var_t           *affinity_mask;
>  };
>  

> +static inline void otx2_sync_mbox_bbuf(struct otx2_mbox *mbox, int devid)
> +{
> +	u16 msgs_offset = ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN);
> +	void *hw_mbase = mbox->hwbase + (devid * MBOX_SIZE);
> +	struct otx2_mbox_dev *mdev = &mbox->dev[devid];
> +	struct mbox_hdr *hdr;
> +	u64 msg_size;
> +
> +	if (mdev->mbase == hw_mbase)
> +		return;
> +
> +	hdr = hw_mbase + mbox->rx_start;
> +	msg_size = hdr->msg_size;
> +
> +	if (msg_size > mbox->rx_size - msgs_offset)
> +		msg_size = mbox->rx_size - msgs_offset;
> +
> +	/* Copy mbox messages from mbox memory to bounce buffer */
> +	memcpy(mdev->mbase + mbox->rx_start,
> +	       hw_mbase + mbox->rx_start, msg_size + msgs_offset);

I'm slightly concerned about the use of non-iomem helpers like memset
and memcpy on what I understand to be IOMEM, and the lack of memory
barriers. But then again, I don't know much about iomem_wc(), is this
code definitely correct from memory ordering perspective?
(The memory barrier in otx2_mbox_msg_send() should probably be just
wmb(), syncing with HW is unrelated with SMP.)

  reply	other threads:[~2020-01-21 16:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 13:21 [PATCH v4 00/17] octeontx2-pf: Add network driver for physical function sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 01/17] octeontx2-pf: Add Marvell OcteonTX2 NIC driver sunil.kovvuri
2020-01-21 16:00   ` Jakub Kicinski
2020-01-21 13:21 ` [PATCH v4 02/17] octeontx2-pf: Mailbox communication with AF sunil.kovvuri
2020-01-21 16:00   ` Jakub Kicinski [this message]
2020-01-22 19:27     ` Sunil Kovvuri
2020-01-23 14:14       ` Jakub Kicinski
2020-01-24  8:33   ` Maciej Fijalkowski
2020-01-24 17:15     ` Sunil Kovvuri
2020-01-21 13:21 ` [PATCH v4 03/17] octeontx2-pf: Attach NIX and NPA block LFs sunil.kovvuri
2020-01-21 16:00   ` Jakub Kicinski
2020-01-22 19:27     ` Sunil Kovvuri
2020-01-21 13:21 ` [PATCH v4 04/17] octeontx2-pf: Initialize and config queues sunil.kovvuri
2020-01-21 16:00   ` Jakub Kicinski
2020-01-22 19:29     ` Sunil Kovvuri
2020-01-23 14:20       ` Jakub Kicinski
2020-01-24 11:21         ` Sunil Kovvuri
2020-01-21 13:21 ` [PATCH v4 05/17] octeontx2-pf: Setup interrupts and NAPI handler sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 06/17] octeontx2-pf: Receive packet handling support sunil.kovvuri
2020-01-21 16:33   ` Jakub Kicinski
2020-01-22 19:34     ` Sunil Kovvuri
2020-01-24 10:14   ` Maciej Fijalkowski
2020-01-21 13:21 ` [PATCH v4 07/17] octeontx2-pf: Add packet transmission support sunil.kovvuri
2020-01-21 16:54   ` Jakub Kicinski
2020-01-22 19:50     ` Sunil Kovvuri
2020-01-23 14:24       ` Jakub Kicinski
2020-01-21 13:21 ` [PATCH v4 08/17] octeontx2-pf: Register and handle link notifications sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 09/17] octeontx2-pf: MTU, MAC and RX mode config support sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 10/17] octeontx2-pf: Error handling support sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 11/17] octeontx2-pf: Receive side scaling support sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 12/17] octeontx2-pf: TCP segmentation offload support sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 13/17] octeontx2-pf: Add ndo_get_stats64 sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 14/17] octeontx2-pf: Add basic ethtool support sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 15/17] octeontx2-pf: ethtool RSS config support sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 16/17] Documentation: net: octeontx2: Add RVU HW and drivers overview sunil.kovvuri
2020-01-21 13:21 ` [PATCH v4 17/17] MAINTAINERS: Add entry for Marvell OcteonTX2 Physical Function driver sunil.kovvuri

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=20200121080029.42b6ea7d@cakuba \
    --to=kuba@kernel.org \
    --cc=amakarov@marvell.com \
    --cc=cjacob@marvell.com \
    --cc=davem@davemloft.net \
    --cc=gakula@marvell.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=sunil.kovvuri@gmail.com \
    /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