software/drivers/sd8887/src/wlan/mapp/mlanconfig/mlanconfig.c
/**
 *  @brief Send a WMM AC Queue configuration command to get/set/default params
 *
 *  Configure or get the parameters of a WMM AC queue. The command takes
 *    an optional Queue Id as a last parameter.  Without the queue id, all
 *    queues will be acted upon.
 *
 *  mlanconfig mlanX qconfig set msdu <lifetime in TUs> [Queue Id: 0-3]
 *  mlanconfig mlanX qconfig get [Queue Id: 0-3]
 *  mlanconfig mlanX qconfig def [Queue Id: 0-3]
 *
 *  @param argc     number of arguments
 *  @param argv     A pointer to arguments array
 *
 *  @return         MLAN_STATUS_SUCCESS--success, otherwise--fail
 */
@brief Send a WMM AC Queue configuration command to get/set/default params
Configure or get the parameters of a WMM AC queue. The command takes
an optional Queue Id as a last parameter.  Without the queue id, all
queues will be acted upon.

mlanconfig mlanX qconfig set msdu  [Queue Id: 0-3]
mlanconfig mlanX qconfig get [Queue Id: 0-3]
mlanconfig mlanX qconfig def [Queue Id: 0-3]

@param argc     number of arguments
@param argv     A pointer to arguments array


@brief Send a WMM AC Queue configuration command to get / set / default params Configure or get the parameters of a WMM AC queue . The command takes an optional Queue Id as a last parameter . Without the queue id all queues will be acted upon . mlanconfig mlanX qconfig set msdu [ Queue Id : 0 - 3 ] mlanconfig mlanX qconfig get [ Queue Id : 0 - 3 ] mlanconfig mlanX qconfig def [ Queue Id : 0 - 3 ] @param argc number of arguments @param argv A pointer to arguments array
static int
process_qconfig(int argc, char *argv[])
{
	int ioctl_val, subioctl_val;
	struct iwreq iwr;
	wlan_ioctl_wmm_queue_config_t queue_config_cmd;
	mlan_wmm_ac_e ac_idx;
	mlan_wmm_ac_e ac_idx_start;
	mlan_wmm_ac_e ac_idx_stop;
	const char *ac_str_tbl[] = { "BK", "BE", "VI", "VO" };
	if (argc < 4) {
		fprintf(stderr, "Invalid number of parameters!\n");
		return -EINVAL;
	}
	if (get_priv_ioctl("qconfig",
			   &ioctl_val, &subioctl_val) == MLAN_STATUS_FAILURE) {
		return -EOPNOTSUPP;
	}
	memset(&queue_config_cmd, 0x00, sizeof(queue_config_cmd));
	strncpy(iwr.ifr_name, dev_name, IFNAMSIZ - 1);
	iwr.u.data.pointer = (caddr_t) & queue_config_cmd;
	iwr.u.data.length = sizeof(queue_config_cmd);
	iwr.u.data.flags = subioctl_val;
	if (strcmp(argv[3], "get") == 0) {
		if (argc == 4) {
			ac_idx_start = WMM_AC_BK;
			ac_idx_stop = WMM_AC_VO;
		} else if (argc == 5) {
			if (atoi(argv[4]) < WMM_AC_BK ||
			    atoi(argv[4]) > WMM_AC_VO) {
				fprintf(stderr, "ERROR: Invalid Queue ID!\n");
				return -EINVAL;
			}
			ac_idx_start = atoi(argv[4]);
			ac_idx_stop = ac_idx_start;
		} else {
			fprintf(stderr, "Invalid number of parameters!\n");
			return -EINVAL;
		}
		queue_config_cmd.action = WMM_QUEUE_CONFIG_ACTION_GET;
		for (ac_idx = ac_idx_start; ac_idx <= ac_idx_stop; ac_idx++) {
			queue_config_cmd.accessCategory = ac_idx;
			if (ioctl(sockfd, ioctl_val, &iwr) < 0) {
				perror("qconfig ioctl");
			} else {
				printf("qconfig %s(%d): MSDU Lifetime GET = 0x%04x (%d)\n", ac_str_tbl[ac_idx], ac_idx, queue_config_cmd.msduLifetimeExpiry, queue_config_cmd.msduLifetimeExpiry);
			}
		}
	} else if (strcmp(argv[3], "set") == 0) {
		if ((argc >= 5) && strcmp(argv[4], "msdu") == 0) {
			if (argc == 6) {
				ac_idx_start = WMM_AC_BK;
				ac_idx_stop = WMM_AC_VO;
			} else if (argc == 7) {
				if (atoi(argv[6]) < WMM_AC_BK ||
				    atoi(argv[6]) > WMM_AC_VO) {
					fprintf(stderr,
						"ERROR: Invalid Queue ID!\n");
					return -EINVAL;
				}
				ac_idx_start = atoi(argv[6]);
				ac_idx_stop = ac_idx_start;
			} else {
				fprintf(stderr,
					"Invalid number of parameters!\n");
				return -EINVAL;
			}
			queue_config_cmd.action = WMM_QUEUE_CONFIG_ACTION_SET;
			queue_config_cmd.msduLifetimeExpiry = atoi(argv[5]);
			for (ac_idx = ac_idx_start; ac_idx <= ac_idx_stop;
			     ac_idx++) {
				queue_config_cmd.accessCategory = ac_idx;
				if (ioctl(sockfd, ioctl_val, &iwr) < 0) {
					perror("qconfig ioctl");
				} else {
					printf("qconfig %s(%d): MSDU Lifetime SET = 0x%04x (%d)\n", ac_str_tbl[ac_idx], ac_idx, queue_config_cmd.msduLifetimeExpiry, queue_config_cmd.msduLifetimeExpiry);
				}
			}
		} else {
			fprintf(stderr, "Invalid set parameter: s/b [msdu]\n");
			return -EINVAL;
		}
	} else if (strncmp(argv[3], "def", strlen("def")) == 0) {
		if (argc == 4) {
			ac_idx_start = WMM_AC_BK;
			ac_idx_stop = WMM_AC_VO;
		} else if (argc == 5) {
			if (atoi(argv[4]) < WMM_AC_BK ||
			    atoi(argv[4]) > WMM_AC_VO) {
				fprintf(stderr, "ERROR: Invalid Queue ID!\n");
				return -EINVAL;
			}
			ac_idx_start = atoi(argv[4]);
			ac_idx_stop = ac_idx_start;
		} else {
			fprintf(stderr, "Invalid number of parameters!\n");
			return -EINVAL;
		}
		queue_config_cmd.action = WMM_QUEUE_CONFIG_ACTION_DEFAULT;
		for (ac_idx = ac_idx_start; ac_idx <= ac_idx_stop; ac_idx++) {
			queue_config_cmd.accessCategory = ac_idx;
			if (ioctl(sockfd, ioctl_val, &iwr) < 0) {
				perror("qconfig ioctl");
			} else {
				printf("qconfig %s(%d): MSDU Lifetime DEFAULT = 0x%04x (%d)\n", ac_str_tbl[ac_idx], ac_idx, queue_config_cmd.msduLifetimeExpiry, queue_config_cmd.msduLifetimeExpiry);
			}
		}
	} else {
		fprintf(stderr,
			"Invalid qconfig command; s/b [set, get, default]\n");
		return -EINVAL;
	}
	return MLAN_STATUS_SUCCESS;
}
static int process_qconfig ( int argc , char * argv [ ] ) { int ioctl_val , subioctl_val ; struct iwreq iwr ; wlan_ioctl_wmm_queue_config_t queue_config_cmd ; mlan_wmm_ac_e ac_idx ; mlan_wmm_ac_e ac_idx_start ; mlan_wmm_ac_e ac_idx_stop ; const char * ac_str_tbl [ ] = { " " , " " , " " , " " } ; if ( argc < 4 ) { fprintf ( stderr , " \n " ) ; return - EINVAL ; } if ( get_priv_ioctl ( " " , & ioctl_val , & subioctl_val ) == MLAN_STATUS_FAILURE ) { return - EOPNOTSUPP ; } memset ( & queue_config_cmd , 0x00 , sizeof ( queue_config_cmd ) ) ; strncpy ( iwr . ifr_name , dev_name , IFNAMSIZ - 1 ) ; iwr . u . data . pointer = ( caddr_t ) & queue_config_cmd ; iwr . u . data . length = sizeof ( queue_config_cmd ) ; iwr . u . data . flags = subioctl_val ; if ( strcmp ( argv [ 3 ] , " " ) == 0 ) { if ( argc == 4 ) { ac_idx_start = WMM_AC_BK ; ac_idx_stop = WMM_AC_VO ; } else if ( argc == 5 ) { if ( atoi ( argv [ 4 ] ) < WMM_AC_BK || atoi ( argv [ 4 ] ) > WMM_AC_VO ) { fprintf ( stderr , " \n " ) ; return - EINVAL ; } ac_idx_start = atoi ( argv [ 4 ] ) ; ac_idx_stop = ac_idx_start ; } else { fprintf ( stderr , " \n " ) ; return - EINVAL ; } queue_config_cmd . action = WMM_QUEUE_CONFIG_ACTION_GET ; for ( ac_idx = ac_idx_start ; ac_idx <= ac_idx_stop ; ac_idx ++ ) { queue_config_cmd . accessCategory = ac_idx ; if ( ioctl ( sockfd , ioctl_val , & iwr ) < 0 ) { perror ( " " ) ; } else { printf ( " \n " , ac_str_tbl [ ac_idx ] , ac_idx , queue_config_cmd . msduLifetimeExpiry , queue_config_cmd . msduLifetimeExpiry ) ; } } } else if ( strcmp ( argv [ 3 ] , " " ) == 0 ) { if ( ( argc >= 5 ) && strcmp ( argv [ 4 ] , " " ) == 0 ) { if ( argc == 6 ) { ac_idx_start = WMM_AC_BK ; ac_idx_stop = WMM_AC_VO ; } else if ( argc == 7 ) { if ( atoi ( argv [ 6 ] ) < WMM_AC_BK || atoi ( argv [ 6 ] ) > WMM_AC_VO ) { fprintf ( stderr , " \n " ) ; return - EINVAL ; } ac_idx_start = atoi ( argv [ 6 ] ) ; ac_idx_stop = ac_idx_start ; } else { fprintf ( stderr , " \n " ) ; return - EINVAL ; } queue_config_cmd . action = WMM_QUEUE_CONFIG_ACTION_SET ; queue_config_cmd . msduLifetimeExpiry = atoi ( argv [ 5 ] ) ; for ( ac_idx = ac_idx_start ; ac_idx <= ac_idx_stop ; ac_idx ++ ) { queue_config_cmd . accessCategory = ac_idx ; if ( ioctl ( sockfd , ioctl_val , & iwr ) < 0 ) { perror ( " " ) ; } else { printf ( " \n " , ac_str_tbl [ ac_idx ] , ac_idx , queue_config_cmd . msduLifetimeExpiry , queue_config_cmd . msduLifetimeExpiry ) ; } } } else { fprintf ( stderr , " \n " ) ; return - EINVAL ; } } else if ( strncmp ( argv [ 3 ] , " " , strlen ( " " ) ) == 0 ) { if ( argc == 4 ) { ac_idx_start = WMM_AC_BK ; ac_idx_stop = WMM_AC_VO ; } else if ( argc == 5 ) { if ( atoi ( argv [ 4 ] ) < WMM_AC_BK || atoi ( argv [ 4 ] ) > WMM_AC_VO ) { fprintf ( stderr , " \n " ) ; return - EINVAL ; } ac_idx_start = atoi ( argv [ 4 ] ) ; ac_idx_stop = ac_idx_start ; } else { fprintf ( stderr , " \n " ) ; return - EINVAL ; } queue_config_cmd . action = WMM_QUEUE_CONFIG_ACTION_DEFAULT ; for ( ac_idx = ac_idx_start ; ac_idx <= ac_idx_stop ; ac_idx ++ ) { queue_config_cmd . accessCategory = ac_idx ; if ( ioctl ( sockfd , ioctl_val , & iwr ) < 0 ) { perror ( " " ) ; } else { printf ( " \n " , ac_str_tbl [ ac_idx ] , ac_idx , queue_config_cmd . msduLifetimeExpiry , queue_config_cmd . msduLifetimeExpiry ) ; } } } else { fprintf ( stderr , " \n " ) ; return - EINVAL ; } return MLAN_STATUS_SUCCESS ; }
@brief Send a WMM AC Queue configuration command to get/set/default params
  Configure or get the parameters of a WMM AC queue.
@brief Send a WMM AC Queue configuration command to get / set / default params Configure or get the parameters of a WMM AC queue .
/*    3     4    5   */ /* qconfig get [qid] */ /*    3     4    5     6      7   */ /* qconfig set msdu <value> [qid] */ /* Only MSDU Lifetime provisioning accepted for now */ /*    3     4    5   */ /* qconfig def [qid] */