Skip to content

Commit 249cfa3

Browse files
committed
Revert "Merge branch 'there-are-some-bugfix-for-the-hns3-ethernet-driver'"
This reverts commit d80a309, reversing changes made to 637f414: 2cf2461 ("net: hns3: fix kernel crash when 1588 is sent on HIP08 devices") 3e22b7d ("net: hns3: fixed hclge_fetch_pf_reg accesses bar space out of bounds issue") d1c2e29 ("net: hns3: initialize reset_timer before hclgevf_misc_irq_init()") 5f62009 ("net: hns3: don't auto enable misc vector") 2758f18 ("net: hns3: Resolved the issue that the debugfs query result is inconsistent.") 662ecfc ("net: hns3: fix missing features due to dev->features configuration too early") 3e0f7cc ("net: hns3: fixed reset failure issues caused by the incorrect reset type") f2c1489 ("net: hns3: add sync command to sync io-pgtable") e6ab194 ("net: hns3: default enable tx bounce buffer when smmu enabled") The series is making the driver poke into IOMMU internals instead of implementing appropriate IOMMU workarounds. Link: https://lore.kernel.org/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 08d05ce commit 249cfa3

File tree

9 files changed

+26
-178
lines changed

9 files changed

+26
-178
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,10 +1293,8 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
12931293

12941294
/* save the buffer addr until the last read operation */
12951295
*save_buf = read_buf;
1296-
}
12971296

1298-
/* get data ready for the first time to read */
1299-
if (!*ppos) {
1297+
/* get data ready for the first time to read */
13001298
ret = hns3_dbg_read_cmd(dbg_data, hns3_dbg_cmd[index].cmd,
13011299
read_buf, hns3_dbg_cmd[index].buf_len);
13021300
if (ret)

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/irq.h>
1212
#include <linux/ip.h>
1313
#include <linux/ipv6.h>
14-
#include <linux/iommu.h>
1514
#include <linux/module.h>
1615
#include <linux/pci.h>
1716
#include <linux/skbuff.h>
@@ -381,24 +380,6 @@ static const struct hns3_rx_ptype hns3_rx_ptype_tbl[] = {
381380
#define HNS3_INVALID_PTYPE \
382381
ARRAY_SIZE(hns3_rx_ptype_tbl)
383382

384-
static void hns3_dma_map_sync(struct device *dev, unsigned long iova)
385-
{
386-
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
387-
struct iommu_iotlb_gather iotlb_gather;
388-
size_t granule;
389-
390-
if (!domain || !iommu_is_dma_domain(domain))
391-
return;
392-
393-
granule = 1 << __ffs(domain->pgsize_bitmap);
394-
iova = ALIGN_DOWN(iova, granule);
395-
iotlb_gather.start = iova;
396-
iotlb_gather.end = iova + granule - 1;
397-
iotlb_gather.pgsize = granule;
398-
399-
iommu_iotlb_sync(domain, &iotlb_gather);
400-
}
401-
402383
static irqreturn_t hns3_irq_handle(int irq, void *vector)
403384
{
404385
struct hns3_enet_tqp_vector *tqp_vector = vector;
@@ -1051,8 +1032,6 @@ static bool hns3_can_use_tx_sgl(struct hns3_enet_ring *ring,
10511032
static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring)
10521033
{
10531034
u32 alloc_size = ring->tqp->handle->kinfo.tx_spare_buf_size;
1054-
struct net_device *netdev = ring_to_netdev(ring);
1055-
struct hns3_nic_priv *priv = netdev_priv(netdev);
10561035
struct hns3_tx_spare *tx_spare;
10571036
struct page *page;
10581037
dma_addr_t dma;
@@ -1094,7 +1073,6 @@ static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring)
10941073
tx_spare->buf = page_address(page);
10951074
tx_spare->len = PAGE_SIZE << order;
10961075
ring->tx_spare = tx_spare;
1097-
ring->tx_copybreak = priv->tx_copybreak;
10981076
return;
10991077

11001078
dma_mapping_error:
@@ -1746,9 +1724,7 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv,
17461724
unsigned int type)
17471725
{
17481726
struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use];
1749-
struct hnae3_handle *handle = ring->tqp->handle;
17501727
struct device *dev = ring_to_dev(ring);
1751-
struct hnae3_ae_dev *ae_dev;
17521728
unsigned int size;
17531729
dma_addr_t dma;
17541730

@@ -1780,13 +1756,6 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv,
17801756
return -ENOMEM;
17811757
}
17821758

1783-
/* Add a SYNC command to sync io-pgtale to avoid errors in pgtable
1784-
* prefetch
1785-
*/
1786-
ae_dev = hns3_get_ae_dev(handle);
1787-
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
1788-
hns3_dma_map_sync(dev, dma);
1789-
17901759
desc_cb->priv = priv;
17911760
desc_cb->length = size;
17921761
desc_cb->dma = dma;
@@ -2483,6 +2452,7 @@ static int hns3_nic_set_features(struct net_device *netdev,
24832452
return ret;
24842453
}
24852454

2455+
netdev->features = features;
24862456
return 0;
24872457
}
24882458

@@ -4898,30 +4868,6 @@ static void hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv)
48984868
devm_kfree(&pdev->dev, priv->tqp_vector);
48994869
}
49004870

4901-
static void hns3_update_tx_spare_buf_config(struct hns3_nic_priv *priv)
4902-
{
4903-
#define HNS3_MIN_SPARE_BUF_SIZE (2 * 1024 * 1024)
4904-
#define HNS3_MAX_PACKET_SIZE (64 * 1024)
4905-
4906-
struct iommu_domain *domain = iommu_get_domain_for_dev(priv->dev);
4907-
struct hnae3_ae_dev *ae_dev = hns3_get_ae_dev(priv->ae_handle);
4908-
struct hnae3_handle *handle = priv->ae_handle;
4909-
4910-
if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V3)
4911-
return;
4912-
4913-
if (!(domain && iommu_is_dma_domain(domain)))
4914-
return;
4915-
4916-
priv->min_tx_copybreak = HNS3_MAX_PACKET_SIZE;
4917-
priv->min_tx_spare_buf_size = HNS3_MIN_SPARE_BUF_SIZE;
4918-
4919-
if (priv->tx_copybreak < priv->min_tx_copybreak)
4920-
priv->tx_copybreak = priv->min_tx_copybreak;
4921-
if (handle->kinfo.tx_spare_buf_size < priv->min_tx_spare_buf_size)
4922-
handle->kinfo.tx_spare_buf_size = priv->min_tx_spare_buf_size;
4923-
}
4924-
49254871
static void hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv,
49264872
unsigned int ring_type)
49274873
{
@@ -5155,7 +5101,6 @@ int hns3_init_all_ring(struct hns3_nic_priv *priv)
51555101
int i, j;
51565102
int ret;
51575103

5158-
hns3_update_tx_spare_buf_config(priv);
51595104
for (i = 0; i < ring_num; i++) {
51605105
ret = hns3_alloc_ring_memory(&priv->ring[i]);
51615106
if (ret) {
@@ -5360,8 +5305,6 @@ static int hns3_client_init(struct hnae3_handle *handle)
53605305
priv->ae_handle = handle;
53615306
priv->tx_timeout_count = 0;
53625307
priv->max_non_tso_bd_num = ae_dev->dev_specs.max_non_tso_bd_num;
5363-
priv->min_tx_copybreak = 0;
5364-
priv->min_tx_spare_buf_size = 0;
53655308
set_bit(HNS3_NIC_STATE_DOWN, &priv->state);
53665309

53675310
handle->msg_enable = netif_msg_init(debug, DEFAULT_MSG_LEVEL);

drivers/net/ethernet/hisilicon/hns3/hns3_enet.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,6 @@ struct hns3_nic_priv {
596596
struct hns3_enet_coalesce rx_coal;
597597
u32 tx_copybreak;
598598
u32 rx_copybreak;
599-
u32 min_tx_copybreak;
600-
u32 min_tx_spare_buf_size;
601599
};
602600

603601
union l3_hdr_info {

drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,31 +1933,6 @@ static int hns3_set_tx_spare_buf_size(struct net_device *netdev,
19331933
return ret;
19341934
}
19351935

1936-
static int hns3_check_tx_copybreak(struct net_device *netdev, u32 copybreak)
1937-
{
1938-
struct hns3_nic_priv *priv = netdev_priv(netdev);
1939-
1940-
if (copybreak < priv->min_tx_copybreak) {
1941-
netdev_err(netdev, "tx copybreak %u should be no less than %u!\n",
1942-
copybreak, priv->min_tx_copybreak);
1943-
return -EINVAL;
1944-
}
1945-
return 0;
1946-
}
1947-
1948-
static int hns3_check_tx_spare_buf_size(struct net_device *netdev, u32 buf_size)
1949-
{
1950-
struct hns3_nic_priv *priv = netdev_priv(netdev);
1951-
1952-
if (buf_size < priv->min_tx_spare_buf_size) {
1953-
netdev_err(netdev,
1954-
"tx spare buf size %u should be no less than %u!\n",
1955-
buf_size, priv->min_tx_spare_buf_size);
1956-
return -EINVAL;
1957-
}
1958-
return 0;
1959-
}
1960-
19611936
static int hns3_set_tunable(struct net_device *netdev,
19621937
const struct ethtool_tunable *tuna,
19631938
const void *data)
@@ -1974,10 +1949,6 @@ static int hns3_set_tunable(struct net_device *netdev,
19741949

19751950
switch (tuna->id) {
19761951
case ETHTOOL_TX_COPYBREAK:
1977-
ret = hns3_check_tx_copybreak(netdev, *(u32 *)data);
1978-
if (ret)
1979-
return ret;
1980-
19811952
priv->tx_copybreak = *(u32 *)data;
19821953

19831954
for (i = 0; i < h->kinfo.num_tqps; i++)
@@ -1992,10 +1963,6 @@ static int hns3_set_tunable(struct net_device *netdev,
19921963

19931964
break;
19941965
case ETHTOOL_TX_COPYBREAK_BUF_SIZE:
1995-
ret = hns3_check_tx_spare_buf_size(netdev, *(u32 *)data);
1996-
if (ret)
1997-
return ret;
1998-
19991966
old_tx_spare_buf_size = h->kinfo.tx_spare_buf_size;
20001967
new_tx_spare_buf_size = *(u32 *)data;
20011968
netdev_info(netdev, "request to set tx spare buf size from %u to %u\n",

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/etherdevice.h>
77
#include <linux/init.h>
88
#include <linux/interrupt.h>
9-
#include <linux/irq.h>
109
#include <linux/kernel.h>
1110
#include <linux/module.h>
1211
#include <linux/netdevice.h>
@@ -3585,17 +3584,6 @@ static int hclge_set_vf_link_state(struct hnae3_handle *handle, int vf,
35853584
return ret;
35863585
}
35873586

3588-
static void hclge_set_reset_pending(struct hclge_dev *hdev,
3589-
enum hnae3_reset_type reset_type)
3590-
{
3591-
/* When an incorrect reset type is executed, the get_reset_level
3592-
* function generates the HNAE3_NONE_RESET flag. As a result, this
3593-
* type do not need to pending.
3594-
*/
3595-
if (reset_type != HNAE3_NONE_RESET)
3596-
set_bit(reset_type, &hdev->reset_pending);
3597-
}
3598-
35993587
static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
36003588
{
36013589
u32 cmdq_src_reg, msix_src_reg, hw_err_src_reg;
@@ -3616,7 +3604,7 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
36163604
*/
36173605
if (BIT(HCLGE_VECTOR0_IMPRESET_INT_B) & msix_src_reg) {
36183606
dev_info(&hdev->pdev->dev, "IMP reset interrupt\n");
3619-
hclge_set_reset_pending(hdev, HNAE3_IMP_RESET);
3607+
set_bit(HNAE3_IMP_RESET, &hdev->reset_pending);
36203608
set_bit(HCLGE_COMM_STATE_CMD_DISABLE, &hdev->hw.hw.comm_state);
36213609
*clearval = BIT(HCLGE_VECTOR0_IMPRESET_INT_B);
36223610
hdev->rst_stats.imp_rst_cnt++;
@@ -3626,7 +3614,7 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
36263614
if (BIT(HCLGE_VECTOR0_GLOBALRESET_INT_B) & msix_src_reg) {
36273615
dev_info(&hdev->pdev->dev, "global reset interrupt\n");
36283616
set_bit(HCLGE_COMM_STATE_CMD_DISABLE, &hdev->hw.hw.comm_state);
3629-
hclge_set_reset_pending(hdev, HNAE3_GLOBAL_RESET);
3617+
set_bit(HNAE3_GLOBAL_RESET, &hdev->reset_pending);
36303618
*clearval = BIT(HCLGE_VECTOR0_GLOBALRESET_INT_B);
36313619
hdev->rst_stats.global_rst_cnt++;
36323620
return HCLGE_VECTOR0_EVENT_RST;
@@ -3781,7 +3769,7 @@ static int hclge_misc_irq_init(struct hclge_dev *hdev)
37813769
snprintf(hdev->misc_vector.name, HNAE3_INT_NAME_LEN, "%s-misc-%s",
37823770
HCLGE_NAME, pci_name(hdev->pdev));
37833771
ret = request_irq(hdev->misc_vector.vector_irq, hclge_misc_irq_handle,
3784-
IRQ_NOAUTOEN, hdev->misc_vector.name, hdev);
3772+
0, hdev->misc_vector.name, hdev);
37853773
if (ret) {
37863774
hclge_free_vector(hdev, 0);
37873775
dev_err(&hdev->pdev->dev, "request misc irq(%d) fail\n",
@@ -4074,7 +4062,7 @@ static void hclge_do_reset(struct hclge_dev *hdev)
40744062
case HNAE3_FUNC_RESET:
40754063
dev_info(&pdev->dev, "PF reset requested\n");
40764064
/* schedule again to check later */
4077-
hclge_set_reset_pending(hdev, HNAE3_FUNC_RESET);
4065+
set_bit(HNAE3_FUNC_RESET, &hdev->reset_pending);
40784066
hclge_reset_task_schedule(hdev);
40794067
break;
40804068
default:
@@ -4108,8 +4096,6 @@ static enum hnae3_reset_type hclge_get_reset_level(struct hnae3_ae_dev *ae_dev,
41084096
clear_bit(HNAE3_FLR_RESET, addr);
41094097
}
41104098

4111-
clear_bit(HNAE3_NONE_RESET, addr);
4112-
41134099
if (hdev->reset_type != HNAE3_NONE_RESET &&
41144100
rst_level < hdev->reset_type)
41154101
return HNAE3_NONE_RESET;
@@ -4251,7 +4237,7 @@ static bool hclge_reset_err_handle(struct hclge_dev *hdev)
42514237
return false;
42524238
} else if (hdev->rst_stats.reset_fail_cnt < MAX_RESET_FAIL_CNT) {
42534239
hdev->rst_stats.reset_fail_cnt++;
4254-
hclge_set_reset_pending(hdev, hdev->reset_type);
4240+
set_bit(hdev->reset_type, &hdev->reset_pending);
42554241
dev_info(&hdev->pdev->dev,
42564242
"re-schedule reset task(%u)\n",
42574243
hdev->rst_stats.reset_fail_cnt);
@@ -4494,20 +4480,8 @@ static void hclge_reset_event(struct pci_dev *pdev, struct hnae3_handle *handle)
44944480
static void hclge_set_def_reset_request(struct hnae3_ae_dev *ae_dev,
44954481
enum hnae3_reset_type rst_type)
44964482
{
4497-
#define HCLGE_SUPPORT_RESET_TYPE \
4498-
(BIT(HNAE3_FLR_RESET) | BIT(HNAE3_FUNC_RESET) | \
4499-
BIT(HNAE3_GLOBAL_RESET) | BIT(HNAE3_IMP_RESET))
4500-
45014483
struct hclge_dev *hdev = ae_dev->priv;
45024484

4503-
if (!(BIT(rst_type) & HCLGE_SUPPORT_RESET_TYPE)) {
4504-
/* To prevent reset triggered by hclge_reset_event */
4505-
set_bit(HNAE3_NONE_RESET, &hdev->default_reset_request);
4506-
dev_warn(&hdev->pdev->dev, "unsupported reset type %d\n",
4507-
rst_type);
4508-
return;
4509-
}
4510-
45114485
set_bit(rst_type, &hdev->default_reset_request);
45124486
}
45134487

@@ -11917,6 +11891,9 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
1191711891

1191811892
hclge_init_rxd_adv_layout(hdev);
1191911893

11894+
/* Enable MISC vector(vector0) */
11895+
hclge_enable_vector(&hdev->misc_vector, true);
11896+
1192011897
ret = hclge_init_wol(hdev);
1192111898
if (ret)
1192211899
dev_warn(&pdev->dev,
@@ -11929,10 +11906,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
1192911906
hclge_state_init(hdev);
1193011907
hdev->last_reset_time = jiffies;
1193111908

11932-
/* Enable MISC vector(vector0) */
11933-
enable_irq(hdev->misc_vector.vector_irq);
11934-
hclge_enable_vector(&hdev->misc_vector, true);
11935-
1193611909
dev_info(&hdev->pdev->dev, "%s driver initialization finished.\n",
1193711910
HCLGE_DRIVER_NAME);
1193811911

@@ -12338,7 +12311,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
1233812311

1233912312
/* Disable MISC vector(vector0) */
1234012313
hclge_enable_vector(&hdev->misc_vector, false);
12341-
disable_irq(hdev->misc_vector.vector_irq);
12314+
synchronize_irq(hdev->misc_vector.vector_irq);
1234212315

1234312316
/* Disable all hw interrupts */
1234412317
hclge_config_mac_tnl_int(hdev, false);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ bool hclge_ptp_set_tx_info(struct hnae3_handle *handle, struct sk_buff *skb)
5858
struct hclge_dev *hdev = vport->back;
5959
struct hclge_ptp *ptp = hdev->ptp;
6060

61-
if (!ptp)
62-
return false;
63-
6461
if (!test_bit(HCLGE_PTP_FLAG_TX_EN, &ptp->flags) ||
6562
test_and_set_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state)) {
6663
ptp->tx_skipped++;

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_regs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ static int hclge_get_dfx_reg(struct hclge_dev *hdev, void *data)
510510
static int hclge_fetch_pf_reg(struct hclge_dev *hdev, void *data,
511511
struct hnae3_knic_private_info *kinfo)
512512
{
513+
#define HCLGE_RING_REG_OFFSET 0x200
513514
#define HCLGE_RING_INT_REG_OFFSET 0x4
514515

515-
struct hnae3_queue *tqp;
516516
int i, j, reg_num;
517517
int data_num_sum;
518518
u32 *reg = data;
@@ -533,11 +533,10 @@ static int hclge_fetch_pf_reg(struct hclge_dev *hdev, void *data,
533533
reg_num = ARRAY_SIZE(ring_reg_addr_list);
534534
for (j = 0; j < kinfo->num_tqps; j++) {
535535
reg += hclge_reg_get_tlv(HCLGE_REG_TAG_RING, reg_num, reg);
536-
tqp = kinfo->tqp[j];
537536
for (i = 0; i < reg_num; i++)
538-
*reg++ = readl_relaxed(tqp->io_base -
539-
HCLGE_TQP_REG_OFFSET +
540-
ring_reg_addr_list[i]);
537+
*reg++ = hclge_read_dev(&hdev->hw,
538+
ring_reg_addr_list[i] +
539+
HCLGE_RING_REG_OFFSET * j);
541540
}
542541
data_num_sum += (reg_num + HCLGE_REG_TLV_SPACE) * kinfo->num_tqps;
543542

0 commit comments

Comments
 (0)