From 31fc2be51e535fe3b0be6e8831f3691e509de182 Mon Sep 17 00:00:00 2001 From: hcf Date: Tue, 17 Mar 2026 16:31:31 +0800 Subject: [PATCH 1/3] config: Enable ZTE Dinghai network and RDMA driver support tecent.config for both x86 and arm64 architectures. Signed-off-by: hcf --- arch/arm64/configs/tencent.config | 16 +++++++++++++++- arch/x86/configs/tencent.config | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/arch/arm64/configs/tencent.config b/arch/arm64/configs/tencent.config index ca842e8ad2a2..25d10b12c77e 100644 --- a/arch/arm64/configs/tencent.config +++ b/arch/arm64/configs/tencent.config @@ -1873,4 +1873,18 @@ CONFIG_FWCTL=m # UB_FWCTL CONFIG_FWCTL_UB=m # end of UB_FWCTL -CONFIG_ARM64_HISI_IPIV=y \ No newline at end of file +CONFIG_ARM64_HISI_IPIV=y + +# DINGHAI +CONFIG_NET_VENDOR_DINGHAI=y +CONFIG_DINGHAI_DH_CMD=m +CONFIG_DINGHAI_EN_AUX=y +CONFIG_DINGHAI_NP=m +CONFIG_DINGHAI_PTP=m +CONFIG_DINGHAI_TSN=y +CONFIG_DINGHAI_TSN_M=m +CONFIG_ZXDH_SF=y +CONFIG_DINGHAI_AUXILIARY=m +CONFIG_DINGHAI_PF=m +CONFIG_INFINIBAND_ZRDMA=m +# end of DINGHAI \ No newline at end of file diff --git a/arch/x86/configs/tencent.config b/arch/x86/configs/tencent.config index c0f5462d18da..6561abde22ca 100644 --- a/arch/x86/configs/tencent.config +++ b/arch/x86/configs/tencent.config @@ -2029,3 +2029,17 @@ CONFIG_TEST_BPF=m # fwctl CONFIG_FWCTL=m + +# DINGHAI +CONFIG_NET_VENDOR_DINGHAI=y +CONFIG_DINGHAI_DH_CMD=m +CONFIG_DINGHAI_EN_AUX=y +CONFIG_DINGHAI_NP=m +CONFIG_DINGHAI_PTP=m +CONFIG_DINGHAI_TSN=y +CONFIG_DINGHAI_TSN_M=m +CONFIG_ZXDH_SF=y +CONFIG_DINGHAI_AUXILIARY=m +CONFIG_DINGHAI_PF=m +CONFIG_INFINIBAND_ZRDMA=m +# end of DINGHAI \ No newline at end of file -- Gitee From a693ea2e05740d2e3ebd0e4040c78debd206f477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E6=88=90=E9=A3=9E10333708?= Date: Wed, 25 Mar 2026 18:38:41 +0800 Subject: [PATCH 2/3] Fix compilation issues when generating .config from defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 韩成飞10333708 --- drivers/net/ethernet/dinghai/Kconfig | 2 ++ drivers/net/ethernet/dinghai/Makefile | 2 +- drivers/net/ethernet/dinghai/en_aux.c | 2 ++ drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.c | 4 ++++ drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.h | 2 ++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/dinghai/Kconfig b/drivers/net/ethernet/dinghai/Kconfig index 86831c41842a..c9776c953d4d 100644 --- a/drivers/net/ethernet/dinghai/Kconfig +++ b/drivers/net/ethernet/dinghai/Kconfig @@ -1,6 +1,7 @@ config NET_VENDOR_DINGHAI tristate "Dinghai Devices" depends on (X86 || ARM64) + select NET_DEVLINK default y help If you have a Ethernet DINGHAI device belonging to this @@ -68,6 +69,7 @@ config ZXDH_MSGQ config DINGHAI_SEC tristate "Dinghai SEC Support" depends on (X86 || ARM64) + depends on XFRM_OFFLOAD default n help Security (SEC) module support. diff --git a/drivers/net/ethernet/dinghai/Makefile b/drivers/net/ethernet/dinghai/Makefile index 1f0b65ed6694..cd4b60ff4462 100644 --- a/drivers/net/ethernet/dinghai/Makefile +++ b/drivers/net/ethernet/dinghai/Makefile @@ -32,7 +32,7 @@ dinghai10e-$(CONFIG_DINGHAI_EN_AUX) += en_aux.o eq.o pci_irq.o irq_affinity.o en en_aux/dcbnl/en_dcbnl.o en_aux/dcbnl/en_dcbnl_api.o \ zxdh_tools/zxdh_tools_ioctl.o zxdh_tools/zxdh_tools_netlink.o \ en_aux/en_1588_pkt_proc.o en_aux/en_1588_pkt_proc_func.o xarray.o en_aux/selq.o log.o slib.o -dinghai10e-y += en_aux/drs_sec_dtb.o +dinghai10e-$(CONFIG_DINGHAI_SEC) += en_aux/drs_sec_dtb.o dinghai10e-y += en_aux/priv_queue.o dinghai10e-y += bonding/zxdh_lag.o bonding/rdma_ops.o diff --git a/drivers/net/ethernet/dinghai/en_aux.c b/drivers/net/ethernet/dinghai/en_aux.c index ca9cbae4d89a..fdea6a515acc 100644 --- a/drivers/net/ethernet/dinghai/en_aux.c +++ b/drivers/net/ethernet/dinghai/en_aux.c @@ -5409,7 +5409,9 @@ void zxdh_netdev_features_init(struct net_device *netdev) return; } +#ifdef ZXDH_SEC extern const struct xfrmdev_ops zxdh_xfrmdev_ops; +#endif static void zxdh_build_nic_netdev(struct net_device *netdev) { struct zxdh_en_priv *en_priv = netdev_priv(netdev); diff --git a/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.c b/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.c index 292ce4819772..f8fd69cdfa9f 100644 --- a/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.c +++ b/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.c @@ -823,7 +823,9 @@ uint32_t zxdh_dcbnl_initialize(struct net_device *netdev) zxdh_dcbnl_printk_ets_tree(en_priv); en_dev->dcb_para.init_flag = ZXDH_DCBNL_INIT_FLAG; +#ifdef CONFIG_DCB netdev->dcbnl_ops = &zxdh_dcbnl_ops; +#endif //zxdh_dcbnl_set_tm_pport_mcode_gate_open(netdev); LOG_INFO("%s dcbnl init ok ", netdev->name); @@ -842,7 +844,9 @@ uint32_t zxdh_dcbnl_ets_uninit(struct net_device *netdev) LOG_INFO("%s dcbnl uninit begin\n", netdev->name); en_dev->dcb_para.init_flag = 0; +#ifdef CONFIG_DCB netdev->dcbnl_ops = NULL; +#endif zxdh_dcbnl_set_tm_pport_mcode_gate_close(netdev); zxdh_dcbnl_free_flow_resources(en_priv); diff --git a/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.h b/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.h index fd6810133a7b..fb2f53d40bd6 100644 --- a/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.h +++ b/drivers/net/ethernet/dinghai/en_aux/dcbnl/en_dcbnl.h @@ -6,6 +6,8 @@ extern "C" { #endif #include +#include +#include /* 启用dcb会大幅度增加初始化时间,暂时先注释 */ #define ZXDH_DCBNL_OPEN -- Gitee From 486d137c06daba7aff588980f3d5f28bfee9e147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E6=88=90=E9=A3=9E10333708?= Date: Mon, 13 Apr 2026 16:05:00 +0800 Subject: [PATCH 3/3] Fix compilation issues when generating .config from allyesconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 韩成飞10333708 --- drivers/net/ethernet/dinghai/en_aux.c | 12 +-- .../ethernet/dinghai/en_aux/en_aux_ioctl.c | 10 +-- .../net/ethernet/dinghai/en_aux/priv_queue.c | 22 ++--- drivers/net/ethernet/dinghai/en_aux/queue.c | 88 +++++++++---------- drivers/net/ethernet/dinghai/en_aux/queue.h | 14 +-- drivers/net/ethernet/dinghai/en_pf.c | 3 + drivers/net/ethernet/dinghai/log.c | 2 +- 7 files changed, 77 insertions(+), 74 deletions(-) diff --git a/drivers/net/ethernet/dinghai/en_aux.c b/drivers/net/ethernet/dinghai/en_aux.c index fdea6a515acc..2ae9ff4a1bd3 100644 --- a/drivers/net/ethernet/dinghai/en_aux.c +++ b/drivers/net/ethernet/dinghai/en_aux.c @@ -747,7 +747,7 @@ int32_t xmit_skb(struct net_device *netdev, struct send_queue *sq, num_sg++; } - return virtqueue_add_outbuf(sq->vq, sq->sg, num_sg, skb, GFP_ATOMIC); + return zxdh_virtqueue_add_outbuf(sq->vq, sq->sg, num_sg, skb, GFP_ATOMIC); } netdev_tx_t zxdh_en_xmit(struct sk_buff *skb, struct net_device *netdev) @@ -764,13 +764,13 @@ netdev_tx_t zxdh_en_xmit(struct sk_buff *skb, struct net_device *netdev) /* Free up any pending old buffers before queueing new ones. */ do { if (use_napi) { - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); } free_old_xmit_skbs(netdev, sq, false); } while (use_napi && kick && - unlikely(!virtqueue_enable_cb_delayed(sq->vq))); + unlikely(!zxdh_virtqueue_enable_cb_delayed(sq->vq))); /* timestamp packet in software */ skb_tx_timestamp(skb); @@ -806,19 +806,19 @@ netdev_tx_t zxdh_en_xmit(struct sk_buff *skb, struct net_device *netdev) netif_stop_subqueue(netdev, qnum); en_dev->hw_stats.q_stats[qnum].q_tx_stopped++; if (!use_napi && - unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { + unlikely(!zxdh_virtqueue_enable_cb_delayed(sq->vq))) { /* More just got used, free them then recheck. */ free_old_xmit_skbs(netdev, sq, false); if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) { netif_start_subqueue(netdev, qnum); - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); } } } if (kick || netif_xmit_stopped(txq)) { if (virtqueue_kick_prepare_packed(sq->vq) && - virtqueue_notify(sq->vq)) { + zxdh_virtqueue_notify(sq->vq)) { u64_stats_update_begin(&sq->stats.syncp); sq->stats.kicks++; u64_stats_update_end(&sq->stats.syncp); diff --git a/drivers/net/ethernet/dinghai/en_aux/en_aux_ioctl.c b/drivers/net/ethernet/dinghai/en_aux/en_aux_ioctl.c index 841786f537ac..4a4843fd1a40 100644 --- a/drivers/net/ethernet/dinghai/en_aux/en_aux_ioctl.c +++ b/drivers/net/ethernet/dinghai/en_aux/en_aux_ioctl.c @@ -300,8 +300,8 @@ int32_t zxdh_tx_file_pkts(struct zxdh_en_priv *en_priv, struct zxdh_en_reg *reg) uint32_t pktLen = reg->num; uint32_t buffLen = 4096; - while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { - LOG_ERR("virtqueue_get_buf() != NULL, ptr=0x%llx, len=0x%x\n", + while ((ptr = zxdh_virtqueue_get_buf(sq->vq, &len)) != NULL) { + LOG_ERR("zxdh_virtqueue_get_buf() != NULL, ptr=0x%llx, len=0x%x\n", (uint64_t)ptr, len); }; @@ -342,13 +342,13 @@ int32_t zxdh_tx_file_pkts(struct zxdh_en_priv *en_priv, struct zxdh_en_reg *reg) } } - if (unlikely(virtqueue_add_outbuf(sq->vq, sg, total_sg, data_pkt, + if (unlikely(zxdh_virtqueue_add_outbuf(sq->vq, sg, total_sg, data_pkt, GFP_ATOMIC) != 0)) { - LOG_ERR("virtqueue_add_outbuf failure!\n"); + LOG_ERR("zxdh_virtqueue_add_outbuf failure!\n"); goto err1; } - if (virtqueue_kick_prepare_packed(sq->vq) && virtqueue_notify(sq->vq)) { + if (virtqueue_kick_prepare_packed(sq->vq) && zxdh_virtqueue_notify(sq->vq)) { u64_stats_update_begin(&sq->stats.syncp); sq->stats.kicks++; u64_stats_update_end(&sq->stats.syncp); diff --git a/drivers/net/ethernet/dinghai/en_aux/priv_queue.c b/drivers/net/ethernet/dinghai/en_aux/priv_queue.c index 5a8f58b93bad..78723295fc85 100644 --- a/drivers/net/ethernet/dinghai/en_aux/priv_queue.c +++ b/drivers/net/ethernet/dinghai/en_aux/priv_queue.c @@ -85,7 +85,7 @@ static int32_t msgq_add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp) sg_init_one(rq->sg, buf, len); ctx = (void *)(unsigned long)len; - err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp); + err = zxdh_virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp); if (err < 0) { put_page(virt_to_head_page(buf)); } @@ -107,7 +107,7 @@ static bool msgq_try_fill_recv(struct receive_queue *rq, gfp_t gfp) } } while (rq->vq->num_free); - if (virtqueue_kick_prepare_packed(rq->vq) && virtqueue_notify(rq->vq)) { + if (virtqueue_kick_prepare_packed(rq->vq) && zxdh_virtqueue_notify(rq->vq)) { flags = u64_stats_update_begin_irqsave(&rq->stats.syncp); rq->stats.kicks++; u64_stats_update_end_irqrestore(&rq->stats.syncp, flags); @@ -119,7 +119,7 @@ static bool msgq_try_fill_recv(struct receive_queue *rq, gfp_t gfp) uint32_t msgq_mergeable_min_buf_len(struct virtqueue *vq) { const uint32_t hdr_len = PRIV_HEADER_LEN; - uint32_t rq_size = virtqueue_get_vring_size(vq); + uint32_t rq_size = zxdh_virtqueue_get_vring_size(vq); uint32_t min_buf_len = DIV_ROUND_UP(BUFF_LEN, rq_size); return max(max(min_buf_len, hdr_len) - hdr_len, @@ -330,11 +330,11 @@ static int32_t page_send_cmd(struct send_queue *sq, uint8_t *buf, } } - err = virtqueue_add_outbuf(sq->vq, sq->sg, total_sg, buf, GFP_ATOMIC); + err = zxdh_virtqueue_add_outbuf(sq->vq, sq->sg, total_sg, buf, GFP_ATOMIC); ZXDH_CHECK_RET_GOTO_ERR(err, free_addr, - "virtqueue_add_outbuf failed: %d\n", err); + "zxdh_virtqueue_add_outbuf failed: %d\n", err); - if (virtqueue_kick_prepare_packed(sq->vq) && virtqueue_notify(sq->vq)) { + if (virtqueue_kick_prepare_packed(sq->vq) && zxdh_virtqueue_notify(sq->vq)) { u64_stats_update_begin(&sq->stats.syncp); sq->stats.kicks++; u64_stats_update_end(&sq->stats.syncp); @@ -354,7 +354,7 @@ static int32_t zxdh_msgq_pkt_send(struct msgq_dev *msgq_dev, uint32_t len = 0; if (spin_trylock(&msgq_dev->tx_lock)) { - while ((buf = virtqueue_get_buf(msgq_dev->sq_priv->vq, &len)) != + while ((buf = zxdh_virtqueue_get_buf(msgq_dev->sq_priv->vq, &len)) != NULL) { ZXDH_FREE_PTR(buf); }; @@ -550,7 +550,7 @@ static int32_t zxdh_response_msg_handle(struct msgq_dev *msgq_dev, memcpy(*tmp_buff->data, (uint8_t *)buf + PRIV_HEADER_LEN, pkt_len); while (--num_buf != 0) { rx_free_pages(msgq_dev, buf, len); - buf = virtqueue_get_buf(msgq_dev->rq_priv->vq, &len); + buf = zxdh_virtqueue_get_buf(msgq_dev->rq_priv->vq, &len); if (unlikely(buf == NULL)) { LOG_ERR("msgq rx error: %dth buffers missing\n", num_buf); @@ -707,7 +707,7 @@ static int32_t zxdh_msgq_receive(struct receive_queue *rq, int32_t budget) } if (rq->vq->num_free > - min((uint32_t)budget, virtqueue_get_vring_size(rq->vq)) / 2) { + min((uint32_t)budget, zxdh_virtqueue_get_vring_size(rq->vq)) / 2) { if (!msgq_try_fill_recv(rq, GFP_ATOMIC)) { LOG_ERR("msgq_try_fill_recv failed\n"); } @@ -732,7 +732,7 @@ static void free_old_xmit_bufs(struct send_queue *sq) uint32_t bytes = 0; void *buf = NULL; - while ((buf = virtqueue_get_buf(sq->vq, &len)) != NULL) + while ((buf = zxdh_virtqueue_get_buf(sq->vq, &len)) != NULL) { bytes += len; packets++; @@ -761,7 +761,7 @@ static void msgq_poll_cleantx(struct receive_queue *rq) } if (spin_trylock(&msgq_dev->tx_lock)) { - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); //free_old_xmit_bufs(sq); spin_unlock(&msgq_dev->tx_lock); } diff --git a/drivers/net/ethernet/dinghai/en_aux/queue.c b/drivers/net/ethernet/dinghai/en_aux/queue.c index 51312678867d..1d902afc7fd6 100644 --- a/drivers/net/ethernet/dinghai/en_aux/queue.c +++ b/drivers/net/ethernet/dinghai/en_aux/queue.c @@ -85,7 +85,7 @@ static struct page *xdp_linearize_page(struct receive_queue *rq, u16 *num_buf, void *buf; int off; - buf = virtqueue_get_buf(rq->vq, &buflen); + buf = zxdh_virtqueue_get_buf(rq->vq, &buflen); if (unlikely(!buf)) goto err_buf; @@ -303,7 +303,7 @@ inline void vqm_wmb(bool weak_barriers) } } -void vring_del_virtqueue(struct virtqueue *_vq) +static void vring_del_virtqueue(struct virtqueue *_vq) { struct zxdh_en_device *en_dev = _vq->en_dev; struct vring_virtqueue *vq = to_vvq(_vq); @@ -375,7 +375,7 @@ void vp_detach_vqs(void *para) } } -void vp_del_vqs(struct net_device *netdev) +static void vp_del_vqs(struct net_device *netdev) { struct zxdh_en_priv *en_priv = netdev_priv(netdev); struct zxdh_en_device *en_dev = &en_priv->edev; @@ -387,20 +387,20 @@ void vp_del_vqs(struct net_device *netdev) } /** - * virtqueue_get_vring_size - return the size of the virtqueue's vring + * zxdh_virtqueue_get_vring_size - return the size of the virtqueue's vring * @_vq: the struct virtqueue containing the vring of interest. * * Returns the size of the vring. This is mainly used for boasting to * userspace. Unlike other operations, this need not be serialized. */ -uint32_t virtqueue_get_vring_size(struct virtqueue *_vq) +uint32_t zxdh_virtqueue_get_vring_size(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); return vq->packed.vring.num; } -dma_addr_t virtqueue_get_desc_addr(struct virtqueue *_vq) +static dma_addr_t virtqueue_get_desc_addr(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -409,7 +409,7 @@ dma_addr_t virtqueue_get_desc_addr(struct virtqueue *_vq) return vq->packed.ring_dma_addr; } -dma_addr_t virtqueue_get_avail_addr(struct virtqueue *_vq) +static dma_addr_t virtqueue_get_avail_addr(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -418,7 +418,7 @@ dma_addr_t virtqueue_get_avail_addr(struct virtqueue *_vq) return vq->packed.driver_event_dma_addr; } -dma_addr_t virtqueue_get_used_addr(struct virtqueue *_vq) +static dma_addr_t virtqueue_get_used_addr(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -719,7 +719,7 @@ void zxdh_vvq_reset(struct zxdh_en_device *en_dev) } /* the notify function used when creating a virt queue */ -bool vp_notify(struct virtqueue *vq) +static bool vp_notify(struct virtqueue *vq) { /* we write the queue's selector into the notification register to * signal the other end */ @@ -766,7 +766,7 @@ struct virtqueue *vp_setup_vq(struct net_device *netdev, unsigned index, /* activate the queue */ en_dev->ops->activate_phy_vq(en_dev->parent, en_dev->phy_index[index], - virtqueue_get_vring_size(vq), + zxdh_virtqueue_get_vring_size(vq), virtqueue_get_desc_addr(vq), virtqueue_get_avail_addr(vq), virtqueue_get_used_addr(vq)); @@ -1284,7 +1284,7 @@ int32_t virtqueue_add_packed(struct virtqueue *_vq, struct scatterlist *sgs[], } /** - * virtqueue_add_inbuf_ctx - expose input buffers to other end + * zxdh_virtqueue_add_inbuf_ctx - expose input buffers to other end * @vq: the struct virtqueue we're talking about. * @sg: scatterlist (must be well-formed and terminated!) * @num: the number of entries in @sg writable by other side @@ -1297,7 +1297,7 @@ int32_t virtqueue_add_packed(struct virtqueue *_vq, struct scatterlist *sgs[], * * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). */ -int32_t virtqueue_add_inbuf_ctx(struct virtqueue *vq, struct scatterlist *sg, +int32_t zxdh_virtqueue_add_inbuf_ctx(struct virtqueue *vq, struct scatterlist *sg, uint32_t num, void *data, void *ctx, gfp_t gfp) { return virtqueue_add_packed(vq, &sg, num, 0, 1, data, ctx, gfp); @@ -1338,7 +1338,7 @@ bool virtqueue_poll_packed(struct virtqueue *_vq, uint16_t off_wrap) * * This does not need to be serialized. */ -bool virtqueue_poll(struct virtqueue *_vq, unsigned last_used_idx) +static bool virtqueue_poll(struct virtqueue *_vq, unsigned last_used_idx) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -1383,7 +1383,7 @@ unsigned virtqueue_enable_cb_prepare_packed(struct virtqueue *_vq) return vq->last_used_idx; } -int32_t virtqueue_enable_cb_prepare(struct virtqueue *_vq) +static int32_t virtqueue_enable_cb_prepare(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -1586,7 +1586,7 @@ void *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq, uint32_t *len, return ret; } -void *virtqueue_get_buf(struct virtqueue *_vq, uint32_t *len) +void *zxdh_virtqueue_get_buf(struct virtqueue *_vq, uint32_t *len) { return virtqueue_get_buf_ctx_packed(_vq, len, NULL); } @@ -1614,7 +1614,7 @@ void free_old_xmit_skbs(struct net_device *netdev, struct send_queue *sq, uint32_t bytes = 0; void *ptr = NULL; - while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { + while ((ptr = zxdh_virtqueue_get_buf(sq->vq, &len)) != NULL) { if (likely(!is_xdp_frame(ptr))) { struct sk_buff *skb = ptr; @@ -1642,7 +1642,7 @@ void free_old_xmit_skbs(struct net_device *netdev, struct send_queue *sq, u64_stats_update_end(&sq->stats.syncp); } -void virtqueue_disable_cb_packed(struct virtqueue *_vq) +void zxdh_virtqueue_disable_cb_packed(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -1654,7 +1654,7 @@ void virtqueue_disable_cb_packed(struct virtqueue *_vq) } /** - * virtqueue_disable_cb - disable callbacks + * zxdh_virtqueue_disable_cb - disable callbacks * @_vq: the struct virtqueue we're talking about. * * Note that this is not necessarily synchronous, hence unreliable and only @@ -1662,7 +1662,7 @@ void virtqueue_disable_cb_packed(struct virtqueue *_vq) * * Unlike other operations, this need not be serialized. */ -void virtqueue_disable_cb(struct virtqueue *_vq) +void zxdh_virtqueue_disable_cb(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -1673,13 +1673,13 @@ void virtqueue_disable_cb(struct virtqueue *_vq) return; } - virtqueue_disable_cb_packed(_vq); + zxdh_virtqueue_disable_cb_packed(_vq); } void virtqueue_napi_schedule(struct napi_struct *napi, struct virtqueue *vq) { if (napi_schedule_prep(napi)) { - virtqueue_disable_cb(vq); + zxdh_virtqueue_disable_cb(vq); __napi_schedule(napi); } } @@ -1743,7 +1743,7 @@ int virtnet_poll_tx(struct napi_struct *napi, int budget) txq = netdev_get_tx_queue(en_dev->netdev, index); __netif_tx_lock(txq, raw_smp_processor_id()); - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); free_old_xmit_skbs(en_dev->netdev, sq, true); if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) { @@ -1755,7 +1755,7 @@ int virtnet_poll_tx(struct napi_struct *napi, int budget) done = napi_complete_done(napi, 0); if (!done) { - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); } __netif_tx_unlock(txq); @@ -1764,7 +1764,7 @@ int virtnet_poll_tx(struct napi_struct *napi, int budget) if (unlikely(virtqueue_poll(sq->vq, opaque))) { if (napi_schedule_prep(napi)) { __netif_tx_lock(txq, raw_smp_processor_id()); - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); __netif_tx_unlock(txq); __napi_schedule(napi); } @@ -1774,7 +1774,7 @@ int virtnet_poll_tx(struct napi_struct *napi, int budget) return 0; } -bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq) +bool zxdh_virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); uint16_t used_idx = 0; @@ -1878,7 +1878,7 @@ uint32_t mergeable_ctx_to_truesize(void *mrg_ctx) } /** - * virtqueue_enable_cb_delayed - restart callbacks after disable_cb. + * zxdh_virtqueue_enable_cb_delayed - restart callbacks after disable_cb. * @_vq: the struct virtqueue we're talking about. * * This re-enables callbacks but hints to the other side to delay @@ -1890,7 +1890,7 @@ uint32_t mergeable_ctx_to_truesize(void *mrg_ctx) * Caller must ensure we don't call this with other virtqueue * operations at the same time (except where noted). */ -bool virtqueue_enable_cb_delayed(struct virtqueue *_vq) +bool zxdh_virtqueue_enable_cb_delayed(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -1898,7 +1898,7 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq) vq->event_triggered = false; } - return virtqueue_enable_cb_delayed_packed(_vq); + return zxdh_virtqueue_enable_cb_delayed_packed(_vq); } void virtnet_poll_cleantx(struct receive_queue *rq) @@ -1914,9 +1914,9 @@ void virtnet_poll_cleantx(struct receive_queue *rq) if (__netif_tx_trylock(txq)) { do { - virtqueue_disable_cb(sq->vq); + zxdh_virtqueue_disable_cb(sq->vq); free_old_xmit_skbs(en_dev->netdev, sq, true); - } while (unlikely(!virtqueue_enable_cb_delayed(sq->vq))); + } while (unlikely(!zxdh_virtqueue_enable_cb_delayed(sq->vq))); if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) { netif_tx_wake_queue(txq); @@ -2026,7 +2026,7 @@ struct sk_buff *page_to_skb(struct zxdh_en_device *en_dev, } /** - * virtqueue_add_outbuf - expose output buffers to other end + * zxdh_virtqueue_add_outbuf - expose output buffers to other end * @vq: the struct virtqueue we're talking about. * @sg: scatterlist (must be well-formed and terminated!) * @num: the number of entries in @sg readable by other side @@ -2038,7 +2038,7 @@ struct sk_buff *page_to_skb(struct zxdh_en_device *en_dev, * * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). */ -int32_t virtqueue_add_outbuf(struct virtqueue *vq, struct scatterlist *sg, +int32_t zxdh_virtqueue_add_outbuf(struct virtqueue *vq, struct scatterlist *sg, uint32_t num, void *data, gfp_t gfp) { return virtqueue_add_packed(vq, &sg, num, 1, 0, data, NULL, gfp); @@ -2064,7 +2064,7 @@ static int __zxdh_en_xdp_xmit_one(struct zxdh_en_device *en_dev, sg_init_one(sq->sg, xdpf->data, xdpf->len); - err = virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdp_to_ptr(xdpf), + err = zxdh_virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdp_to_ptr(xdpf), GFP_ATOMIC); if (unlikely(err)) return -ENOSPC; /* Caller handle free/refcnt */ @@ -2144,7 +2144,7 @@ int zxdh_en_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, } /* Free up any pending old buffers before queueing new ones. */ - while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { + while ((ptr = zxdh_virtqueue_get_buf(sq->vq, &len)) != NULL) { if (likely(is_xdp_frame(ptr))) { struct xdp_frame *frame = ptr_to_xdp(ptr); @@ -2170,7 +2170,7 @@ int zxdh_en_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, if (flags & XDP_XMIT_FLUSH) { if (virtqueue_kick_prepare_packed(sq->vq) && - virtqueue_notify(sq->vq)) + zxdh_virtqueue_notify(sq->vq)) kicks = 1; } out: @@ -2465,7 +2465,7 @@ struct sk_buff *receive_mergeable(struct net_device *netdev, err_skb: put_page(page); while (num_buf-- > 1) { - buf = virtqueue_get_buf(rq->vq, &len); + buf = zxdh_virtqueue_get_buf(rq->vq, &len); if (unlikely(!buf)) { LOG_ERR("%s: rx error: %d buffers missing\n", netdev->name, num_buf); @@ -2673,14 +2673,14 @@ void receive_buf(struct zxdh_en_device *en_dev, struct receive_queue *rq, } /** - * virtqueue_notify - second half of split virtqueue_kick call. + * zxdh_virtqueue_notify - second half of split virtqueue_kick call. * @_vq: the struct virtqueue * * This does not need to be serialized. * * Returns false if host notify failed or queue is broken, otherwise true. */ -bool virtqueue_notify(struct virtqueue *_vq) +bool zxdh_virtqueue_notify(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); @@ -2769,7 +2769,7 @@ int32_t add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp) sg_init_one(rq->sg, buf, len); ctx = mergeable_len_to_ctx(len, headroom); - err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp); + err = zxdh_virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp); if (err < 0) { put_page(virt_to_head_page(buf)); } @@ -2866,7 +2866,7 @@ bool try_fill_recv(struct receive_queue *rq, gfp_t gfp) } } while (rq->vq->num_free); - if (virtqueue_kick_prepare_packed(rq->vq) && virtqueue_notify(rq->vq)) { + if (virtqueue_kick_prepare_packed(rq->vq) && zxdh_virtqueue_notify(rq->vq)) { flags = u64_stats_update_begin_irqsave(&rq->stats.syncp); rq->stats.kicks++; u64_stats_update_end_irqrestore(&rq->stats.syncp, flags); @@ -2892,7 +2892,7 @@ int32_t virtnet_receive(struct receive_queue *rq, int32_t budget, } if (rq->vq->num_free > - min((uint32_t)budget, virtqueue_get_vring_size(rq->vq)) / 2) { + min((uint32_t)budget, zxdh_virtqueue_get_vring_size(rq->vq)) / 2) { if (!try_fill_recv(rq, GFP_ATOMIC)) { schedule_delayed_work(&en_dev->refill, 0); } @@ -2922,7 +2922,7 @@ void virtqueue_napi_complete(struct napi_struct *napi, struct virtqueue *vq, virtqueue_napi_schedule(napi, vq); } } else { - virtqueue_disable_cb(vq); + zxdh_virtqueue_disable_cb(vq); } } @@ -2955,7 +2955,7 @@ int virtnet_poll(struct napi_struct *napi, int budget) if (xdp_xmit & ZXDH_XDP_TX) { sq = zxdh_en_xdp_get_sq(en_dev); if (virtqueue_kick_prepare_packed(sq->vq) && - virtqueue_notify(sq->vq)) { + zxdh_virtqueue_notify(sq->vq)) { u64_stats_update_begin(&sq->stats.syncp); sq->stats.kicks++; u64_stats_update_end(&sq->stats.syncp); @@ -3262,7 +3262,7 @@ void zxdh_en_xmit_pkts(struct virtqueue *tvq) struct napi_struct *napi = &en_dev->sq[vq2txq(tvq)].napi; /* Suppress further interrupts. */ - virtqueue_disable_cb(tvq); + zxdh_virtqueue_disable_cb(tvq); if (napi->weight) { virtqueue_napi_schedule(napi, tvq); diff --git a/drivers/net/ethernet/dinghai/en_aux/queue.h b/drivers/net/ethernet/dinghai/en_aux/queue.h index 09f833d3ea01..b43ad93c1698 100644 --- a/drivers/net/ethernet/dinghai/en_aux/queue.h +++ b/drivers/net/ethernet/dinghai/en_aux/queue.h @@ -870,14 +870,14 @@ void vring_free_queue(struct zxdh_en_device *en_dev, size_t size, void *queue, netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *netdev); bool try_fill_recv(struct receive_queue *rq, gfp_t gfp); inline struct zxdh_net_hdr_rx *skb_vnet_hdr(struct sk_buff *skb); -int32_t virtqueue_add_outbuf(struct virtqueue *vq, struct scatterlist *sg, +int32_t zxdh_virtqueue_add_outbuf(struct virtqueue *vq, struct scatterlist *sg, uint32_t num, void *data, gfp_t gfp); -void virtqueue_disable_cb(struct virtqueue *_vq); +void zxdh_virtqueue_disable_cb(struct virtqueue *_vq); void free_old_xmit_skbs(struct net_device *netdev, struct send_queue *sq, bool in_napi); -bool virtqueue_enable_cb_delayed(struct virtqueue *_vq); +bool zxdh_virtqueue_enable_cb_delayed(struct virtqueue *_vq); bool virtqueue_kick_prepare_packed(struct virtqueue *_vq); -bool virtqueue_notify(struct virtqueue *_vq); +bool zxdh_virtqueue_notify(struct virtqueue *_vq); void zxdh_pf_features_init(struct net_device *netdev); bool zxdh_has_feature(struct zxdh_en_device *en_dev, uint32_t fbit); bool zxdh_has_status(struct net_device *netdev, uint32_t sbit); @@ -890,13 +890,13 @@ int32_t zxdh_vqs_init(struct net_device *netdev); int32_t dh_eq_vqs_vring_int(struct notifier_block *nb, unsigned long action, void *data); int32_t vq2rxq(struct virtqueue *vq); -void *virtqueue_get_buf(struct virtqueue *_vq, uint32_t *len); +void *zxdh_virtqueue_get_buf(struct virtqueue *_vq, uint32_t *len); void *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq, uint32_t *len, void **ctx); -uint32_t virtqueue_get_vring_size(struct virtqueue *_vq); +uint32_t zxdh_virtqueue_get_vring_size(struct virtqueue *_vq); void virtqueue_napi_complete(struct napi_struct *napi, struct virtqueue *vq, int32_t processed); -int32_t virtqueue_add_inbuf_ctx(struct virtqueue *vq, struct scatterlist *sg, +int32_t zxdh_virtqueue_add_inbuf_ctx(struct virtqueue *vq, struct scatterlist *sg, uint32_t num, void *data, void *ctx, gfp_t gfp); bool dh_skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp); diff --git a/drivers/net/ethernet/dinghai/en_pf.c b/drivers/net/ethernet/dinghai/en_pf.c index d835f7eaccb3..4fd7f57b93eb 100644 --- a/drivers/net/ethernet/dinghai/en_pf.c +++ b/drivers/net/ethernet/dinghai/en_pf.c @@ -54,6 +54,9 @@ MODULE_DESCRIPTION(DRV_SUMMARY); MODULE_VERSION(DRV_VERSION); MODULE_LICENSE("Dual BSD/GPL"); +extern int debug_print; +module_param(debug_print, int, 0644); + uint32_t dh_debug_mask; struct slot_id_array dh_slot[DPP_PCIE_SLOT_MAX]; module_param_named(debug_mask, dh_debug_mask, uint, 0644); diff --git a/drivers/net/ethernet/dinghai/log.c b/drivers/net/ethernet/dinghai/log.c index befc13021be0..d78f26350c81 100644 --- a/drivers/net/ethernet/dinghai/log.c +++ b/drivers/net/ethernet/dinghai/log.c @@ -1,4 +1,4 @@ #include int debug_print; -module_param(debug_print, int, 0644); \ No newline at end of file +EXPORT_SYMBOL(debug_print); \ No newline at end of file -- Gitee