From: Yufeng Mo <moyufeng@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <shenjian15@huawei.com>,
<lipeng321@huawei.com>, <yisen.zhuang@huawei.com>,
<linyunsheng@huawei.com>, <huangguangbin2@huawei.com>,
<chenhao288@hisilicon.com>, <salil.mehta@huawei.com>,
<moyufeng@huawei.com>, <linuxarm@huawei.com>,
<linuxarm@openeuler.org>, <dledford@redhat.com>, <jgg@ziepe.ca>,
<netanel@amazon.com>, <akiyano@amazon.com>,
<thomas.lendacky@amd.com>, <irusskikh@marvell.com>,
<michael.chan@broadcom.com>, <edwin.peer@broadcom.com>,
<rohitm@chelsio.com>, <jacob.e.keller@intel.com>,
<ioana.ciornei@nxp.com>, <vladimir.oltean@nxp.com>,
<sgoutham@marvell.com>, <sbhatta@marvell.com>,
<saeedm@nvidia.com>, <ecree.xilinx@gmail.com>,
<grygorii.strashko@ti.com>, <merez@codeaurora.org>,
<kvalo@codeaurora.org>, <linux-wireless@vger.kernel.org>
Subject: [PATCH V3 net-next 4/4] net: hns3: add ethtool support for CQE/EQE mode configuration
Date: Fri, 20 Aug 2021 15:35:20 +0800 [thread overview]
Message-ID: <1629444920-25437-5-git-send-email-moyufeng@huawei.com> (raw)
In-Reply-To: <1629444920-25437-1-git-send-email-moyufeng@huawei.com>
Add support in ethtool for switching EQE/CQE mode.
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 +++---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 3 +++
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 18 +++++++++++++++++-
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 1bd83d7..39d01ca 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -5055,9 +5055,9 @@ static void hns3_set_cq_period_mode(struct hns3_nic_priv *priv,
}
}
-static void hns3_cq_period_mode_init(struct hns3_nic_priv *priv,
- enum dim_cq_period_mode tx_mode,
- enum dim_cq_period_mode rx_mode)
+void hns3_cq_period_mode_init(struct hns3_nic_priv *priv,
+ enum dim_cq_period_mode tx_mode,
+ enum dim_cq_period_mode rx_mode)
{
hns3_set_cq_period_mode(priv, tx_mode, true);
hns3_set_cq_period_mode(priv, rx_mode, false);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index ff45825..dfad906 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -718,4 +718,7 @@ void hns3_dbg_register_debugfs(const char *debugfs_dir_name);
void hns3_dbg_unregister_debugfs(void);
void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size);
u16 hns3_get_max_available_channels(struct hnae3_handle *h);
+void hns3_cq_period_mode_init(struct hns3_nic_priv *priv,
+ enum dim_cq_period_mode tx_mode,
+ enum dim_cq_period_mode rx_mode);
#endif
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 049be076..b8d9851 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1203,6 +1203,11 @@ static int hns3_get_coalesce(struct net_device *netdev,
cmd->tx_max_coalesced_frames = tx_coal->int_ql;
cmd->rx_max_coalesced_frames = rx_coal->int_ql;
+ kernel_coal->use_cqe_mode_tx = (priv->tx_cqe_mode ==
+ DIM_CQ_PERIOD_MODE_START_FROM_CQE);
+ kernel_coal->use_cqe_mode_rx = (priv->rx_cqe_mode ==
+ DIM_CQ_PERIOD_MODE_START_FROM_CQE);
+
return 0;
}
@@ -1372,6 +1377,8 @@ static int hns3_set_coalesce(struct net_device *netdev,
struct hns3_enet_coalesce *tx_coal = &priv->tx_coal;
struct hns3_enet_coalesce *rx_coal = &priv->rx_coal;
u16 queue_num = h->kinfo.num_tqps;
+ enum dim_cq_period_mode tx_mode;
+ enum dim_cq_period_mode rx_mode;
int ret;
int i;
@@ -1397,6 +1404,14 @@ static int hns3_set_coalesce(struct net_device *netdev,
for (i = 0; i < queue_num; i++)
hns3_set_coalesce_per_queue(netdev, cmd, i);
+ tx_mode = kernel_coal->use_cqe_mode_tx ?
+ DIM_CQ_PERIOD_MODE_START_FROM_CQE :
+ DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ rx_mode = kernel_coal->use_cqe_mode_rx ?
+ DIM_CQ_PERIOD_MODE_START_FROM_CQE :
+ DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ hns3_cq_period_mode_init(priv, tx_mode, rx_mode);
+
return 0;
}
@@ -1702,7 +1717,8 @@ static int hns3_set_tunable(struct net_device *netdev,
ETHTOOL_COALESCE_USE_ADAPTIVE | \
ETHTOOL_COALESCE_RX_USECS_HIGH | \
ETHTOOL_COALESCE_TX_USECS_HIGH | \
- ETHTOOL_COALESCE_MAX_FRAMES)
+ ETHTOOL_COALESCE_MAX_FRAMES | \
+ ETHTOOL_COALESCE_USE_CQE)
static int hns3_get_ts_info(struct net_device *netdev,
struct ethtool_ts_info *info)
--
2.8.1
next prev parent reply other threads:[~2021-08-20 7:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 7:35 [PATCH V3 net-next 0/4] ethtool: extend coalesce uAPI Yufeng Mo
2021-08-20 7:35 ` [PATCH V3 net-next 1/4] ethtool: add two coalesce attributes for CQE mode Yufeng Mo
2021-08-20 7:35 ` [PATCH V3 net-next 2/4] ethtool: extend coalesce setting uAPI with " Yufeng Mo
2021-08-20 18:27 ` Grygorii Strashko
2021-08-20 22:21 ` Jakub Kicinski
2021-08-23 3:06 ` moyufeng
2021-08-24 3:14 ` moyufeng
2021-09-14 17:31 ` Julian Wiedmann
2021-09-14 17:47 ` Jakub Kicinski
2021-08-20 7:35 ` [PATCH V3 net-next 3/4] net: hns3: add support for EQE/CQE mode configuration Yufeng Mo
2021-08-20 7:35 ` Yufeng Mo [this message]
2021-08-24 16:10 ` [PATCH V3 net-next 0/4] ethtool: extend coalesce uAPI patchwork-bot+netdevbpf
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=1629444920-25437-5-git-send-email-moyufeng@huawei.com \
--to=moyufeng@huawei.com \
--cc=akiyano@amazon.com \
--cc=chenhao288@hisilicon.com \
--cc=davem@davemloft.net \
--cc=dledford@redhat.com \
--cc=ecree.xilinx@gmail.com \
--cc=edwin.peer@broadcom.com \
--cc=grygorii.strashko@ti.com \
--cc=huangguangbin2@huawei.com \
--cc=ioana.ciornei@nxp.com \
--cc=irusskikh@marvell.com \
--cc=jacob.e.keller@intel.com \
--cc=jgg@ziepe.ca \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=linuxarm@openeuler.org \
--cc=linyunsheng@huawei.com \
--cc=lipeng321@huawei.com \
--cc=merez@codeaurora.org \
--cc=michael.chan@broadcom.com \
--cc=netanel@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=rohitm@chelsio.com \
--cc=saeedm@nvidia.com \
--cc=salil.mehta@huawei.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
--cc=shenjian15@huawei.com \
--cc=thomas.lendacky@amd.com \
--cc=vladimir.oltean@nxp.com \
--cc=yisen.zhuang@huawei.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;
as well as URLs for NNTP newsgroup(s).