From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Fan Gong <gongfan1@huawei.com>,
Zhu Yikai <zhuyikai1@h-partners.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Markus.Elfring@web.de, pavan.chebbi@broadcom.com
Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
luosifu <luosifu@huawei.com>, Xin Guo <guoxin09@huawei.com>,
Shen Chenyang <shenchenyang1@hisilicon.com>,
Zhou Shuai <zhoushuai28@huawei.com>, Wu Like <wulike1@huawei.com>,
Shi Jing <shijing34@huawei.com>,
Luo Yang <luoyang82@h-partners.com>,
Meny Yossefi <meny.yossefi@huawei.com>,
Gur Stavi <gur.stavi@huawei.com>
Subject: Re: [External] : [PATCH net-next v05 1/5] hinic3: Add PF framework
Date: Thu, 6 Nov 2025 19:49:40 +0530 [thread overview]
Message-ID: <2321cbe4-e704-4c19-9d0d-92011f768178@oracle.com> (raw)
In-Reply-To: <ef0ccf58f3c32c16a21ac83e8159a529bc87c2d8.1762414088.git.zhuyikai1@h-partners.com>
> +
> +void hinic3_sync_time_to_fw(struct hinic3_hwdev *hwdev)
> +{
> + struct timespec64 ts = {};
> + u64 time;
> + int err;
> +
> + ktime_get_real_ts64(&ts);
> + time = (u64)(ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC);
> +
> + err = hinic3_sync_time(hwdev, time);
> + if (err)
> + dev_err(hwdev->dev,
> + "Synchronize UTC time to firmware failed, errno:%d.\n",
what about "failed, err=%d\n" ?
> + err);
> +}
> +
> static int get_hw_rx_buf_size_idx(int rx_buf_sz, u16 *buf_sz_idx)
> {
> /* Supported RX buffer sizes in bytes. Configured by array index. */
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_hw_comm.h b/drivers/net/ethernet/huawei/hinic3/hinic3_hw_comm.h
> index 304f5691f0c2..c9c6b4fbcb12 100644
>
> err = hinic3_mapping_bar(pdev, pci_adapter);
> @@ -331,8 +362,24 @@ static int hinic3_probe_func(struct hinic3_pcidev *pci_adapter)
> if (err)
> goto err_unmap_bar;
>
> + if (HINIC3_IS_PF(pci_adapter->hwdev)) {
> + bdf_info.function_idx =
> + hinic3_global_func_id(pci_adapter->hwdev);
> + bdf_info.bus = pdev->bus->number;
> + bdf_info.device = PCI_SLOT(pdev->devfn);
> + bdf_info.function = PCI_FUNC(pdev->devfn);
> +
> + err = hinic3_set_bdf_ctxt(pci_adapter->hwdev, &bdf_info);
> + if (err) {
> + dev_err(&pdev->dev, "Failed to set BDF info to fw\n");
> + goto err_uninit_func;
> + }
> + }
> +
> return 0;
>
> +err_uninit_func:
> + hinic3_func_uninit(pdev);
> err_unmap_bar:
> hinic3_unmapping_bar(pci_adapter);
>
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c
> index 6d87d4d895ba..a7c9c5bca53a 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c
> @@ -130,6 +130,7 @@ static int hinic3_sw_init(struct net_device *netdev)
> {
> struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> struct hinic3_hwdev *hwdev = nic_dev->hwdev;
> + u8 mac_addr[ETH_ALEN];
> int err;
>
> nic_dev->q_params.sq_depth = HINIC3_SQ_DEPTH;
> @@ -137,16 +138,29 @@ static int hinic3_sw_init(struct net_device *netdev)
>
> hinic3_try_to_enable_rss(netdev);
>
> - /* VF driver always uses random MAC address. During VM migration to a
> - * new device, the new device should learn the VMs old MAC rather than
> - * provide its own MAC. The product design assumes that every VF is
> - * suspectable to migration so the device avoids offering MAC address
> - * to VFs.
> - */
> - eth_hw_addr_random(netdev);
> + if (HINIC3_IS_VF(hwdev)) {
> + /* VF driver always uses random MAC address. During VM migration
> + * to a new device, the new device should learn the VMs old MAC
> + * rather than provide its own MAC. The product design assumes
> + * that every VF is suspectable to migration so the device
susceptible ?
> + * avoids offering MAC address to VFs.
> + */
> + eth_hw_addr_random(netdev);
> + } else {
> + err = hinic3_get_default_mac(hwdev, mac_addr);
> + if (err) {
> + dev_err(hwdev->dev, "Failed to get MAC address\n");
> + goto err_clear_rss_config;
> + }
> + eth_hw_addr_set(netdev, mac_addr);
> + }
> +
> err = hinic3_set_mac(hwdev, netdev->dev_addr, 0,
> hinic3_global_func_id(hwdev));
> - if (err) {
> + /* Failure to set MAC is not a fatal error for VF since its MAC may have
> + * already been set by PF
> + */
> + if (err && err != -EADDRINUSE) {
> dev_err(hwdev->dev, "Failed to set default MAC\n");
> goto err_clear_rss_config;
> }
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c b/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c
> index cf67e26acece..b4e151e88a13 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c
> @@ -82,10 +82,27 @@ static struct hinic3_msg_desc *get_mbox_msg_desc(struct hinic3_mbox *mbox,
> enum mbox_msg_direction_type dir,
> u16 src_func_id)
> {
> + struct hinic3_hwdev *hwdev = mbox->hwdev;
> struct hinic3_msg_channel *msg_ch;
> -
> - msg_ch = (src_func_id == MBOX_MGMT_FUNC_ID) ?
> - &mbox->mgmt_msg : mbox->func_msg;
> + u16 id;
> +
> + if (src_func_id == MBOX_MGMT_FUNC_ID) {
> + msg_ch = &mbox->mgmt_msg;
> + } else if (HINIC3_IS_VF(hwdev)) {
> + /* message from pf */
> + msg_ch = mbox->func_msg;
> + if (src_func_id != hinic3_pf_id_of_vf(hwdev) || !msg_ch)
> + return NULL;
> + } else if (src_func_id > hinic3_glb_pf_vf_offset(hwdev)) {
> + /* message from vf */
> + id = (src_func_id - 1) - hinic3_glb_pf_vf_offset(hwdev);
> + if (id >= 1)
> + return NULL;
hard coding id >= 1, is only one VF supported?
> +
> + msg_ch = &mbox->func_msg[id];
> + } else {
> + return NULL;
> + }
>
> return (dir == MBOX_MSG_SEND) ?
> &msg_ch->recv_msg : &msg_ch->resp_msg;
> @@ -409,6 +426,13 @@ int hinic3_init_mbox(struct hinic3_hwdev *hwdev)
> if (err)
> goto err_destroy_workqueue;
>
> + if (HINIC3_IS_VF(hwdev)) {
> + /* VF to PF mbox message channel */
> + err = hinic3_init_func_mbox_msg_channel(hwdev);
> + if (err)
> + goto err_uninit_mgmt_msg_ch;
> + }
> +
> err = hinic3_init_func_mbox_msg_channel(hwdev);
is hinic3_init_func* second init for PF and
VF executes both calls, is that correct?
> if (err)
> goto err_uninit_mgmt_msg_ch;
> @@ -424,8 +448,8 @@ int hinic3_init_mbox(struct hinic3_hwdev *hwdev)
> return 0;
>
> err_uninit_func_mbox_msg_ch:
> - hinic3_uninit_func_mbox_msg_channel(hwdev);
> -
> + if (HINIC3_IS_VF(hwdev))
> + hinic3_uninit_func_mbox_msg_channel(hwdev);
> err_uninit_mgmt_msg_ch:
> uninit_mgmt_msg_channel(mbox);
>
Thanks,
Alok
next prev parent reply other threads:[~2025-11-06 14:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 11:15 [PATCH net-next v05 0/5] net: hinic3: PF initialization Fan Gong
2025-11-06 11:15 ` [PATCH net-next v05 1/5] hinic3: Add PF framework Fan Gong
2025-11-06 14:19 ` ALOK TIWARI [this message]
2025-11-07 8:26 ` [External] : " Fan Gong
2025-11-06 11:15 ` [PATCH net-next v05 2/5] hinic3: Add PF management interfaces Fan Gong
2025-11-06 14:33 ` [External] : " ALOK TIWARI
2025-11-06 11:15 ` [PATCH net-next v05 3/5] hinic3: Add NIC configuration ops Fan Gong
2025-11-06 19:14 ` [External] : " ALOK TIWARI
2025-11-06 11:15 ` [PATCH net-next v05 4/5] hinic3: Add mac filter ops Fan Gong
2025-11-06 19:44 ` [External] : " ALOK TIWARI
2025-11-06 11:15 ` [PATCH net-next v05 5/5] hinic3: Add netdev register interfaces Fan Gong
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=2321cbe4-e704-4c19-9d0d-92011f768178@oracle.com \
--to=alok.a.tiwari@oracle.com \
--cc=Markus.Elfring@web.de \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gongfan1@huawei.com \
--cc=guoxin09@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luosifu@huawei.com \
--cc=luoyang82@h-partners.com \
--cc=meny.yossefi@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=shenchenyang1@hisilicon.com \
--cc=shijing34@huawei.com \
--cc=wulike1@huawei.com \
--cc=zhoushuai28@huawei.com \
--cc=zhuyikai1@h-partners.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.