Explorar el Código

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
Poddar, Siddarth hace 7 años
padre
commit
658455b413
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      utils/pktlog/pktlog_ac.c

+ 8 - 1
utils/pktlog/pktlog_ac.c

@@ -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;
 	}