Skip to contentSkip to conversation

net: sxgbe: add Checksum offload support for Samsung sxgbe

PATCH Superseded Byungho An 1 participant 1 message Mar 20, 2014

Subsystems (4)

v8 of 14 Superseded Latest is v14 →

lore
Share & tools
lore

Byungho An

author maintainer
#0 lore raw

PATCH v8 5/7 net: sxgbe: add Checksum offload support for Samsung sxgbe

From: Vipul Pandya <[email protected]>

This patch adds TX and RX checksum offload support.

---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h |    5 +++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c   |   20 +++++++++
 drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h   |    6 +--
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c   |   46 ++++++++++++++++-----
 4 files changed, 63 insertions(+), 14 deletions(-)
drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h +5 -0
index 5f1d02c..f06d439 100644
@@ -337,6 +337,10 @@ struct sxgbe_core_ops {
 	void (*set_eee_timer)(void __iomem *ioaddr, const int ls,
 			      const int tw);
 	void (*set_eee_pls)(void __iomem *ioaddr, const int link);
+
+	/* Enable disable checksum offload operations */
+	void (*enable_rx_csum)(void __iomem *ioaddr);
+	void (*disable_rx_csum)(void __iomem *ioaddr);
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void);
@@ -449,6 +453,7 @@ struct sxgbe_priv_data {
 	struct sxgbe_ops *hw;	/* sxgbe specific ops */
 	int no_csum_insertion;
 	int irq;
+	int rxcsum_insertion;
 	spinlock_t stats_lock;	/* lock for tx/rx statatics */
 
 	struct phy_device *phydev;
drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c +20 -0
index bf93b16..5885fd6 100644
@@ -217,6 +217,24 @@ static void  sxgbe_set_eee_timer(void __iomem *ioaddr,
 	writel(value, ioaddr + SXGBE_CORE_LPI_TIMER_CTRL);
 }
 
+static void sxgbe_enable_rx_csum(void __iomem *ioaddr)
+{
+	u32 ctrl;
+
+	ctrl = readl(ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+	ctrl |= SXGBE_RX_CSUMOFFLOAD_ENABLE;
+	writel(ctrl, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+}
+
+static void sxgbe_disable_rx_csum(void __iomem *ioaddr)
+{
+	u32 ctrl;
+
+	ctrl = readl(ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+	ctrl &= ~SXGBE_RX_CSUMOFFLOAD_ENABLE;
+	writel(ctrl, ioaddr + SXGBE_CORE_RX_CONFIG_REG);
+}
+
 const struct sxgbe_core_ops core_ops = {
 	.core_init = sxgbe_core_init,
 	.dump_regs = sxgbe_core_dump_regs,
@@ -233,6 +251,8 @@ const struct sxgbe_core_ops core_ops = {
 	.reset_eee_mode = sxgbe_reset_eee_mode,
 	.set_eee_timer = sxgbe_set_eee_timer,
 	.set_eee_pls = sxgbe_set_eee_pls,
+	.enable_rx_csum = sxgbe_enable_rx_csum,
+	.disable_rx_csum = sxgbe_disable_rx_csum,
 };
 
 const struct sxgbe_core_ops *sxgbe_get_core_ops(void)
drivers/net/ethernet/samsung/sxgbe/sxgbe_desc.h +3 -3
index 547edf3..3c0b5a8 100644
@@ -113,7 +113,7 @@ struct sxgbe_rx_norm_desc {
 			/* WB RDES3 */
 			u32 pkt_len:14;
 			u32 rdes3_reserved:1;
-			u32 err_summary:15;
+			u32 err_summary:1;
 			u32 err_l2_type:4;
 			u32 layer34_pkt_type:4;
 			u32 no_coagulation_pkt:1;
@@ -273,8 +273,8 @@ struct sxgbe_desc_ops {
 	int (*get_rx_ld_status)(struct sxgbe_rx_norm_desc *p);
 
 	/* Return the reception status looking at the RDES1 */
-	void (*rx_wbstatus)(struct sxgbe_rx_norm_desc *p,
-				struct sxgbe_extra_stats *x);
+	int (*rx_wbstatus)(struct sxgbe_rx_norm_desc *p,
+			   struct sxgbe_extra_stats *x, int *checksum);
 
 	/* Get own bit */
 	int (*get_rx_ctxt_owner)(struct sxgbe_rx_ctxt_desc *p);
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +35 -11

96 lines not on this page · raw message

Signature · 1 line
1.7.10.4