[rtems-libbsd commit] dpaa: Use receive checksum offload

Sebastian Huber sebh at rtems.org
Mon Oct 23 07:27:51 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    ed254d58e1fa80c087f98f4ac5818a4e17547cac
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=ed254d58e1fa80c087f98f4ac5818a4e17547cac

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu May 18 08:13:07 2017 +0200

dpaa: Use receive checksum offload

---

 linux/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c         | 12 ++++++++++--
 .../powerpc/drivers/net/ethernet/freescale/dpaa/if_fmanmac.c |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/linux/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/linux/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index be6d0d7..3698101 100644
--- a/linux/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/linux/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2272,7 +2272,7 @@ static void dpaa_tx_conf(struct net_device *net_dev,
 #else /* __rtems__ */
 	struct ifnet *ifp = net_dev->ifp;
 
-	if (unlikely(fd->status & FM_FD_STAT_TX_ERRORS) != 0) {
+	if (unlikely(be32_to_cpu(fd->status) & FM_FD_STAT_TX_ERRORS) != 0) {
 		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	}
 
@@ -2427,13 +2427,15 @@ dpaa_rx(struct net_device *net_dev, struct qman_portal *portal,
     const struct qm_fd *fd, u32 fqid, int *count_ptr)
 {
 	struct dpaa_bp *dpaa_bp;
+	u32 fd_status;
 	enum qm_fd_format fd_format;
 	struct mbuf *m;
 	struct ifnet *ifp;
 
+	fd_status = be32_to_cpu(fd->status);
 	ifp = net_dev->ifp;
 
-	if (unlikely(fd->status & FM_FD_STAT_RX_ERRORS) != 0) {
+	if (unlikely(fd_status & FM_FD_STAT_RX_ERRORS) != 0) {
 		if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 		dpaa_fd_release(net_dev, fd);
 		return;
@@ -2449,6 +2451,12 @@ dpaa_rx(struct net_device *net_dev, struct qman_portal *portal,
 		m = sg_fd_to_mbuf(dpaa_bp, fd, ifp, count_ptr);
 	}
 
+	if ((be32_to_cpu(fd->status) & FM_FD_STAT_L4CV) != 0) {
+		m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | CSUM_IP_VALID |
+		    CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
+		m->m_pkthdr.csum_data = 0xffff;
+	}
+
 	/* Account for either the contig buffer or the SGT buffer (depending on
 	 * which case we were in) having been removed from the pool.
 	 */
diff --git a/rtemsbsd/sys/powerpc/drivers/net/ethernet/freescale/dpaa/if_fmanmac.c b/rtemsbsd/sys/powerpc/drivers/net/ethernet/freescale/dpaa/if_fmanmac.c
index 4a538b2..1d367b9 100644
--- a/rtemsbsd/sys/powerpc/drivers/net/ethernet/freescale/dpaa/if_fmanmac.c
+++ b/rtemsbsd/sys/powerpc/drivers/net/ethernet/freescale/dpaa/if_fmanmac.c
@@ -433,7 +433,7 @@ fman_mac_dev_attach(device_t dev)
 	ifp->if_softc = sc;
 	if_initname(ifp, &sc->name[0], sc->mac_dev.data.mac_hw_id);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-	ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6 |
+	ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 |
 	    IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
 	ifp->if_capenable = ifp->if_capabilities;
 	ifp->if_hwassist = FMAN_MAC_CSUM;




More information about the vc mailing list