--- a/src/fuxi-gmac-net.c +++ b/src/fuxi-gmac-net.c @@ -768,7 +768,9 @@ static void fxgmac_tx_hang_timer_handler(unsigned long data) #endif { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) + struct fxgmac_channel *channel = timer_container_of(channel, t, expansion.tx_hang_timer); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) struct fxgmac_channel *channel = from_timer(channel, t, expansion.tx_hang_timer); #else struct fxgmac_channel *channel = (struct fxgmac_channel *)data; @@ -866,9 +868,9 @@ if (!channel->tx_ring) break; - del_timer_sync(&channel->tx_timer); + timer_delete_sync(&channel->tx_timer); #if FXGMAC_TX_HANG_TIMER_ENABLED - del_timer_sync(&channel->tx_hang_timer); + timer_delete_sync(&channel->tx_hang_timer); channel->tx_hang_timer_active = 0; #endif } @@ -1913,7 +1915,7 @@ DPRINTK( "mgmt_int_isr %lld\n", pstats->mgmt_int_isr); } -#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4,0,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8)))) +#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4,0,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0))) static void fxgmac_tx_timeout(struct net_device *netdev) #else static void fxgmac_tx_timeout(struct net_device *netdev, unsigned int unused) --- a/src/fuxi-gmac-phy.c +++ b/src/fuxi-gmac-phy.c @@ -318,7 +318,9 @@ static void fxgmac_phy_link_poll(unsigned long data) #endif { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) + struct fxgmac_pdata *pdata = timer_container_of(pdata, t, expansion.phy_poll_tm); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) struct fxgmac_pdata *pdata = from_timer(pdata, t, expansion.phy_poll_tm); #else struct fxgmac_pdata *pdata = (struct fxgmac_pdata*)data; @@ -346,7 +348,9 @@ int fxgmac_phy_timer_init(struct fxgmac_pdata *pdata) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) + timer_init_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)) init_timer_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL); #else init_timer_key(&pdata->expansion.phy_poll_tm, 0, "fuxi_phy_link_update_timer", NULL); @@ -364,7 +368,7 @@ void fxgmac_phy_timer_destroy(struct fxgmac_pdata *pdata) { - del_timer_sync(&pdata->expansion.phy_poll_tm); + timer_delete_sync(&pdata->expansion.phy_poll_tm); DPRINTK("fxgmac_phy_timer removed\n"); } --- a/src/fuxi-os.h +++ b/src/fuxi-os.h @@ -432,7 +432,7 @@ #else #define FXGMAC_PR(x...) do { } while (0) -#define DPRINTK(x...) +#define DPRINTK(x...) do { } while (0) #endif #define IOC_MAGIC 'M' --- /dev/null +++ b/src/Kbuild @@ -0,0 +1,3 @@ +yt6801-objs := fuxi-gmac-common.o fuxi-gmac-desc.o fuxi-gmac-ethtool.o fuxi-gmac-hw.o fuxi-gmac-net.o fuxi-gmac-pci.o fuxi-gmac-phy.o fuxi-efuse.o fuxi-gmac-ioctl.o +obj-m += yt6801.o +ccflags-y += -DFXGMAC_ASPM_ENABLED -DFXGMAC_EPHY_LOOPBACK_DETECT_ENABLED --- a/src/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -################################################################################ -# -# Copyright (c) 2023 Motorcomm, Inc. -# Motorcomm Confidential and Proprietary. -# -# This is Motorcomm NIC driver relevant files. Please don't copy, modify, -# distribute without commercial permission. -# -################################################################################ - -SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/s390x/s390/ -e s/parisc64/parisc/ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ -e s/riscv.*/riscv/) -CURARCH ?= $(SUBARCH) -ARCH ?= $(SUBARCH) -CROSS_COMPILE ?= -#CONFIG_MODULE_SIG=n -PWD :=$(shell pwd) -EXTRA_CFLAGS = -Wall -g -I$(CURDIR) -I$(subst fuxi-linux-release-package/module_fuxi/src,common,$(PWD)) -I$(PWD) -EXTRA_CFLAGS += -DFXGMAC_DEBUG - -KSRC_BASE = /lib/modules/$(shell uname -r) -KSRC = $(KSRC_BASE)/build -#KDST = /lib/modules/$(shell uname -r)/kernel/drivers/net/ethernet/motorcomm/ -KDST = kernel/drivers/net/ethernet/motorcomm -ko_dir = $(KSRC_BASE)/$(KDST)/ -KFILE = yt6801 -ko_full = $(ko_dir)$(KFILE).ko - -yt6801-objs := fuxi-gmac-common.o fuxi-gmac-desc.o fuxi-gmac-ethtool.o fuxi-gmac-hw.o fuxi-gmac-net.o fuxi-gmac-pci.o fuxi-gmac-phy.o fuxi-efuse.o fuxi-gmac-ioctl.o -obj-m += yt6801.o -modules: - make -C $(KSRC) M=$(PWD) modules - -install: - @echo "KFILE: " $(KFILE) - @echo "KDST: " $(KDST) - make -C $(KSRC) M=$(PWD) INSTALL_MOD_DIR=$(KDST) modules_install - sudo ls -l $(ko_dir) - depmod $(shell uname -r) - modprobe $(KFILE) - @file $(ko_full) - @echo install done. - @modinfo $(ko_full) - -uninstall: - sudo ls -l $(ko_dir) - sudo rm $(ko_full) - sudo ls -l $(ko_dir) - -clean: - make -C $(KSRC) M=$(PWD) clean - -.PHONY:modules install uninstall clean