netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Mengyuan Lou <mengyuanlou@net-swift.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 01/10] net: libwx: Add malibox api for wangxun pf drivers
Date: Mon, 5 Aug 2024 17:41:54 +0100	[thread overview]
Message-ID: <20240805164154.GJ2636630@kernel.org> (raw)
In-Reply-To: <78F07A41FB029765+20240804124841.71177-2-mengyuanlou@net-swift.com>

On Sun, Aug 04, 2024 at 08:48:32PM +0800, Mengyuan Lou wrote:
> Implements the mailbox interfaces for wangxun pf drivers
> ngbe and txgbe.
> 
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>

...

> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_mbx.c b/drivers/net/ethernet/wangxun/libwx/wx_mbx.c
> new file mode 100644
> index 000000000000..5062ddb2ce39
> --- /dev/null
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_mbx.c
> @@ -0,0 +1,175 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2015 - 2024 Beijing WangXun Technology Co., Ltd. */
> +#include <linux/pci.h>
> +#include "wx_type.h"
> +#include "wx_mbx.h"
> +
> +/**
> + *  wx_obtain_mbx_lock_pf - obtain mailbox lock
> + *  @wx: pointer to the HW structure
> + *  @vf: the VF index
> + *
> + *  return: return 0 on success and -EBUSY on failure
> + **/
> +static int wx_obtain_mbx_lock_pf(struct wx *wx, u16 vf)
> +{
> +	int count = 5;
> +	u32 mailbox;
> +
> +	while (count--) {
> +		/* Take ownership of the buffer */
> +		wr32(wx, WX_PXMAILBOX(vf), WX_PXMAILBOX_PFU);
> +
> +		/* reserve mailbox for vf use */
> +		mailbox = rd32(wx, WX_PXMAILBOX(vf));
> +		if (mailbox & WX_PXMAILBOX_PFU)
> +			return 0;
> +		else if (count != 1)

Should this be 'else if (count)' in order to skip the delay
on the last rather than 2nd to last iteration without success?

> +			udelay(10);
> +	}
> +	wx_err(wx, "Failed to obtain mailbox lock for PF%d", vf);
> +
> +	return -EBUSY;
> +}

...

  reply	other threads:[~2024-08-05 16:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240804124841.71177-1-mengyuanlou@net-swift.com>
2024-08-04 12:48 ` [PATCH net-next v5 01/10] net: libwx: Add malibox api for wangxun pf drivers Mengyuan Lou
2024-08-05 16:41   ` Simon Horman [this message]
2024-08-06 13:20   ` Przemek Kitszel
2024-08-04 12:48 ` [PATCH net-next v5 02/10] net: libwx: Add sriov api for wangxun nics Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 03/10] net: libwx: Redesign flow when sriov is enabled Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 04/10] net: libwx: Add msg task func Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 05/10] net: ngbe: add sriov function support Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 06/10] net: txgbe: " Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 07/10] net: libwx: allocate devlink for devlink port Mengyuan Lou
2024-08-05  6:40   ` kernel test robot
2024-08-05 16:41   ` Simon Horman
2024-08-06 11:37   ` Jiri Pirko
2024-08-04 12:48 ` [PATCH net-next v5 08/10] net: libwx: add eswitch switch api for devlink ops Mengyuan Lou
2024-08-05 16:43   ` Simon Horman
2024-08-06 11:42     ` Jiri Pirko
2024-08-07  7:41       ` mengyuanlou
2024-08-07 11:43         ` Jiri Pirko
2024-08-05 17:03   ` kernel test robot
2024-08-04 12:48 ` [PATCH net-next v5 09/10] net: txgbe: add devlink and devlink port created Mengyuan Lou
2024-08-06  7:27   ` kernel test robot
2024-08-04 12:48 ` [PATCH net-next v5 10/10] net: ngbe: " Mengyuan Lou
2024-08-06 11:43   ` Jiri Pirko

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=20240805164154.GJ2636630@kernel.org \
    --to=horms@kernel.org \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.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).