diff --git a/dp/inc/cdp_txrx_flow_ctrl_legacy.h b/dp/inc/cdp_txrx_flow_ctrl_legacy.h index 93faf7d54c..70b7d2f254 100644 --- a/dp/inc/cdp_txrx_flow_ctrl_legacy.h +++ b/dp/inc/cdp_txrx_flow_ctrl_legacy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -26,6 +26,41 @@ #include #include "cdp_txrx_handle.h" +#ifdef QCA_HL_NETDEV_FLOW_CONTROL + +/** + * cdp_hl_fc_register() - Register HL flow control callback. + * @soc - data path soc handle + * @flowcontrol - callback function pointer to stop/start OS netdev queues + * Register flow control callback. + * return 0 success + */ +static inline int +cdp_hl_fc_register(ol_txrx_soc_handle soc, tx_pause_callback flowcontrol) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, + "%s invalid instance", __func__); + QDF_BUG(0); + return -EINVAL; + } + + if (!soc->ops->l_flowctl_ops || + !soc->ops->l_flowctl_ops->register_tx_flow_control) + return -EINVAL; + + return soc->ops->l_flowctl_ops->register_tx_flow_control(soc, + flowcontrol); +} +#else +static inline int +cdp_hl_fc_register(ol_txrx_soc_handle soc, tx_pause_callback flowcontrol) +{ + return 0; +} +#endif /* QCA_HL_NETDEV_FLOW_CONTROL */ + +#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL /** * cdp_fc_register() - Register flow control callback function pointer * @soc - data path soc handle @@ -58,7 +93,15 @@ cdp_fc_register(ol_txrx_soc_handle soc, uint8_t vdev_id, vdev_id, flowControl, osif_fc_ctx, flow_control_is_pause); } - +#else +static inline int +cdp_fc_register(ol_txrx_soc_handle soc, uint8_t vdev_id, + ol_txrx_tx_flow_control_fp flowcontrol, void *osif_fc_ctx, + ol_txrx_tx_flow_control_is_pause_fp flow_control_is_pause) +{ + return 0; +} +#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ /** * cdp_fc_deregister() - remove flow control instance * @soc - data path soc handle diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 8ef72ec4f7..b845a2cb81 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -897,9 +897,14 @@ struct cdp_flowctl_ops { * @vdev_unpause: */ struct cdp_lflowctl_ops { +#ifdef QCA_HL_NETDEV_FLOW_CONTROL + int (*register_tx_flow_control)(struct cdp_soc_t *soc, + tx_pause_callback flowcontrol); +#else int (*register_tx_flow_control)(uint8_t vdev_id, ol_txrx_tx_flow_control_fp flowControl, void *osif_fc_ctx, ol_txrx_tx_flow_control_is_pause_fp flow_control_is_pause); +#endif /* QCA_HL_NETDEV_FLOW_CONTROL */ int (*deregister_tx_flow_control_cb)(uint8_t vdev_id); void (*flow_control_cb)(struct cdp_vdev *vdev, bool tx_resume); bool (*get_tx_resource)(uint8_t sta_id,