net: stmmac: replace the tso_en field with a flag
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 10 Jul 2023 08:59:54 +0000 (10:59 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 14 Jul 2023 03:57:14 +0000 (20:57 -0700)
Drop the boolean field of the plat_stmmacenet_data structure in favor of a
simple bitfield flag.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Link: https://lore.kernel.org/r/20230710090001.303225-6-brgl@bgdev.pl
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
include/linux/stmmac.h

index 0c12ab67c27bc34cd9b78dcfac2c74d3cfed9224..b5efd9c2eac78a9fd88b3f906cbc55dc2fdde62c 100644 (file)
@@ -113,7 +113,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
        /* dwc-qos needs GMAC4, AAL, TSO and PMT */
        plat_dat->has_gmac4 = 1;
        plat_dat->dma_cfg->aal = 1;
-       plat_dat->tso_en = 1;
+       plat_dat->flags |= STMMAC_FLAG_TSO_EN;
        plat_dat->pmt = 1;
 
        return 0;
index c690ec1b9bab4816d71532fb7b5e6ef4eb4c4fc4..faa6f4ec68389c32872624b62039eb01ff355eee 100644 (file)
@@ -458,8 +458,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
        plat->has_gmac = 0;
        plat->has_gmac4 = 1;
        plat->force_sf_dma_mode = 0;
-       plat->tso_en = 1;
-       plat->flags |= STMMAC_FLAG_SPH_DISABLE;
+       plat->flags |= (STMMAC_FLAG_TSO_EN | STMMAC_FLAG_SPH_DISABLE);
 
        /* Multiplying factor to the clk_eee_i clock time
         * period to make it closer to 100 ns. This value
index 3cfa4d2e1929aad9689e4e2e0892981f470c0fda..4b58904ee132b4855c1d14c7f81b9760f597b3ee 100644 (file)
@@ -783,7 +783,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
        if (ethqos->has_emac_ge_3)
                plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
        plat_dat->pmt = 1;
-       plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
+       if (of_property_read_bool(np, "snps,tso"))
+               plat_dat->flags |= STMMAC_FLAG_TSO_EN;
        if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))
                plat_dat->rx_clk_runs_in_lpi = 1;
        if (data->has_integrated_pcs)
index f8367c5b490baa64d01ac753ed5abf733defbab8..5e8aa03cffaee73534a4fff261a210b9c6ae52cb 100644 (file)
@@ -290,7 +290,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
        }
 
        plat->has_xgmac = 1;
-       plat->tso_en = 1;
+       plat->flags |= STMMAC_FLAG_TSO_EN;
        plat->pmt = 1;
        plat->bsp_priv = mgbe;
 
index 3df32658b5bb4ba7d145ab0b83c28e4d98d7b320..73002ed923aaaaddeaff28b3e869c1a913d7d02a 100644 (file)
@@ -5677,7 +5677,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
                features &= ~NETIF_F_CSUM_MASK;
 
        /* Disable tso if asked by ethtool */
-       if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) {
+       if ((priv->plat->flags & STMMAC_FLAG_TSO_EN) && (priv->dma_cap.tsoen)) {
                if (features & NETIF_F_TSO)
                        priv->tso = true;
                else
@@ -7250,7 +7250,7 @@ int stmmac_dvr_probe(struct device *device,
                ndev->hw_features |= NETIF_F_HW_TC;
        }
 
-       if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) {
+       if ((priv->plat->flags & STMMAC_FLAG_TSO_EN) && (priv->dma_cap.tsoen)) {
                ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
                if (priv->plat->has_gmac4)
                        ndev->hw_features |= NETIF_F_GSO_UDP_L4;
index 644bb54f5f0204bc117e112810603eccef1a1b7b..352b01678c223204e29153f82d0118dce44d1e8d 100644 (file)
@@ -77,7 +77,7 @@ static int snps_gmac5_default_data(struct pci_dev *pdev,
        plat->clk_csr = 5;
        plat->has_gmac4 = 1;
        plat->force_sf_dma_mode = 1;
-       plat->tso_en = 1;
+       plat->flags |= STMMAC_FLAG_TSO_EN;
        plat->pmt = 1;
 
        /* Set default value for multicast hash bins */
index 231152ee5a323e4dccb2b4b10e881cf8d290c95b..f51522cb0061145804c3f5354a5af74fcf036379 100644 (file)
@@ -525,7 +525,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
                plat->has_gmac4 = 1;
                plat->has_gmac = 0;
                plat->pmt = 1;
-               plat->tso_en = of_property_read_bool(np, "snps,tso");
+               if (of_property_read_bool(np, "snps,tso"))
+                       plat->flags |= STMMAC_FLAG_TSO_EN;
        }
 
        if (of_device_is_compatible(np, "snps,dwmac-3.610") ||
@@ -538,7 +539,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
        if (of_device_is_compatible(np, "snps,dwxgmac")) {
                plat->has_xgmac = 1;
                plat->pmt = 1;
-               plat->tso_en = of_property_read_bool(np, "snps,tso");
+               if (of_property_read_bool(np, "snps,tso"))
+                       plat->flags |= STMMAC_FLAG_TSO_EN;
        }
 
        dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
index 66dcf84d024aa5c38d9aeecc8cf1174a33361272..47ae29a9883579aa609dd6090eb580697718dc38 100644 (file)
@@ -208,6 +208,7 @@ struct dwmac4_addrs {
 #define STMMAC_FLAG_SPH_DISABLE                        BIT(1)
 #define STMMAC_FLAG_USE_PHY_WOL                        BIT(2)
 #define STMMAC_FLAG_HAS_SUN8I                  BIT(3)
+#define STMMAC_FLAG_TSO_EN                     BIT(4)
 
 struct plat_stmmacenet_data {
        int bus_id;
@@ -271,7 +272,6 @@ struct plat_stmmacenet_data {
        struct reset_control *stmmac_ahb_rst;
        struct stmmac_axi *axi;
        int has_gmac4;
-       bool tso_en;
        int rss_en;
        int mac_port_sel_speed;
        bool en_tx_lpi_clockgating;