Thread (24 messages) flat view 24 messages, 5 authors, 2025-08-27

Re: [PATCH net-next v01 01/12] hinic3: HW initialization

From: ALOK TIWARI <hidden>
Date: 2025-08-26 19:53:50
Also in: linux-doc, lkml

+static int db_area_idx_init(struct hinic3_hwif *hwif, u64 db_base_phy,
+			    u8 __iomem *db_base, u64 db_dwqe_len)
+{
+	struct hinic3_db_area *db_area = &hwif->db_area;
+	u32 db_max_areas;
+
+	hwif->db_base_phy = db_base_phy;
+	hwif->db_base = db_base;
+	hwif->db_dwqe_len = db_dwqe_len;
+
+	db_max_areas = db_dwqe_len > HINIC3_DB_DWQE_SIZE ?
+		       HINIC3_DB_MAX_AREAS : db_dwqe_len / HINIC3_DB_PAGE_SIZE;
+	db_area->db_bitmap_array = bitmap_zalloc(db_max_areas, GFP_KERNEL);
+	if (!db_area->db_bitmap_array)
+		return -ENOMEM;
+
+	db_area->db_max_areas = db_max_areas;
+	spin_lock_init(&db_area->idx_lock);
+
+	return 0;
+}
+
+static void db_area_idx_free(struct hinic3_db_area *db_area)
+{
+	kfree(db_area->db_bitmap_array);
db_bitmap_array allocation was done via bitmap_zalloc().
is it ok to use kfree? or bitmap_free
quoted hunk ↗ jump to hunk
+}
+
  static int get_db_idx(struct hinic3_hwif *hwif, u32 *idx)
  {
  	struct hinic3_db_area *db_area = &hwif->db_area;
@@ -125,6 +273,15 @@ void hinic3_set_msix_state(struct hinic3_hwdev *hwdev, u16 msix_idx,
  	hinic3_hwif_write_reg(hwif, addr, mask_bits);
  }
  
[clip]
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_pci_id_tbl.h b/drivers/net/ethernet/huawei/hinic3/hinic3_pci_id_tbl.h
new file mode 100644
index 000000000000..7d60bd45ad1b
--- /dev/null
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_pci_id_tbl.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved. */
+
+#ifndef _HINIC3_PCI_ID_TBL_H_
+#define _HINIC3_PCI_ID_TBL_H_
+
+#define PCI_VENDOR_ID_HUAWEI    0x19e5
kernel already has PCI_VENDOR_ID_HUAWEI in <linux/pci_ids.h>
+#define PCI_DEV_ID_HINIC3_VF    0x375F
+
+#endif
Thanks,
Alok
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help