Skip to contentSkip to conversation

i40e: Fix for xdp frame struct usage

PATCH New Alice Michael 3 participants 12 messages Oct 4, 2018 – Oct 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 i40e: Fix for xdp frame struct usage

From: Jan Sokolowski <[email protected]>

Current ifdefs used for xdp frame structs and methods are not properly used, thus failing to build.

Use proper definitions for sections of code using xdp_frame.

---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -2
index 740ea58..c9d209a 100644
@@ -3527,6 +3527,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
 	u16 i = xdp_ring->next_to_use;
 	struct i40e_tx_buffer *tx_bi;
 	struct i40e_tx_desc *tx_desc;
+	void *data = xdpf->data;
 	u32 size = xdpf->len;
 	dma_addr_t dma;
 
@@ -3534,8 +3535,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
 		xdp_ring->tx_stats.tx_busy++;
 		return I40E_XDP_CONSUMED;
 	}
-
-	dma = dma_map_single(xdp_ring->dev, xdpf->data, size, DMA_TO_DEVICE);
+	dma = dma_map_single(xdp_ring->dev, data, size, DMA_TO_DEVICE);
 	if (dma_mapping_error(xdp_ring->dev, dma))
 		return I40E_XDP_CONSUMED;
 
Signature · 1 line
2.9.5
#1 lore raw

PATCH 2/7 i40e: Add capability flag for stopping FW LLDP

From: Krzysztof Galazka <[email protected]>

Add HW capability flag to indicate that firmware supports stopping LLDP agent. This feature has been added in FW API 1.7 for XL710 devices and 1.6 for X722. Also raise expected minor version number for X722 FW API to 6.

---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c     | 6 ++++++
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 4 +++-
 drivers/net/ethernet/intel/i40e/i40e_type.h       | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +6 -0
index 501ee71..7ab61f6 100644
@@ -588,6 +588,12 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw)
 	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
 	    hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) {
 		hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
+		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
+	}
+	if (hw->mac.type == I40E_MAC_X722 &&
+	    hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
+	    hw->aq.api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722) {
+		hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE;
 	}
 
 	/* Newer versions of firmware require lock when reading the NVM */
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +3 -1
index 80e3eec..1150610 100644
@@ -11,7 +11,7 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR	0x0001
-#define I40E_FW_API_VERSION_MINOR_X722	0x0005
+#define I40E_FW_API_VERSION_MINOR_X722	0x0006
 #define I40E_FW_API_VERSION_MINOR_X710	0x0007
 
 #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \
@@ -20,6 +20,8 @@
 
 /* API version 1.7 implements additional link and PHY-specific APIs  */
 #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007
+/* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
+#define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
 
 struct i40e_aq_desc {
 	__le16 flags;
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -0
index 7df969c..17d9d78 100644
@@ -615,6 +615,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_802_1AD_CAPABLE        BIT_ULL(1)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE  BIT_ULL(2)
 #define I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK BIT_ULL(3)
+#define I40E_HW_FLAG_FW_LLDP_STOPPABLE	    BIT_ULL(4)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
Signature · 1 line
2.9.5
#2 lore raw

PATCH 3/7 i40e: Replace strncpy with strlcpy to ensure null termination

In reply to Alice Michael

From: Patryk Ma?ek <[email protected]>

Using strncpy allows destination buffer to be not null terminated after the copying takes place. strlcpy ensures that's not the case by explicitly setting last element in the buffer as '\0'.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 14 +++++++-------
 drivers/net/ethernet/intel/i40e/i40e_ptp.c  |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -7
index f98e0bd..de82129 100644
@@ -14525,23 +14525,23 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 		switch (hw->bus.speed) {
 		case i40e_bus_speed_8000:
-			strncpy(speed, "8.0", PCI_SPEED_SIZE); break;
+			strlcpy(speed, "8.0", PCI_SPEED_SIZE); break;
 		case i40e_bus_speed_5000:
-			strncpy(speed, "5.0", PCI_SPEED_SIZE); break;
+			strlcpy(speed, "5.0", PCI_SPEED_SIZE); break;
 		case i40e_bus_speed_2500:
-			strncpy(speed, "2.5", PCI_SPEED_SIZE); break;
+			strlcpy(speed, "2.5", PCI_SPEED_SIZE); break;
 		default:
 			break;
 		}
 		switch (hw->bus.width) {
 		case i40e_bus_width_pcie_x8:
-			strncpy(width, "8", PCI_WIDTH_SIZE); break;
+			strlcpy(width, "8", PCI_WIDTH_SIZE); break;
 		case i40e_bus_width_pcie_x4:
-			strncpy(width, "4", PCI_WIDTH_SIZE); break;
+			strlcpy(width, "4", PCI_WIDTH_SIZE); break;
 		case i40e_bus_width_pcie_x2:
-			strncpy(width, "2", PCI_WIDTH_SIZE); break;
+			strlcpy(width, "2", PCI_WIDTH_SIZE); break;
 		case i40e_bus_width_pcie_x1:
-			strncpy(width, "1", PCI_WIDTH_SIZE); break;
+			strlcpy(width, "1", PCI_WIDTH_SIZE); break;
 		default:
 			break;
 		}
drivers/net/ethernet/intel/i40e/i40e_ptp.c +1 -1
index 1199f05..e6fc0af 100644
@@ -694,7 +694,7 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf)
 	if (!IS_ERR_OR_NULL(pf->ptp_clock))
 		return 0;
 
-	strncpy(pf->ptp_caps.name, i40e_driver_name,
+	strlcpy(pf->ptp_caps.name, i40e_driver_name,
 		sizeof(pf->ptp_caps.name) - 1);
 	pf->ptp_caps.owner = THIS_MODULE;
 	pf->ptp_caps.max_adj = 999999999;
Signature · 1 line
2.9.5
#3 lore raw

PATCH 4/7 i40e: Protect access to vf control methods

In reply to Alice Michael

From: Jan Sokolowski <[email protected]>

A scenario has been found in which simultaneous addition/removal and modification of VF's might cause unstable behaviour, up to and including kernel panics.

Protect the methods that create/modify/destroy VF's by locking them behind an atomically set bit in PF status bitfield.

---
 drivers/net/ethernet/intel/i40e/i40e.h             |  1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 64 ++++++++++++++++++++--
 2 files changed, 60 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
index 11f0987..f575b03 100644
@@ -147,6 +147,7 @@ enum i40e_state_t {
 	__I40E_CLIENT_SERVICE_REQUESTED,
 	__I40E_CLIENT_L2_CHANGE,
 	__I40E_CLIENT_RESET,
+	__I40E_VIRTCHNL_OP_PENDING,
 	/* This must be last as it determines the size of the BITMAP */
 	__I40E_STATE_SIZE__,
 };
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +59 -5

173 lines not on this page · raw message

Signature · 1 line
2.9.5
#4 lore raw

PATCH 5/7 i40e: Remove negated logic in if statement and fix comment

In reply to Alice Michael

From: Patryk Ma?ek <[email protected]>

Found by upstream review. It also fixes a minor comment formatting to adhere to networking comment formatting.

---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +3 -3
index f35a26c..2bb116f 100644
@@ -4958,8 +4958,8 @@ void i40e_set_ethtool_ops(struct net_device *netdev)
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_pf		*pf = np->vsi->back;
 
-	if (!test_bit(__I40E_RECOVERY_MODE, pf->state))
-		netdev->ethtool_ops = &i40e_ethtool_ops;
-	else
+	if (test_bit(__I40E_RECOVERY_MODE, pf->state))
 		netdev->ethtool_ops = &i40e_ethtool_recovery_mode_ops;
+	else
+		netdev->ethtool_ops = &i40e_ethtool_ops;
 }
Signature · 1 line
2.9.5
#5 lore raw

PATCH 5/7 i40e: Remove negated logic in if statement and fix comment

There is no comment formatting in this patch, maybe just remove the references to fix comment in title and in text.

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Thursday, October 4, 2018 3:18 PM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S97 5/7] i40e: Remove negated logic in if statement and fix comment

From: Patryk Ma?ek <[email protected]>

Found by upstream review. It also fixes a minor comment formatting to adhere to networking comment formatting.

---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +3 -3
index f35a26c..2bb116f 100644
@@ -4958,8 +4958,8 @@ void i40e_set_ethtool_ops(struct net_device *netdev)
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_pf		*pf = np->vsi->back;
 
-	if (!test_bit(__I40E_RECOVERY_MODE, pf->state))
-		netdev->ethtool_ops = &i40e_ethtool_ops;
-	else
+	if (test_bit(__I40E_RECOVERY_MODE, pf->state))
 		netdev->ethtool_ops = &i40e_ethtool_recovery_mode_ops;
+	else
+		netdev->ethtool_ops = &i40e_ethtool_ops;
 }
Signature · 6 lines
2.9.5

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#6 lore raw

PATCH 5/7 i40e: Remove negated logic in if statement and fix comment

In reply to Alice Michael
Quoted 4 lines · Alice Michael

From: Patryk Ma?ek <[email protected]>

Found by upstream review. It also fixes a minor comment formatting to adhere to networking comment formatting.

As far as I can tell, this doesn't apply to what I can see in Jeff's tree. Also, I don't see anything about comment formatting in this patch.

sln

Quoted 23 lines
---
  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +3 -3
index f35a26c..2bb116f 100644
@@ -4958,8 +4958,8 @@ void i40e_set_ethtool_ops(struct net_device *netdev)
  	struct i40e_netdev_priv *np = netdev_priv(netdev);
  	struct i40e_pf		*pf = np->vsi->back;
 
-	if (!test_bit(__I40E_RECOVERY_MODE, pf->state))
-		netdev->ethtool_ops = &i40e_ethtool_ops;
-	else
+	if (test_bit(__I40E_RECOVERY_MODE, pf->state))
  		netdev->ethtool_ops = &i40e_ethtool_recovery_mode_ops;
+	else
+		netdev->ethtool_ops = &i40e_ethtool_ops;
  }
#7 lore raw

PATCH 6/7 i40e: update driver version

In reply to Alice Michael

The version numbers have not been kept up to date and this is an effort to ammend that.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
index de82129..42d7404 100644
@@ -26,8 +26,8 @@ static const char i40e_driver_string[] =
 #define DRV_KERN "-k"
 
 #define DRV_VERSION_MAJOR 2
-#define DRV_VERSION_MINOR 3
-#define DRV_VERSION_BUILD 2
+#define DRV_VERSION_MINOR 7
+#define DRV_VERSION_BUILD 6
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
Signature · 1 line
2.9.5
#8 lore raw

PATCH 7/7 i40e: Allow disabling FW LLDP on X722 devices

In reply to Alice Michael

From: Patryk Ma?ek <[email protected]>

This patch allows disabling FW LLDP agent on X722 devices. It also changes a source of information for this feature from pf->hw_features to pf->hw.flags which are set in i40e_init_adminq.

---
 drivers/net/ethernet/intel/i40e/i40e.h         |  1 -
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 13 +++++++------
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 15 +++++++--------
 3 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
index f575b03..382b39e 100644
@@ -496,7 +496,6 @@ struct i40e_pf {
 #define I40E_HW_STOP_FW_LLDP			BIT(16)
 #define I40E_HW_PORT_ID_VALID			BIT(17)
 #define I40E_HW_RESTART_AUTONEG			BIT(18)
-#define I40E_HW_STOPPABLE_FW_LLDP		BIT(19)
 
 	u32 flags;
 #define I40E_FLAG_RX_CSUM_ENABLED		BIT(0)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +7 -6
index 2bb116f..213e412 100644
@@ -4659,14 +4659,15 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 		return -EOPNOTSUPP;
 
 	/* If the driver detected FW LLDP was disabled on init, this flag could
-	 * be set, however we do not support _changing_ the flag if NPAR is
-	 * enabled or FW API version < 1.7.  There are situations where older
-	 * FW versions/NPAR enabled PFs could disable LLDP, however we _must_
-	 * not allow the user to enable/disable LLDP with this flag on
-	 * unsupported FW versions.
+	 * be set, however we do not support _changing_ the flag:
+	 * - on XL710 if NPAR is enabled or FW API version < 1.7
+	 * - on X722 with FW API version < 1.6
+	 * There are situations where older FW versions/NPAR enabled PFs could
+	 * disable LLDP, however we _must_ not allow the user to enable/disable
+	 * LLDP with this flag on unsupported FW versions.
 	 */
 	if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP) {
-		if (!(pf->hw_features & I40E_HW_STOPPABLE_FW_LLDP)) {
+		if (!(pf->hw.flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE)) {
 			dev_warn(&pf->pdev->dev,
 				 "Device does not support changing FW LLDP\n");
 			return -EOPNOTSUPP;
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -8
index 42d7404..f81b412 100644
@@ -11430,16 +11430,15 @@ static int i40e_sw_init(struct i40e_pf *pf)
 		/* IWARP needs one extra vector for CQP just like MISC.*/
 		pf->num_iwarp_msix = (int)num_online_cpus() + 1;
 	}
-	/* Stopping the FW LLDP engine is only supported on the
-	 * XL710 with a FW ver >= 1.7.  Also, stopping FW LLDP
-	 * engine is not supported if NPAR is functioning on this
-	 * part
+	/* Stopping FW LLDP engine is supported on XL710 and X722
+	 * starting from FW versions determined in i40e_init_adminq.
+	 * Stopping the FW LLDP engine is not supported on XL710
+	 * if NPAR is functioning so unset this hw flag in this case.
 	 */
 	if (pf->hw.mac.type == I40E_MAC_XL710 &&
-	    !pf->hw.func_caps.npar_enable &&
-	    (pf->hw.aq.api_maj_ver > 1 ||
-	     (pf->hw.aq.api_maj_ver == 1 && pf->hw.aq.api_min_ver > 6)))
-		pf->hw_features |= I40E_HW_STOPPABLE_FW_LLDP;
+	    pf->hw.func_caps.npar_enable &&
+	    (pf->hw.flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE))
+		pf->hw.flags &= ~I40E_HW_FLAG_FW_LLDP_STOPPABLE;
 
 #ifdef CONFIG_PCI_IOV
 	if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) {
Signature · 1 line
2.9.5
#9 lore raw

PATCH 7/7 i40e: Allow disabling FW LLDP on X722 devices

I think there is a patch in S98 that should be combined with this one? [next PATCH S98 12/13] i40e: Add support for X722 devices to disable LLDP

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Thursday, October 4, 2018 3:19 PM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S97 7/7] i40e: Allow disabling FW LLDP on X722 devices

From: Patryk Ma?ek <[email protected]>

This patch allows disabling FW LLDP agent on X722 devices. It also changes a source of information for this feature from pf->hw_features to pf->hw.flags which are set in i40e_init_adminq.

---
 drivers/net/ethernet/intel/i40e/i40e.h         |  1 -
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 13 +++++++------
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 15 +++++++--------
 3 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
index f575b03..382b39e 100644
@@ -496,7 +496,6 @@ struct i40e_pf {
 #define I40E_HW_STOP_FW_LLDP			BIT(16)
 #define I40E_HW_PORT_ID_VALID			BIT(17)
 #define I40E_HW_RESTART_AUTONEG			BIT(18)
-#define I40E_HW_STOPPABLE_FW_LLDP		BIT(19)
 
 	u32 flags;
 #define I40E_FLAG_RX_CSUM_ENABLED		BIT(0)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +7 -6
index 2bb116f..213e412 100644
@@ -4659,14 +4659,15 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 		return -EOPNOTSUPP;
 
 	/* If the driver detected FW LLDP was disabled on init, this flag could
-	 * be set, however we do not support _changing_ the flag if NPAR is
-	 * enabled or FW API version < 1.7.  There are situations where older
-	 * FW versions/NPAR enabled PFs could disable LLDP, however we _must_
-	 * not allow the user to enable/disable LLDP with this flag on
-	 * unsupported FW versions.
+	 * be set, however we do not support _changing_ the flag:
+	 * - on XL710 if NPAR is enabled or FW API version < 1.7
+	 * - on X722 with FW API version < 1.6
+	 * There are situations where older FW versions/NPAR enabled PFs could
+	 * disable LLDP, however we _must_ not allow the user to enable/disable
+	 * LLDP with this flag on unsupported FW versions.
 	 */
 	if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP) {
-		if (!(pf->hw_features & I40E_HW_STOPPABLE_FW_LLDP)) {
+		if (!(pf->hw.flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE)) {
 			dev_warn(&pf->pdev->dev,
 				 "Device does not support changing FW LLDP\n");
 			return -EOPNOTSUPP;
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -8
index 42d7404..f81b412 100644
@@ -11430,16 +11430,15 @@ static int i40e_sw_init(struct i40e_pf *pf)
 		/* IWARP needs one extra vector for CQP just like MISC.*/
 		pf->num_iwarp_msix = (int)num_online_cpus() + 1;
 	}
-	/* Stopping the FW LLDP engine is only supported on the
-	 * XL710 with a FW ver >= 1.7.  Also, stopping FW LLDP
-	 * engine is not supported if NPAR is functioning on this
-	 * part
+	/* Stopping FW LLDP engine is supported on XL710 and X722
+	 * starting from FW versions determined in i40e_init_adminq.
+	 * Stopping the FW LLDP engine is not supported on XL710
+	 * if NPAR is functioning so unset this hw flag in this case.
 	 */
 	if (pf->hw.mac.type == I40E_MAC_XL710 &&
-	    !pf->hw.func_caps.npar_enable &&
-	    (pf->hw.aq.api_maj_ver > 1 ||
-	     (pf->hw.aq.api_maj_ver == 1 && pf->hw.aq.api_min_ver > 6)))
-		pf->hw_features |= I40E_HW_STOPPABLE_FW_LLDP;
+	    pf->hw.func_caps.npar_enable &&
+	    (pf->hw.flags & I40E_HW_FLAG_FW_LLDP_STOPPABLE))
+		pf->hw.flags &= ~I40E_HW_FLAG_FW_LLDP_STOPPABLE;
 
 #ifdef CONFIG_PCI_IOV
 	if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) {
Signature · 6 lines
2.9.5

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#10 lore raw

PATCH 1/7 i40e: Fix for xdp frame struct usage

In reply to Alice Michael

I don't think this change matches the description, as the code before/after is functionally the same in this patch. Maybe just change the description to say clean up code by using a local variable.

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Thursday, October 4, 2018 3:18 PM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S97 1/7] i40e: Fix for xdp frame struct usage

From: Jan Sokolowski <[email protected]>

Current ifdefs used for xdp frame structs and methods are not properly used, thus failing to build.

Use proper definitions for sections of code using xdp_frame.

---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -2
index 740ea58..c9d209a 100644
@@ -3527,6 +3527,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
 	u16 i = xdp_ring->next_to_use;
 	struct i40e_tx_buffer *tx_bi;
 	struct i40e_tx_desc *tx_desc;
+	void *data = xdpf->data;
 	u32 size = xdpf->len;
 	dma_addr_t dma;
 
@@ -3534,8 +3535,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
 		xdp_ring->tx_stats.tx_busy++;
 		return I40E_XDP_CONSUMED;
 	}
-
-	dma = dma_map_single(xdp_ring->dev, xdpf->data, size, DMA_TO_DEVICE);
+	dma = dma_map_single(xdp_ring->dev, data, size, DMA_TO_DEVICE);
 	if (dma_mapping_error(xdp_ring->dev, dma))
 		return I40E_XDP_CONSUMED;
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#11 lore raw

PATCH 1/7 i40e: Fix for xdp frame struct usage

In reply to Alice Michael
Quoted 6 lines · Alice Michael

From: Jan Sokolowski <[email protected]>

Current ifdefs used for xdp frame structs and methods are not properly used, thus failing to build.

Use proper definitions for sections of code using xdp_frame.

Since there are no ifdefs around this in the upstream code, this commit message makes no sense.

Also, you're removing a bit of whitespace that should probably be left alone.

sln

Quoted 29 lines
---
  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -2
index 740ea58..c9d209a 100644
@@ -3527,6 +3527,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
  	u16 i = xdp_ring->next_to_use;
  	struct i40e_tx_buffer *tx_bi;
  	struct i40e_tx_desc *tx_desc;
+	void *data = xdpf->data;
  	u32 size = xdpf->len;
  	dma_addr_t dma;
 
@@ -3534,8 +3535,7 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf,
  		xdp_ring->tx_stats.tx_busy++;
  		return I40E_XDP_CONSUMED;
  	}
-
-	dma = dma_map_single(xdp_ring->dev, xdpf->data, size, DMA_TO_DEVICE);
+	dma = dma_map_single(xdp_ring->dev, data, size, DMA_TO_DEVICE);
  	if (dma_mapping_error(xdp_ring->dev, dma))
  		return I40E_XDP_CONSUMED;