qcacmn: Add cdp_hl_fc_register() to register FC for HL DP

Add function cdp_hl_fc_register() for registering flow control
callback for HL netdev flow control.
The flow control callback will be responsible for pausing/restarting
OS network queues.
Also the parameters of function pointer "cdp_lflowctl_ops:
register_tx_flow_control" are changed.

Change-Id: I6a1c82492fd67557eea7523134ff465726ac7a1e
CRs-fixed: 2236466
This commit is contained in:
Ajit Pal Singh
2018-04-19 15:02:22 +05:30
committed by nshrivas
parent ecef5a4024
commit d1543e09d1
2 changed files with 50 additions and 2 deletions

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -26,6 +26,41 @@
#include <cdp_txrx_mob_def.h> #include <cdp_txrx_mob_def.h>
#include "cdp_txrx_handle.h" #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 * cdp_fc_register() - Register flow control callback function pointer
* @soc - data path soc handle * @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, vdev_id, flowControl, osif_fc_ctx,
flow_control_is_pause); 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 * cdp_fc_deregister() - remove flow control instance
* @soc - data path soc handle * @soc - data path soc handle

View File

@@ -897,9 +897,14 @@ struct cdp_flowctl_ops {
* @vdev_unpause: * @vdev_unpause:
*/ */
struct cdp_lflowctl_ops { 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, 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_fp flowControl, void *osif_fc_ctx,
ol_txrx_tx_flow_control_is_pause_fp flow_control_is_pause); 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); int (*deregister_tx_flow_control_cb)(uint8_t vdev_id);
void (*flow_control_cb)(struct cdp_vdev *vdev, bool tx_resume); void (*flow_control_cb)(struct cdp_vdev *vdev, bool tx_resume);
bool (*get_tx_resource)(uint8_t sta_id, bool (*get_tx_resource)(uint8_t sta_id,