]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: txgbe: rename the SFP related
authorJiawen Wu <jiawenwu@trustnetic.com>
Tue, 18 Nov 2025 08:02:56 +0000 (16:02 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 20 Nov 2025 11:47:26 +0000 (12:47 +0100)
QSFP supported will be introduced for AML 40G devices, the code related
to identify various modules should be renamed to more appropriate names.

And struct txgbe_hic_i2c_read used to get module information is renamed
as struct txgbe_hic_get_module_info, because another SW-FW command to
read I2C will be added later.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Link: https://patch.msgid.link/20251118080259.24676-3-jiawenwu@trustnetic.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/wangxun/libwx/wx_type.h
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.h
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h

index b1a6ef5709a9284e0a86ce2e6ffcf42c0d4c7b3f..29e5c5470c94beef85f9b43ea24a6bc6a309b2f9 100644 (file)
@@ -1249,7 +1249,7 @@ enum wx_pf_flags {
        WX_FLAG_RX_HWTSTAMP_IN_REGISTER,
        WX_FLAG_PTP_PPS_ENABLED,
        WX_FLAG_NEED_LINK_CONFIG,
-       WX_FLAG_NEED_SFP_RESET,
+       WX_FLAG_NEED_MODULE_RESET,
        WX_FLAG_NEED_UPDATE_LINK,
        WX_FLAG_NEED_DO_RESET,
        WX_FLAG_RX_MERGE_ENABLED,
index a7650f548fa4d52b49c9e99457b68a5e69837a76..432880ccc6408c9865091f005fd0d32743f67a8f 100644 (file)
@@ -38,7 +38,7 @@ irqreturn_t txgbe_gpio_irq_handler_aml(int irq, void *data)
        wr32(wx, WX_GPIO_INTMASK, 0xFF);
        status = rd32(wx, WX_GPIO_INTSTATUS);
        if (status & TXGBE_GPIOBIT_2) {
-               set_bit(WX_FLAG_NEED_SFP_RESET, wx->flags);
+               set_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags);
                wr32(wx, WX_GPIO_EOI, TXGBE_GPIOBIT_2);
                wx_service_event_schedule(wx);
        }
@@ -63,15 +63,16 @@ int txgbe_test_hostif(struct wx *wx)
                                        WX_HI_COMMAND_TIMEOUT, true);
 }
 
-static int txgbe_identify_sfp_hostif(struct wx *wx, struct txgbe_hic_i2c_read *buffer)
+static int txgbe_identify_module_hostif(struct wx *wx,
+                                       struct txgbe_hic_get_module_info *buffer)
 {
-       buffer->hdr.cmd = FW_READ_SFP_INFO_CMD;
-       buffer->hdr.buf_len = sizeof(struct txgbe_hic_i2c_read) -
+       buffer->hdr.cmd = FW_GET_MODULE_INFO_CMD;
+       buffer->hdr.buf_len = sizeof(struct txgbe_hic_get_module_info) -
                              sizeof(struct wx_hic_hdr);
        buffer->hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED;
 
        return wx_host_interface_command(wx, (u32 *)buffer,
-                                        sizeof(struct txgbe_hic_i2c_read),
+                                        sizeof(struct txgbe_hic_get_module_info),
                                         WX_HI_COMMAND_TIMEOUT, true);
 }
 
@@ -109,9 +110,9 @@ static void txgbe_get_link_capabilities(struct wx *wx, int *speed,
 {
        struct txgbe *txgbe = wx->priv;
 
-       if (test_bit(PHY_INTERFACE_MODE_25GBASER, txgbe->sfp_interfaces))
+       if (test_bit(PHY_INTERFACE_MODE_25GBASER, txgbe->link_interfaces))
                *speed = SPEED_25000;
-       else if (test_bit(PHY_INTERFACE_MODE_10GBASER, txgbe->sfp_interfaces))
+       else if (test_bit(PHY_INTERFACE_MODE_10GBASER, txgbe->link_interfaces))
                *speed = SPEED_10000;
        else
                *speed = SPEED_UNKNOWN;
@@ -150,7 +151,7 @@ int txgbe_set_phy_link(struct wx *wx)
        return 0;
 }
 
-static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)
+static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)
 {
        __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
        DECLARE_PHY_INTERFACE_MASK(interfaces);
@@ -204,9 +205,9 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)
        phylink_set(modes, Asym_Pause);
        phylink_set(modes, FIBRE);
 
-       if (!linkmode_equal(txgbe->sfp_support, modes)) {
-               linkmode_copy(txgbe->sfp_support, modes);
-               phy_interface_and(txgbe->sfp_interfaces,
+       if (!linkmode_equal(txgbe->link_support, modes)) {
+               linkmode_copy(txgbe->link_support, modes);
+               phy_interface_and(txgbe->link_interfaces,
                                  wx->phylink_config.supported_interfaces,
                                  interfaces);
                linkmode_copy(txgbe->advertising, modes);
@@ -217,10 +218,10 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)
        return 0;
 }
 
-int txgbe_identify_sfp(struct wx *wx)
+int txgbe_identify_module(struct wx *wx)
 {
-       struct txgbe_hic_i2c_read buffer;
-       struct txgbe_sfp_id *id;
+       struct txgbe_hic_get_module_info buffer;
+       struct txgbe_sff_id *id;
        int err = 0;
        u32 gpio;
 
@@ -228,9 +229,9 @@ int txgbe_identify_sfp(struct wx *wx)
        if (gpio & TXGBE_GPIOBIT_2)
                return -ENODEV;
 
-       err = txgbe_identify_sfp_hostif(wx, &buffer);
+       err = txgbe_identify_module_hostif(wx, &buffer);
        if (err) {
-               wx_err(wx, "Failed to identify SFP module\n");
+               wx_err(wx, "Failed to identify module\n");
                return err;
        }
 
@@ -247,10 +248,10 @@ void txgbe_setup_link(struct wx *wx)
 {
        struct txgbe *txgbe = wx->priv;
 
-       phy_interface_zero(txgbe->sfp_interfaces);
-       linkmode_zero(txgbe->sfp_support);
+       phy_interface_zero(txgbe->link_interfaces);
+       linkmode_zero(txgbe->link_support);
 
-       txgbe_identify_sfp(wx);
+       txgbe_identify_module(wx);
 }
 
 static void txgbe_get_link_state(struct phylink_config *config,
index 25d4971ca0d911cfcd44a323ecc0000d8487f0aa..7c8fa48e68d37886bc68fd447a01169fad2090bc 100644 (file)
@@ -8,7 +8,7 @@ void txgbe_gpio_init_aml(struct wx *wx);
 irqreturn_t txgbe_gpio_irq_handler_aml(int irq, void *data);
 int txgbe_test_hostif(struct wx *wx);
 int txgbe_set_phy_link(struct wx *wx);
-int txgbe_identify_sfp(struct wx *wx);
+int txgbe_identify_module(struct wx *wx);
 void txgbe_setup_link(struct wx *wx);
 int txgbe_phylink_init_aml(struct txgbe *txgbe);
 
index e8dd277a35c7a42b37295eeaafefcb97f9c62774..d7f9053594588d39fd0457e8df4906afbff6d507 100644 (file)
@@ -32,7 +32,7 @@ int txgbe_get_link_ksettings(struct net_device *netdev,
        cmd->base.port = txgbe->link_port;
        cmd->base.autoneg = phylink_test(txgbe->advertising, Autoneg) ?
                            AUTONEG_ENABLE : AUTONEG_DISABLE;
-       linkmode_copy(cmd->link_modes.supported, txgbe->sfp_support);
+       linkmode_copy(cmd->link_modes.supported, txgbe->link_support);
        linkmode_copy(cmd->link_modes.advertising, txgbe->advertising);
 
        return 0;
index daa761e48f9d1348293c0341ffb0e4f5354e4a07..91d1b4e68126528e01e4193d41ea80f9db197cbc 100644 (file)
@@ -89,21 +89,21 @@ static int txgbe_enumerate_functions(struct wx *wx)
        return physfns;
 }
 
-static void txgbe_sfp_detection_subtask(struct wx *wx)
+static void txgbe_module_detection_subtask(struct wx *wx)
 {
        int err;
 
-       if (!test_bit(WX_FLAG_NEED_SFP_RESET, wx->flags))
+       if (!test_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags))
                return;
 
-       /* wait for SFP module ready */
+       /* wait for SFF module ready */
        msleep(200);
 
-       err = txgbe_identify_sfp(wx);
+       err = txgbe_identify_module(wx);
        if (err)
                return;
 
-       clear_bit(WX_FLAG_NEED_SFP_RESET, wx->flags);
+       clear_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags);
 }
 
 static void txgbe_link_config_subtask(struct wx *wx)
@@ -128,7 +128,7 @@ static void txgbe_service_task(struct work_struct *work)
 {
        struct wx *wx = container_of(work, struct wx, service_task);
 
-       txgbe_sfp_detection_subtask(wx);
+       txgbe_module_detection_subtask(wx);
        txgbe_link_config_subtask(wx);
 
        wx_service_event_complete(wx);
index b9a4ba48f5b99f8d6aa8fe567663184c651c4765..c115ed659544fd7da49875b9c5d1e28d4db993a7 100644 (file)
@@ -341,9 +341,9 @@ void txgbe_do_reset(struct net_device *netdev);
 
 #define FW_PHY_GET_LINK_CMD             0xC0
 #define FW_PHY_SET_LINK_CMD             0xC1
-#define FW_READ_SFP_INFO_CMD            0xC5
+#define FW_GET_MODULE_INFO_CMD          0xC5
 
-struct txgbe_sfp_id {
+struct txgbe_sff_id {
        u8 identifier;          /* A0H 0x00 */
        u8 com_1g_code;         /* A0H 0x06 */
        u8 com_10g_code;        /* A0H 0x03 */
@@ -358,9 +358,9 @@ struct txgbe_sfp_id {
        u8 reserved[5];
 };
 
-struct txgbe_hic_i2c_read {
+struct txgbe_hic_get_module_info {
        struct wx_hic_hdr hdr;
-       struct txgbe_sfp_id id;
+       struct txgbe_sff_id id;
 };
 
 struct txgbe_hic_ephy_setlink {
@@ -451,8 +451,8 @@ struct txgbe {
        int fdir_filter_count;
        spinlock_t fdir_perfect_lock; /* spinlock for FDIR */
 
-       DECLARE_PHY_INTERFACE_MASK(sfp_interfaces);
-       __ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support);
+       DECLARE_PHY_INTERFACE_MASK(link_interfaces);
+       __ETHTOOL_DECLARE_LINK_MODE_MASK(link_support);
        __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
        u8 link_port;
 };