diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet.c linux-5.4.166/drivers/staging/octeon/ethernet.c --- linux-5.10.83/drivers/staging/octeon/ethernet.c 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet.c 2021-12-16 21:35:09.626381913 +0100 @@ -173,7 +173,7 @@ */ int cvm_oct_free_work(void *work_queue_entry) { - struct cvmx_wqe *work = work_queue_entry; + cvmx_wqe_t *work = work_queue_entry; int segments = work->word2.s.bufs; union cvmx_buf_ptr segment_ptr = work->packet_ptr; @@ -461,7 +461,7 @@ struct octeon_ethernet *priv = netdev_priv(dev); int interface = INTERFACE(priv->port); int index = INDEX(priv->port); - union cvmx_helper_link_info link_info; + cvmx_helper_link_info_t link_info; int rv; rv = cvm_oct_phy_setup_device(dev); @@ -497,7 +497,7 @@ void cvm_oct_link_poll(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); - union cvmx_helper_link_info link_info; + cvmx_helper_link_info_t link_info; link_info = cvmx_helper_link_get(priv->port); if (link_info.u64 == priv->link_info) @@ -690,6 +690,8 @@ mtu_overhead += VLAN_HLEN; #endif + octeon_mdiobus_force_mod_depencency(); + pip = pdev->dev.of_node; if (!pip) { pr_err("Error: No 'pip' in /aliases\n"); @@ -994,7 +996,6 @@ module_platform_driver(cvm_oct_driver); -MODULE_SOFTDEP("pre: mdio-cavium"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Cavium Networks "); MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver."); diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet-defines.h linux-5.4.166/drivers/staging/octeon/ethernet-defines.h --- linux-5.10.83/drivers/staging/octeon/ethernet-defines.h 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet-defines.h 2021-12-16 21:35:09.622381885 +0100 @@ -22,19 +22,19 @@ #define __ETHERNET_DEFINES_H__ #ifdef CONFIG_NETFILTER -#define REUSE_SKBUFFS_WITHOUT_FREE 0 +#define REUSE_SKBUFFS_WITHOUT_FREE 0 #else -#define REUSE_SKBUFFS_WITHOUT_FREE 1 +#define REUSE_SKBUFFS_WITHOUT_FREE 1 #endif -#define USE_ASYNC_IOBDMA (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0) +#define USE_ASYNC_IOBDMA (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0) /* Maximum number of SKBs to try to free per xmit packet. */ -#define MAX_OUT_QUEUE_DEPTH 1000 +#define MAX_OUT_QUEUE_DEPTH 1000 #define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32)) #define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32)) -#define TOTAL_NUMBER_OF_PORTS (CVMX_PIP_NUM_INPUT_PORTS + 1) +#define TOTAL_NUMBER_OF_PORTS (CVMX_PIP_NUM_INPUT_PORTS + 1) #endif /* __ETHERNET_DEFINES_H__ */ diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet-mdio.c linux-5.4.166/drivers/staging/octeon/ethernet-mdio.c --- linux-5.10.83/drivers/staging/octeon/ethernet-mdio.c 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet-mdio.c 2021-12-16 21:35:09.622381885 +0100 @@ -65,7 +65,7 @@ } void cvm_oct_note_carrier(struct octeon_ethernet *priv, - union cvmx_helper_link_info li) + cvmx_helper_link_info_t li) { if (li.s.link_up) { pr_notice_ratelimited("%s: %u Mbps %s duplex, port %d, queue %d\n", @@ -81,7 +81,7 @@ void cvm_oct_adjust_link(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); - union cvmx_helper_link_info link_info; + cvmx_helper_link_info_t link_info; link_info.u64 = 0; link_info.s.link_up = dev->phydev->link ? 1 : 0; @@ -106,7 +106,7 @@ { struct octeon_ethernet *priv = netdev_priv(dev); int interface = INTERFACE(priv->port); - union cvmx_helper_link_info link_info; + cvmx_helper_link_info_t link_info; union cvmx_gmxx_prtx_cfg gmx_cfg; int index = INDEX(priv->port); @@ -157,7 +157,7 @@ of_node_put(phy_node); if (!phydev) - return -EPROBE_DEFER; + return -ENODEV; priv->last_link = 0; phy_start(phydev); diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet-mdio.h linux-5.4.166/drivers/staging/octeon/ethernet-mdio.h --- linux-5.10.83/drivers/staging/octeon/ethernet-mdio.h 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet-mdio.h 2021-12-16 21:35:09.626381913 +0100 @@ -22,5 +22,7 @@ extern const struct ethtool_ops cvm_oct_ethtool_ops; +void octeon_mdiobus_force_mod_depencency(void); + int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int cvm_oct_phy_setup_device(struct net_device *dev); diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet-rgmii.c linux-5.4.166/drivers/staging/octeon/ethernet-rgmii.c --- linux-5.10.83/drivers/staging/octeon/ethernet-rgmii.c 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet-rgmii.c 2021-12-16 21:35:09.626381913 +0100 @@ -53,7 +53,7 @@ static void cvm_oct_check_preamble_errors(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); - union cvmx_helper_link_info link_info; + cvmx_helper_link_info_t link_info; unsigned long flags; link_info.u64 = priv->link_info; @@ -103,7 +103,7 @@ static void cvm_oct_rgmii_poll(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); - union cvmx_helper_link_info link_info; + cvmx_helper_link_info_t link_info; bool status_change; link_info = cvmx_helper_link_get(priv->port); diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet-rx.c linux-5.4.166/drivers/staging/octeon/ethernet-rx.c --- linux-5.10.83/drivers/staging/octeon/ethernet-rx.c 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet-rx.c 2021-12-16 21:35:09.626381913 +0100 @@ -60,7 +60,7 @@ * * Returns Non-zero if the packet can be dropped, zero otherwise. */ -static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work) +static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work) { int port; @@ -139,7 +139,7 @@ return 1; } -static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb) +static void copy_segments_to_skb(cvmx_wqe_t *work, struct sk_buff *skb) { int segments = work->word2.s.bufs; union cvmx_buf_ptr segment_ptr = work->packet_ptr; @@ -219,7 +219,7 @@ struct sk_buff *skb = NULL; struct sk_buff **pskb = NULL; int skb_in_hw; - struct cvmx_wqe *work; + cvmx_wqe_t *work; int port; if (USE_ASYNC_IOBDMA && did_work_request) diff -Naur linux-5.10.83/drivers/staging/octeon/ethernet-tx.c linux-5.4.166/drivers/staging/octeon/ethernet-tx.c --- linux-5.10.83/drivers/staging/octeon/ethernet-tx.c 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/ethernet-tx.c 2021-12-16 21:35:09.626381913 +0100 @@ -41,7 +41,7 @@ #endif static void cvm_oct_tx_do_cleanup(unsigned long arg); -static DECLARE_TASKLET_OLD(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup); +static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0); /* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2) @@ -127,7 +127,7 @@ */ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) { - union cvmx_pko_command_word0 pko_command; + cvmx_pko_command_word0_t pko_command; union cvmx_buf_ptr hw_buffer; u64 old_scratch; u64 old_scratch2; @@ -514,7 +514,7 @@ void *copy_location; /* Get a work queue entry */ - struct cvmx_wqe *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL); + cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL); if (unlikely(!work)) { printk_ratelimited("%s: Failed to allocate a work queue entry\n", @@ -598,7 +598,7 @@ #endif work->word2.s.is_frag = !((ip_hdr(skb)->frag_off == 0) || (ip_hdr(skb)->frag_off == - cpu_to_be16(1 << 14))); + 1 << 14)); #if 0 /* Assume Linux is sending a good packet */ work->word2.s.IP_exc = 0; diff -Naur linux-5.10.83/drivers/staging/octeon/octeon-ethernet.h linux-5.4.166/drivers/staging/octeon/octeon-ethernet.h --- linux-5.10.83/drivers/staging/octeon/octeon-ethernet.h 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/octeon-ethernet.h 2021-12-16 21:35:09.626381913 +0100 @@ -91,7 +91,7 @@ int cvm_oct_common_open(struct net_device *dev, void (*link_poll)(struct net_device *)); void cvm_oct_note_carrier(struct octeon_ethernet *priv, - union cvmx_helper_link_info li); + cvmx_helper_link_info_t li); void cvm_oct_link_poll(struct net_device *dev); extern int always_use_pow; diff -Naur linux-5.10.83/drivers/staging/octeon/octeon-stubs.h linux-5.4.166/drivers/staging/octeon/octeon-stubs.h --- linux-5.10.83/drivers/staging/octeon/octeon-stubs.h 2021-12-01 09:19:10.000000000 +0100 +++ linux-5.4.166/drivers/staging/octeon/octeon-stubs.h 2021-12-16 21:35:09.626381913 +0100 @@ -1,4 +1,3 @@ -/* SPDX-License-Identifier: GPL-2.0 */ #define CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE 512 #ifndef XKPHYS_TO_PHYS @@ -12,7 +11,7 @@ #define octeon_has_feature(x) 0 #define octeon_get_clock_rate() 0 -#define CVMX_SYNCIOBDMA do { } while (0) +#define CVMX_SYNCIOBDMA do { } while(0) #define CVMX_HELPER_INPUT_TAG_TYPE 0 #define CVMX_HELPER_FIRST_MBUFF_SKIP 7 @@ -23,11 +22,11 @@ #define CVMX_FPA_PACKET_POOL_SIZE 16 #define CVMX_FPA_WQE_POOL (1) #define CVMX_FPA_WQE_POOL_SIZE 16 -#define CVMX_GMXX_RXX_ADR_CAM_EN(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_ADR_CTL(a, b) ((a) + (b)) -#define CVMX_GMXX_PRTX_CFG(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_FRM_MAX(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_JABBER(a, b) ((a) + (b)) +#define CVMX_GMXX_RXX_ADR_CAM_EN(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_ADR_CTL(a, b) ((a)+(b)) +#define CVMX_GMXX_PRTX_CFG(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_FRM_MAX(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_JABBER(a, b) ((a)+(b)) #define CVMX_IPD_CTL_STATUS 0 #define CVMX_PIP_FRM_LEN_CHKX(a) (a) #define CVMX_PIP_NUM_INPUT_PORTS 1 @@ -42,7 +41,7 @@ #define CVMX_NPI_RSL_INT_BLOCKS 0 #define CVMX_POW_WQ_INT_PC 0 -union cvmx_pip_wqe_word2 { +typedef union { uint64_t u64; struct { uint64_t bufs:8; @@ -118,13 +117,13 @@ uint64_t err_code:8; } snoip; -}; +} cvmx_pip_wqe_word2; union cvmx_pip_wqe_word0 { struct { uint64_t next_ptr:40; uint8_t unused; - __wsum hw_chksum; + uint16_t hw_chksum; } cn38xx; struct { uint64_t pknd:6; /* 0..5 */ @@ -184,15 +183,15 @@ } s; }; -struct cvmx_wqe { +typedef struct { union cvmx_wqe_word0 word0; union cvmx_wqe_word1 word1; - union cvmx_pip_wqe_word2 word2; + cvmx_pip_wqe_word2 word2; union cvmx_buf_ptr packet_ptr; uint8_t packet_data[96]; -}; +} cvmx_wqe_t; -union cvmx_helper_link_info { +typedef union { uint64_t u64; struct { uint64_t reserved_20_63:44; @@ -200,18 +199,18 @@ uint64_t full_duplex:1; /**< 1 if the link is full duplex */ uint64_t speed:18; /**< Speed of the link in Mbps */ } s; -}; +} cvmx_helper_link_info_t; -enum cvmx_fau_reg_32 { +typedef enum { CVMX_FAU_REG_32_START = 0, -}; +} cvmx_fau_reg_32_t; -enum cvmx_fau_op_size { +typedef enum { CVMX_FAU_OP_SIZE_8 = 0, CVMX_FAU_OP_SIZE_16 = 1, CVMX_FAU_OP_SIZE_32 = 2, CVMX_FAU_OP_SIZE_64 = 3 -}; +} cvmx_fau_op_size_t; typedef enum { CVMX_SPI_MODE_UNKNOWN = 0, @@ -383,7 +382,6 @@ uint64_t reserved_41_63:23; } s; }; - typedef struct { uint32_t dropped_octets; uint32_t dropped_packets; @@ -1139,27 +1137,27 @@ } cn50xx; }; -union cvmx_pko_command_word0 { +typedef union { uint64_t u64; struct { - uint64_t total_bytes:16; - uint64_t segs:6; - uint64_t dontfree:1; - uint64_t ignore_i:1; - uint64_t ipoffp1:7; - uint64_t gather:1; - uint64_t rsp:1; - uint64_t wqp:1; - uint64_t n2:1; - uint64_t le:1; - uint64_t reg0:11; - uint64_t subone0:1; - uint64_t reg1:11; - uint64_t subone1:1; - uint64_t size0:2; - uint64_t size1:2; + uint64_t total_bytes:16; + uint64_t segs:6; + uint64_t dontfree:1; + uint64_t ignore_i:1; + uint64_t ipoffp1:7; + uint64_t gather:1; + uint64_t rsp:1; + uint64_t wqp:1; + uint64_t n2:1; + uint64_t le:1; + uint64_t reg0:11; + uint64_t subone0:1; + uint64_t reg1:11; + uint64_t subone1:1; + uint64_t size0:2; + uint64_t size1:2; } s; -}; +} cvmx_pko_command_word0_t; union cvmx_ciu_timx { uint64_t u64; @@ -1180,18 +1178,16 @@ } s; }; -static inline int32_t cvmx_fau_fetch_and_add32(enum cvmx_fau_reg_32 reg, +static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg, int32_t value) { return value; } -static inline void cvmx_fau_atomic_add32(enum cvmx_fau_reg_32 reg, - int32_t value) +static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value) { } -static inline void cvmx_fau_atomic_write32(enum cvmx_fau_reg_32 reg, - int32_t value) +static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value) { } static inline uint64_t cvmx_scratch_read64(uint64_t address) @@ -1202,7 +1198,7 @@ static inline void cvmx_scratch_write64(uint64_t address, uint64_t value) { } -static inline int cvmx_wqe_get_grp(struct cvmx_wqe *work) +static inline int cvmx_wqe_get_grp(cvmx_wqe_t *work) { return 0; } @@ -1271,15 +1267,15 @@ return 0; } -static inline union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port) +static inline cvmx_helper_link_info_t cvmx_helper_link_get(int ipd_port) { - union cvmx_helper_link_info ret = { .u64 = 0 }; + cvmx_helper_link_info_t ret = { .u64 = 0 }; return ret; } static inline int cvmx_helper_link_set(int ipd_port, - union cvmx_helper_link_info link_info) + cvmx_helper_link_info_t link_info) { return 0; } @@ -1346,17 +1342,17 @@ { } static inline void cvmx_pow_work_request_async(int scr_addr, - cvmx_pow_wait_t wait) + cvmx_pow_wait_t wait) { } -static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr) +static inline cvmx_wqe_t *cvmx_pow_work_response_async(int scr_addr) { - struct cvmx_wqe *wqe = (void *)(unsigned long)scr_addr; + cvmx_wqe_t *wqe = (void *)(unsigned long)scr_addr; return wqe; } -static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait) +static inline cvmx_wqe_t *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait) { return (void *)(unsigned long)wait; } @@ -1368,7 +1364,7 @@ } static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr, - enum cvmx_fau_reg_32 reg, + cvmx_fau_reg_32_t reg, int32_t value) { } @@ -1377,7 +1373,6 @@ int port) { union cvmx_gmxx_rxx_rx_inbnd r; - r.u64 = 0; return r; } @@ -1387,43 +1382,45 @@ { } static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(uint64_t port, - uint64_t queue, union cvmx_pko_command_word0 pko_command, + uint64_t queue, cvmx_pko_command_word0_t pko_command, union cvmx_buf_ptr packet, cvmx_pko_lock_t use_locking) { - return 0; + cvmx_pko_status_t ret = 0; + + return ret; } -static inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port) +static inline void cvmx_wqe_set_port(cvmx_wqe_t *work, int port) { } -static inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos) +static inline void cvmx_wqe_set_qos(cvmx_wqe_t *work, int qos) { } -static inline int cvmx_wqe_get_qos(struct cvmx_wqe *work) +static inline int cvmx_wqe_get_qos(cvmx_wqe_t *work) { return 0; } -static inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp) +static inline void cvmx_wqe_set_grp(cvmx_wqe_t *work, int grp) { } -static inline void cvmx_pow_work_submit(struct cvmx_wqe *wqp, uint32_t tag, +static inline void cvmx_pow_work_submit(cvmx_wqe_t *wqp, uint32_t tag, enum cvmx_pow_tag_type tag_type, uint64_t qos, uint64_t grp) { } -#define CVMX_ASXX_RX_CLK_SETX(a, b) ((a) + (b)) -#define CVMX_ASXX_TX_CLK_SETX(a, b) ((a) + (b)) +#define CVMX_ASXX_RX_CLK_SETX(a, b) ((a)+(b)) +#define CVMX_ASXX_TX_CLK_SETX(a, b) ((a)+(b)) #define CVMX_CIU_TIMX(a) (a) -#define CVMX_GMXX_RXX_ADR_CAM0(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_ADR_CAM1(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_ADR_CAM2(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_ADR_CAM3(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_ADR_CAM4(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_ADR_CAM5(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_FRM_CTL(a, b) ((a) + (b)) -#define CVMX_GMXX_RXX_INT_REG(a, b) ((a) + (b)) -#define CVMX_GMXX_SMACX(a, b) ((a) + (b)) +#define CVMX_GMXX_RXX_ADR_CAM0(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_ADR_CAM1(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_ADR_CAM2(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_ADR_CAM3(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_ADR_CAM4(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_ADR_CAM5(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_FRM_CTL(a, b) ((a)+(b)) +#define CVMX_GMXX_RXX_INT_REG(a, b) ((a)+(b)) +#define CVMX_GMXX_SMACX(a, b) ((a)+(b)) #define CVMX_PIP_PRT_TAGX(a) (a) #define CVMX_POW_PP_GRP_MSKX(a) (a) #define CVMX_POW_WQ_INT_THRX(a) (a)