qcacmn: Restrict max/min pktlog buffer size using pktlogconf tool

Restrict the pktlog buffer size to a minimum of 1MB and maximum
of 16MB using pktlogconf tool or through sysctl command.

Change-Id: I1c67ed724c512f57c5d6e555be14b0b0e23d203f
CRs-Fixed: 2133723
This commit is contained in:
Poddar, Siddarth
2017-10-27 12:37:37 +05:30
committed by snandini
parent a9919d6e12
commit 658455b413

View File

@@ -548,6 +548,9 @@ int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
return error;
}
#define ONE_MEGABYTE (1024 * 1024)
#define MAX_ALLOWED_PKTLOG_SIZE (16 * ONE_MEGABYTE)
static int __pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
{
ol_txrx_pdev_handle pdev_txrx_handle =
@@ -568,7 +571,11 @@ static int __pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
pl_info->curr_pkt_state = PKTLOG_OPR_IN_PROGRESS;
if (size < 0) {
if (size < ONE_MEGABYTE || size > MAX_ALLOWED_PKTLOG_SIZE) {
qdf_print("%s: Cannot Set Pktlog Buffer size of %d bytes."
"Min required is %d MB and Max allowed is %d MB.\n",
__func__, size, (ONE_MEGABYTE/ONE_MEGABYTE),
(MAX_ALLOWED_PKTLOG_SIZE/ONE_MEGABYTE));
pl_info->curr_pkt_state = PKTLOG_OPR_NOT_IN_PROGRESS;
return -EINVAL;
}