-
Notifications
You must be signed in to change notification settings - Fork 92
net: mucse: initial support for rnpm driver from Mucse Technology #867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: mucse: initial support for rnpm driver from Mucse Technology #867
Conversation
Reviewer's GuideThis PR adds a new rnpm Ethernet driver for Mucse n10/n400 cards by introducing full driver code under drivers/net/ethernet/mucse/rnpm, wiring it into the build system via Kconfig and Makefile changes, and enabling it in the default Deepin desktop defconfigs for ARM64, LoongArch, and x86 platforms. Sequence Diagram: Sysfs 'maintain' Operation for rnpm DriversequenceDiagram
actor User
participant Sysfs
participant RnpmDriver["rnpm_adapter (rnpm_sysfs.c)"]
participant DMAC["DMA Controller"]
participant Hardware["Mucse NIC"]
User->>+Sysfs: Write to 'maintain' (req_data)
Sysfs->>+RnpmDriver: maintain_write(buf containing maintain_req, req_data)
RnpmDriver->>+DMAC: Allocate DMA buffer (dma_buf)
DMAC-->>-RnpmDriver: DMA buffer allocated (dma_phy)
RnpmDriver->>RnpmDriver: Copy maintain_req, req_data to dma_buf
RnpmDriver->>+Hardware: rnpm_maintain_req(cmd, arg0, ..., dma_phy)
Hardware-->>-RnpmDriver: Operation complete (err_code)
RnpmDriver->>RnpmDriver: If reply_bytes > 0, copy dma_buf to maintain_buf
RnpmDriver->>+DMAC: Free DMA buffer (dma_buf, dma_phy)
DMAC-->>-RnpmDriver: DMA buffer freed
RnpmDriver-->>-Sysfs: Write complete
Sysfs-->>-User: Write acknowledged
User->>+Sysfs: Read from 'maintain'
Sysfs->>+RnpmDriver: maintain_read(buf, offset, count)
RnpmDriver->>RnpmDriver: Copy from maintain_buf to user buf
RnpmDriver->>RnpmDriver: If end-of-buf, free maintain_buf
RnpmDriver-->>-Sysfs: Data copied
Sysfs-->>-User: Reply data
Class Diagram: rnpm_adapter Core Structure and Sysfs Data TypesclassDiagram
class rnpm_adapter {
+net_device* netdev
+pci_dev* pdev
+rnpm_hw hw
+rnpm_pf_adapter* pf_adapter
+rnpm_ring* tx_ring[]
+rnpm_ring* rx_ring[]
+char* maintain_buf
+void* maintain_dma_buf
+u16 active_vlans[]
+rnpm_sysfs_init() void
+rnpm_sysfs_exit() void
# maintain_write() ssize_t
# maintain_read() ssize_t
# active_vid_store() ssize_t
}
class rnpm_hw {
+u8 __iomem* hw_addr
+pci_dev* pdev
+u16 device_id
+u32 fw_version
+rnpm_mac_info mac
+rnpm_phy_info phy
+rnpm_mbx_info mbx
+rnpm_pcs_info pcs
+rd32(reg) u32
+wr32(reg, val) void
}
class rnpm_ring {
+net_device* netdev
+u16 rnpm_queue_idx
+int count
+int next_to_use
+int next_to_clean
+void* desc_ring_addr
+rnpm_tx_desc* tx_descs
+rnpm_rx_desc* rx_descs
}
class maintain_req {
+int magic
+int cmd
+int arg0
+int req_data_bytes
+int reply_bytes
+char data[]
}
class ucfg_mac_sn {
+unsigned char macaddr[64]
+unsigned char sn[32]
+int magic
+char rev[52]
+unsigned char pn[32]
}
rnpm_adapter "1" *-- "1" rnpm_hw : contains
rnpm_adapter "1" o-- "0..*" rnpm_ring : manages
rnpm_adapter ..> maintain_req : uses_for_sysfs
rnpm_adapter ..> ucfg_mac_sn : uses_for_sysfs
Class Diagram: rnpm_hw Structure and Hardware Abstraction OperationsclassDiagram
class rnpm_hw {
+u8 __iomem* hw_addr
+pci_dev* pdev
+u16 device_id
+u32 fw_version
+rnpm_mac_info mac
+rnpm_phy_info phy
+rnpm_mbx_info mbx
+rnpm_pcs_info pcs
+rd32(reg) u32
+wr32(reg, val) void
}
class rnpm_mac_info {
+rnpm_mac_operations ops
+u8 addr[6]
+u8 perm_addr[6]
}
class rnpm_phy_info {
+rnpm_phy_operations ops
+rnpm_phy_type type
+u32 id
}
class rnpm_mbx_info {
+rnpm_mbx_operations ops
+rnpm_mbx_stats stats
+mutex* lock
}
class rnpm_pcs_info {
+rnpm_pcs_operations ops
+int pcs_count
}
class rnpm_mac_operations {
<<Interface>>
+init_hw(rnpm_hw*) s32
+reset_hw(rnpm_hw*) s32
+check_link(rnpm_hw*, rnpm_link_speed*, bool*, bool) s32
+set_rar(rnpm_hw*, u32, u8*, u32, u32) s32
+mac_loopback(rnpm_hw*, bool) bool
}
class rnpm_phy_operations {
<<Interface>>
+identify(rnpm_hw*) s32
+init(rnpm_hw*) s32
+read_reg(rnpm_hw*, u32, u32, u16*) s32
+write_reg(rnpm_hw*, u32, u32, u16) s32
}
class rnpm_mbx_operations {
<<Interface>>
+init_params(rnpm_hw*) s32
+read(rnpm_hw*, u32*, u16, MBX_ID) s32
+write(rnpm_hw*, u32*, u16, MBX_ID) s32
}
class rnpm_pcs_operations {
<<Interface>>
+read(rnpm_hw*, int, u32) u32
+write(rnpm_hw*, int, u32, u32) void
}
rnpm_hw "1" *-- "1" rnpm_mac_info : has
rnpm_hw "1" *-- "1" rnpm_phy_info : has
rnpm_hw "1" *-- "1" rnpm_mbx_info : has
rnpm_hw "1" *-- "1" rnpm_pcs_info : has
rnpm_mac_info ..> rnpm_mac_operations : uses
rnpm_phy_info ..> rnpm_phy_operations : uses
rnpm_mbx_info ..> rnpm_mbx_operations : uses
rnpm_pcs_info ..> rnpm_pcs_operations : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Hi @senbao. Thanks for your PR. 😃 |
Hi @senbao. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces initial support for the Mucse rnpm network driver, implementing key functionalities such as firmware mailbox handling, PHY/PCS, PTP, and MPE support.
- Adds multiple new driver source files and header definitions under drivers/net/ethernet/mucse/rnpm
- Integrates build and configuration support via updates to Makefiles, Kconfig, and defconfig files
- Implements several protocols and hardware interfaces including TC parsing, PHY operations, and MPE firmware handling
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
drivers/net/ethernet/mucse/rnpm/version.h | Introduces a version header including Git commit identifier |
drivers/net/ethernet/mucse/rnpm/rnpm_tc_u32_parse.h | Provides functions for parsing TC U32 filter values |
drivers/net/ethernet/mucse/rnpm/rnpm_tc.h | Declares interfaces for TC handling |
drivers/net/ethernet/mucse/rnpm/rnpm_tc.c | Implements TC related functions |
drivers/net/ethernet/mucse/rnpm/rnpm_sriov.h | Declares SR-IOV functions |
drivers/net/ethernet/mucse/rnpm/rnpm_ptp.h | Defines constants and functions for PTP timestamp operations |
drivers/net/ethernet/mucse/rnpm/rnpm_phy.h | Declares PHY-related operations |
drivers/net/ethernet/mucse/rnpm/rnpm_phy.c | Implements generic PHY operations |
drivers/net/ethernet/mucse/rnpm/rnpm_pcs.h & .c | Provide PCS register access operations |
drivers/net/ethernet/mucse/rnpm/rnpm_n10.c | Implements NIC-specific functionality including MAC address retrieval |
drivers/net/ethernet/mucse/rnpm/rnpm_mpe.h & .c | Implements MPE and RPU firmware download and control functions |
drivers/net/ethernet/mucse/rnpm/rnpm_mbx.h | Declares mailbox interface functions |
drivers/net/ethernet/mucse/rnpm/Makefile | Specifies the new rnpm object file list for compilation |
drivers/net/ethernet/mucse/Makefile | Updates build integration to include the new rnpm driver |
arch//deepin__desktop_defconfig | Enables CONFIG_MXGBEM for all supported architectures |
drivers/net/ethernet/mucse/Kconfig | Adds a new Kconfig entry for the MXGBEM driver |
Comments suppressed due to low confidence (3)
drivers/net/ethernet/mucse/rnpm/rnpm_ptp.h:37
- Clarify and correct the comment describing PTP timestamping; the current phrasing is unclear and contains typos.
/* Note 802.1 AS Is work Over Ethernet FramesC_Sub_Second_Incremen
drivers/net/ethernet/mucse/rnpm/rnpm_mpe.c:37
- Typo in macro name 'iowrite32_arrary' should be corrected to 'iowrite32_array' for clarity and consistency.
#define iowrite32_arrary(rpubase, offset, array, size) \
drivers/net/ethernet/mucse/rnpm/rnpm_mpe.c:185
- Correct the typo 'imvalid' to 'invalid' in the error message to avoid confusion.
dev_err(&pf_adapter->pdev->dev, "imvalid mpe bin. magic-code error\n");
|
||
struct rnpm_match_parser { | ||
int off; /* the skb offset begin form the 12 bytes mac_type */ | ||
/* parse the value/mask to realy value*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the typo 'realy' to 'real' or 'actual' for clarity in the comment.
/* parse the value/mask to realy value*/ | |
/* parse the value/mask to real value*/ |
Copilot uses AI. Check for mistakes.
memcpy(&f->filter.formatted.src_ip_mask[0], &mask, sizeof(u32)); | ||
|
||
f->filter.formatted.flow_type = RNPM_ATR_FLOW_TYPE_IPV4; | ||
f->filter.layer2_formate.proto = htons(ETH_P_IP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider correcting 'layer2_formate' to 'layer2_format' to improve naming clarity.
f->filter.layer2_formate.proto = htons(ETH_P_IP); | |
f->filter.layer2_format.proto = htons(ETH_P_IP); |
Copilot uses AI. Check for mistakes.
if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL) | ||
hw->phy.ops.reset(hw); | ||
if (!(hw->mac.mac_flags & RNPM_FLAGS_INIT_MAC_ADDRESS)) { | ||
rnpm_get_permtion_mac_addr(hw, hw->mac.perm_addr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct 'permtion' to 'permission' to reflect the intended meaning.
rnpm_get_permtion_mac_addr(hw, hw->mac.perm_addr); | |
rnpm_get_permission_mac_addr(hw, hw->mac.perm_addr); |
Copilot uses AI. Check for mistakes.
6cd07d3
to
13b97de
Compare
I deleted this error code long ago. Why does it still keep reporting this non-existent code? I have recompiled it 4 times |
This driver is to support mucse n10/n400 4/8 ports ethernet card Signed-off-by: gu.huiguang <[email protected]>
deepin pr auto review-- |
Just ignore it. |
b875bfd
into
deepin-community:linux-6.6.y
You got me. |
@senbao Please also check LLVM compilation next time. |
This driver is to support mucse n10/n400 4/8 ports ethernet card
update files:
arch/arm64/configs/deepin_arm64_desktop_defconfig
arch/loongarch/configs/deepin_loongarch_desktop_defconfig
arch/x86/configs/deepin_x86_desktop_defconfig
drivers/net/ethernet/mucse/Kconfig
drivers/net/ethernet/mucse/Makefile
drivers/net/ethernet/mucse/rnpm
Summary by Sourcery
Add initial Mucse Technology rnpm driver for n10/n400 multi-port 1/10Gb PCIe network cards
New Features:
Enhancements: