src/dpdk/drivers/net/nfp/nfp_net.c
static int
nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp)
{
	uint32_t cmd, ident_size, tmp;
	int err;

	/* Reading now the IOCTL command */
	err = recv(sockfd, &cmd, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
		return -EIO;
	}

	/* Only supporting NFP_IOCTL_CPP_IDENTIFICATION */
	if (cmd != NFP_IOCTL_CPP_IDENTIFICATION) {
		RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n", __func__, cmd);
		return -EINVAL;
	}

	err = recv(sockfd, &ident_size, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
		return -EIO;
	}

	tmp = nfp_cpp_model(cpp);

	PMD_CPP_LOG(DEBUG, "%s: sending NFP model %08x\n", __func__, tmp);

	err = send(sockfd, &tmp, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
		return -EIO;
	}

	tmp = cpp->interface;

	PMD_CPP_LOG(DEBUG, "%s: sending NFP interface %08x\n", __func__, tmp);

	err = send(sockfd, &tmp, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
		return -EIO;
	}

	return 0;
}
/*
 * Serving a ioctl command from host NFP tools. This usually goes to
 * a kernel driver char driver but it is not available when the PF is
 * bound to the PMD. Currently just one ioctl command is served and it
 * does not require any CPP access at all.
 */
Serving a ioctl command from host NFP tools. This usually goes to
a kernel driver char driver but it is not available when the PF is
bound to the PMD. Currently just one ioctl command is served and it
does not require any CPP access at all.
Serving a ioctl command from host NFP tools . This usually goes to a kernel driver char driver but it is not available when the PF is bound to the PMD . Currently just one ioctl command is served and it does not require any CPP access at all .
static int
nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp)
{
	uint32_t cmd, ident_size, tmp;
	int err;
	err = recv(sockfd, &cmd, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
		return -EIO;
	}
	if (cmd != NFP_IOCTL_CPP_IDENTIFICATION) {
		RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n", __func__, cmd);
		return -EINVAL;
	}
	err = recv(sockfd, &ident_size, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
		return -EIO;
	}
	tmp = nfp_cpp_model(cpp);
	PMD_CPP_LOG(DEBUG, "%s: sending NFP model %08x\n", __func__, tmp);
	err = send(sockfd, &tmp, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
		return -EIO;
	}
	tmp = cpp->interface;
	PMD_CPP_LOG(DEBUG, "%s: sending NFP interface %08x\n", __func__, tmp);
	err = send(sockfd, &tmp, 4, 0);
	if (err != 4) {
		RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
		return -EIO;
	}
	return 0;
}
static int nfp_cpp_bridge_serve_ioctl ( int sockfd , struct nfp_cpp * cpp ) { uint32_t cmd , ident_size , tmp ; int err ; err = recv ( sockfd , & cmd , 4 , 0 ) ; if ( err != 4 ) { RTE_LOG ( ERR , PMD , " \n " , __func__ ) ; return - EIO ; } if ( cmd != NFP_IOCTL_CPP_IDENTIFICATION ) { RTE_LOG ( ERR , PMD , " \n " , __func__ , cmd ) ; return - EINVAL ; } err = recv ( sockfd , & ident_size , 4 , 0 ) ; if ( err != 4 ) { RTE_LOG ( ERR , PMD , " \n " , __func__ ) ; return - EIO ; } tmp = nfp_cpp_model ( cpp ) ; PMD_CPP_LOG ( DEBUG , " \n " , __func__ , tmp ) ; err = send ( sockfd , & tmp , 4 , 0 ) ; if ( err != 4 ) { RTE_LOG ( ERR , PMD , " \n " , __func__ ) ; return - EIO ; } tmp = cpp -> interface ; PMD_CPP_LOG ( DEBUG , " \n " , __func__ , tmp ) ; err = send ( sockfd , & tmp , 4 , 0 ) ; if ( err != 4 ) { RTE_LOG ( ERR , PMD , " \n " , __func__ ) ; return - EIO ; } return 0 ; }
Serving a ioctl command from host NFP tools.
Serving a ioctl command from host NFP tools .
/* Reading now the IOCTL command */ /* Only supporting NFP_IOCTL_CPP_IDENTIFICATION */