From a63812986d7c3a2a2fcc3489abf38b7a0a191fa5 Mon Sep 17 00:00:00 2001 From: Cristian Sovaiala Date: Fri, 27 Mar 2015 11:16:10 +0200 Subject: dpaa_eth: Add generic hook option FSL_DPAA_HOOKS Replace existing CONFIG_AS_FASTPATH and CONFIG_FSL_FMAN_TEST options guarding the hooks with a new option CONFIG_FSL_DPAA_HOOKS. Signed-off-by: Cristian Sovaiala Change-Id: Ie571a761c7971bd558ec711e4c1a811f9eee1c89 Reviewed-on: http://git.am.freescale.net:8181/33685 Reviewed-by: Madalin-Cristian Bucur Tested-by: Cristian-Constantin Sovaiala diff --git a/drivers/net/ethernet/freescale/dpa/Kconfig b/drivers/net/ethernet/freescale/dpa/Kconfig index 844bdfe..83bdde9 100644 --- a/drivers/net/ethernet/freescale/dpa/Kconfig +++ b/drivers/net/ethernet/freescale/dpa/Kconfig @@ -10,6 +10,9 @@ menuconfig FSL_DPAA_ETH if FSL_DPAA_ETH +config FSL_DPAA_HOOKS + bool "DPAA Ethernet driver hooks" + config FSL_DPAA_OFFLINE_PORTS bool "Offline Ports support" depends on FSL_DPAA_ETH diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c index 7c051c8..d02e119 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c @@ -255,7 +255,7 @@ static void _dpa_rx_error(struct net_device *net_dev, if (netif_msg_hw(priv) && net_ratelimit()) netdev_err(net_dev, "Err FD status = 0x%08x\n", fd->status & FM_FD_STAT_RX_ERRORS); -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS if (dpaa_eth_hooks.rx_error && dpaa_eth_hooks.rx_error(net_dev, fd, fqid) == DPAA_ETH_STOLEN) /* it's up to the hook to perform resource cleanup */ @@ -288,7 +288,7 @@ static void _dpa_tx_error(struct net_device *net_dev, if (netif_msg_hw(priv) && net_ratelimit()) netdev_warn(net_dev, "FD status = 0x%08x\n", fd->status & FM_FD_STAT_TX_ERRORS); -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS if (dpaa_eth_hooks.tx_error && dpaa_eth_hooks.tx_error(net_dev, fd, fqid) == DPAA_ETH_STOLEN) /* now the hook must ensure proper cleanup */ @@ -394,7 +394,7 @@ static void __hot _dpa_tx_conf(struct net_device *net_dev, } /* hopefully we need not get the timestamp before the hook */ -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS if (dpaa_eth_hooks.tx_confirm && dpaa_eth_hooks.tx_confirm(net_dev, fd, fqid) == DPAA_ETH_STOLEN) /* it's the hook that must now perform cleanup */ diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c index 76a3c23..5095b99 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c @@ -89,7 +89,7 @@ static const char fsl_qman_frame_queues[][25] = { [RX] = "fsl,qman-frame-queues-rx", [TX] = "fsl,qman-frame-queues-tx" }; -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS /* A set of callbacks for hooking into the fastpath at different points. */ struct dpaa_eth_hooks_s dpaa_eth_hooks; /* This function should only be called on the probe paths, since it makes no diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h index d89afd1..6e25378 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h @@ -95,7 +95,7 @@ extern u16 qman_portal_max; /* from dpa_ethtool.c */ extern const struct ethtool_ops dpa_ethtool_ops; -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS /* Various hooks used for unit-testing and/or fastpath optimizations. * Currently only one set of such hooks is supported. */ diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index daa75cf..878f607 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -577,7 +577,7 @@ void __hot _dpa_rx(struct net_device *net_dev, DPA_BUG_ON((fd->format != qm_fd_contig) && (fd->format != qm_fd_sg)); if (likely(fd->format == qm_fd_contig)) { -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS /* Execute the Rx processing hook, if it exists. */ if (dpaa_eth_hooks.rx_default && dpaa_eth_hooks.rx_default((void *)fd, net_dev, @@ -857,7 +857,7 @@ int __hot dpa_tx(struct sk_buff *skb, struct net_device *net_dev) const int queue_mapping = dpa_get_queue_mapping(skb); const bool nonlinear = skb_is_nonlinear(skb); int *countptr, offset = 0; -#if defined(CONFIG_AS_FASTPATH) || defined(CONFIG_FSL_FMAN_TEST) +#ifdef CONFIG_FSL_DPAA_HOOKS /* If there is a Tx hook, run it. */ if (dpaa_eth_hooks.tx && dpaa_eth_hooks.tx(skb, net_dev) == DPAA_ETH_STOLEN) -- cgit v0.10.2