From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Mengyuan Lou'" <mengyuanlou@net-swift.com>, <netdev@vger.kernel.org>
Cc: <kuba@kernel.org>, <duanqiangwen@net-swift.com>
Subject: RE: [PATCH net-next v8 2/6] net: libwx: Add sriov api for wangxun nics
Date: Tue, 18 Mar 2025 17:36:34 +0800 [thread overview]
Message-ID: <01d201db97e9$3d50a0f0$b7f1e2d0$@trustnetic.com> (raw)
In-Reply-To: <20250309154252.79234-3-mengyuanlou@net-swift.com>
> +static int __wx_enable_sriov(struct wx *wx, u8 num_vfs)
> +{
> + int i, ret = 0;
> + u32 value = 0;
> +
> + set_bit(WX_FLAG_SRIOV_ENABLED, wx->flags);
> + wx_err(wx, "SR-IOV enabled with %d VFs\n", num_vfs);
> +
> + /* Enable VMDq flag so device will be set in VM mode */
> + set_bit(WX_FLAG_VMDQ_ENABLED, wx->flags);
> + if (!wx->ring_feature[RING_F_VMDQ].limit)
> + wx->ring_feature[RING_F_VMDQ].limit = 1;
> + wx->ring_feature[RING_F_VMDQ].offset = num_vfs;
> +
> + wx->vfinfo = kcalloc(num_vfs, sizeof(struct vf_data_storage),
> + GFP_KERNEL);
> + if (!wx->vfinfo)
> + return -ENOMEM;
> +
> + ret = wx_alloc_vf_macvlans(wx, num_vfs);
> + if (ret)
> + return ret;
> +
> + /* Initialize default switching mode VEB */
> + wr32m(wx, WX_PSR_CTL, WX_PSR_CTL_SW_EN, WX_PSR_CTL_SW_EN);
> +
> + for (i = 0; i < num_vfs; i++) {
> + /* enable spoof checking for all VFs */
> + wx->vfinfo[i].spoofchk_enabled = true;
> + wx->vfinfo[i].link_enable = true;
> + /* untrust all VFs */
> + wx->vfinfo[i].trusted = false;
> + /* set the default xcast mode */
> + wx->vfinfo[i].xcast_mode = WXVF_XCAST_MODE_NONE;
> + }
> +
> + if (wx->mac.type == wx_mac_sp) {
> + if (num_vfs < 32)
> + value = WX_CFG_PORT_CTL_NUM_VT_32;
> + else
> + value = WX_CFG_PORT_CTL_NUM_VT_64;
> + } else {
> + value = WX_CFG_PORT_CTL_NUM_VT_8;
> + }
For the intention of supporting AML devices,
switch (wx->mac.type) {
case wx_mac_sp:
case wx_mac_aml:
...
case wx_mac_em:
...
default:
...
}
> + wr32m(wx, WX_CFG_PORT_CTL,
> + WX_CFG_PORT_CTL_NUM_VT_MASK,
> + value);
> +
> + return ret;
> +}
> +
next prev parent reply other threads:[~2025-03-18 9:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 15:42 [PATCH net-next v8 0/6] add sriov support for wangxun NICs Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 1/6] net: libwx: Add mailbox api for wangxun pf drivers Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 2/6] net: libwx: Add sriov api for wangxun nics Mengyuan Lou
2025-03-16 13:22 ` Simon Horman
2025-03-17 6:34 ` mengyuanlou
2025-03-17 17:08 ` Simon Horman
2025-03-18 9:36 ` Jiawen Wu [this message]
2025-03-09 15:42 ` [PATCH net-next v8 3/6] net: libwx: Redesign flow when sriov is enabled Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 4/6] net: libwx: Add msg task func Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 5/6] net: ngbe: add sriov function support Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 6/6] net: txgbe: " Mengyuan Lou
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='01d201db97e9$3d50a0f0$b7f1e2d0$@trustnetic.com' \
--to=jiawenwu@trustnetic.com \
--cc=duanqiangwen@net-swift.com \
--cc=kuba@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).