src/dpdk/drivers/net/cxgbe/base/t4_hw.c
int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
			int start, int n, const u16 *rspq, unsigned int nrspq)
{
	int ret;
	const u16 *rsp = rspq;
	const u16 *rsp_end = rspq + nrspq;
	struct fw_rss_ind_tbl_cmd cmd;

	memset(&cmd, 0, sizeof(cmd));
	cmd.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_RSS_IND_TBL_CMD) |
				     F_FW_CMD_REQUEST | F_FW_CMD_WRITE |
				     V_FW_RSS_IND_TBL_CMD_VIID(viid));
	cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));

	/*
	 * Each firmware RSS command can accommodate up to 32 RSS Ingress
	 * Queue Identifiers.  These Ingress Queue IDs are packed three to
	 * a 32-bit word as 10-bit values with the upper remaining 2 bits
	 * reserved.
	 */
	while (n > 0) {
		int nq = min(n, 32);
		int nq_packed = 0;
		__be32 *qp = &cmd.iq0_to_iq2;

		/*
		 * Set up the firmware RSS command header to send the next
		 * "nq" Ingress Queue IDs to the firmware.
		 */
		cmd.niqid = cpu_to_be16(nq);
		cmd.startidx = cpu_to_be16(start);

		/*
		 * "nq" more done for the start of the next loop.
		 */
		start += nq;
		n -= nq;

		/*
		 * While there are still Ingress Queue IDs to stuff into the
		 * current firmware RSS command, retrieve them from the
		 * Ingress Queue ID array and insert them into the command.
		 */
		while (nq > 0) {
			/*
			 * Grab up to the next 3 Ingress Queue IDs (wrapping
			 * around the Ingress Queue ID array if necessary) and
			 * insert them into the firmware RSS command at the
			 * current 3-tuple position within the commad.
			 */
			u16 qbuf[3];
			u16 *qbp = qbuf;
			int nqbuf = min(3, nq);

			nq -= nqbuf;
			qbuf[0] = 0;
			qbuf[1] = 0;
			qbuf[2] = 0;
			while (nqbuf && nq_packed < 32) {
				nqbuf--;
				nq_packed++;
				*qbp++ = *rsp++;
				if (rsp >= rsp_end)
					rsp = rspq;
			}
			*qp++ = cpu_to_be32(V_FW_RSS_IND_TBL_CMD_IQ0(qbuf[0]) |
					    V_FW_RSS_IND_TBL_CMD_IQ1(qbuf[1]) |
					    V_FW_RSS_IND_TBL_CMD_IQ2(qbuf[2]));
		}

		/*
		 * Send this portion of the RRS table update to the firmware;
		 * bail out on any errors.
		 */
		if (is_pf4(adapter))
			ret = t4_wr_mbox(adapter, mbox, &cmd, sizeof(cmd),
					 NULL);
		else
			ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL);
		if (ret)
			return ret;
	}

	return 0;
}
/**
 * t4_config_rss_range - configure a portion of the RSS mapping table
 * @adapter: the adapter
 * @mbox: mbox to use for the FW command
 * @viid: virtual interface whose RSS subtable is to be written
 * @start: start entry in the table to write
 * @n: how many table entries to write
 * @rspq: values for the "response queue" (Ingress Queue) lookup table
 * @nrspq: number of values in @rspq
 *
 * Programs the selected part of the VI's RSS mapping table with the
 * provided values.  If @nrspq < @n the supplied values are used repeatedly
 * until the full table range is populated.
 *
 * The caller must ensure the values in @rspq are in the range allowed for
 * @viid.
 */


Programs the selected part of the VI's RSS mapping table with the
provided values.  If @nrspq < @n the supplied values are used repeatedly
until the full table range is populated.

The caller must ensure the values in @rspq are in the range allowed for
@viid.
Programs the selected part of the VI ' s RSS mapping table with the provided values . If @nrspq < @n the supplied values are used repeatedly until the full table range is populated . The caller must ensure the values in @rspq are in the range allowed for @viid .
int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
			int start, int n, const u16 *rspq, unsigned int nrspq)
{
	int ret;
	const u16 *rsp = rspq;
	const u16 *rsp_end = rspq + nrspq;
	struct fw_rss_ind_tbl_cmd cmd;
	memset(&cmd, 0, sizeof(cmd));
	cmd.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_RSS_IND_TBL_CMD) |
				     F_FW_CMD_REQUEST | F_FW_CMD_WRITE |
				     V_FW_RSS_IND_TBL_CMD_VIID(viid));
	cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));
	while (n > 0) {
		int nq = min(n, 32);
		int nq_packed = 0;
		__be32 *qp = &cmd.iq0_to_iq2;
		cmd.niqid = cpu_to_be16(nq);
		cmd.startidx = cpu_to_be16(start);
		start += nq;
		n -= nq;
		while (nq > 0) {
			u16 qbuf[3];
			u16 *qbp = qbuf;
			int nqbuf = min(3, nq);
			nq -= nqbuf;
			qbuf[0] = 0;
			qbuf[1] = 0;
			qbuf[2] = 0;
			while (nqbuf && nq_packed < 32) {
				nqbuf--;
				nq_packed++;
				*qbp++ = *rsp++;
				if (rsp >= rsp_end)
					rsp = rspq;
			}
			*qp++ = cpu_to_be32(V_FW_RSS_IND_TBL_CMD_IQ0(qbuf[0]) |
					    V_FW_RSS_IND_TBL_CMD_IQ1(qbuf[1]) |
					    V_FW_RSS_IND_TBL_CMD_IQ2(qbuf[2]));
		}
		if (is_pf4(adapter))
			ret = t4_wr_mbox(adapter, mbox, &cmd, sizeof(cmd),
					 NULL);
		else
			ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL);
		if (ret)
			return ret;
	}
	return 0;
}
int t4_config_rss_range ( struct adapter * adapter , int mbox , unsigned int viid , int start , int n , const u16 * rspq , unsigned int nrspq ) { int ret ; const u16 * rsp = rspq ; const u16 * rsp_end = rspq + nrspq ; struct fw_rss_ind_tbl_cmd cmd ; memset ( & cmd , 0 , sizeof ( cmd ) ) ; cmd . op_to_viid = cpu_to_be32 ( V_FW_CMD_OP ( FW_RSS_IND_TBL_CMD ) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE | V_FW_RSS_IND_TBL_CMD_VIID ( viid ) ) ; cmd . retval_len16 = cpu_to_be32 ( FW_LEN16 ( cmd ) ) ; while ( n > 0 ) { int nq = min ( n , 32 ) ; int nq_packed = 0 ; __be32 * qp = & cmd . iq0_to_iq2 ; cmd . niqid = cpu_to_be16 ( nq ) ; cmd . startidx = cpu_to_be16 ( start ) ; start += nq ; n -= nq ; while ( nq > 0 ) { u16 qbuf [ 3 ] ; u16 * qbp = qbuf ; int nqbuf = min ( 3 , nq ) ; nq -= nqbuf ; qbuf [ 0 ] = 0 ; qbuf [ 1 ] = 0 ; qbuf [ 2 ] = 0 ; while ( nqbuf && nq_packed < 32 ) { nqbuf -- ; nq_packed ++ ; * qbp ++ = * rsp ++ ; if ( rsp >= rsp_end ) rsp = rspq ; } * qp ++ = cpu_to_be32 ( V_FW_RSS_IND_TBL_CMD_IQ0 ( qbuf [ 0 ] ) | V_FW_RSS_IND_TBL_CMD_IQ1 ( qbuf [ 1 ] ) | V_FW_RSS_IND_TBL_CMD_IQ2 ( qbuf [ 2 ] ) ) ; } if ( is_pf4 ( adapter ) ) ret = t4_wr_mbox ( adapter , mbox , & cmd , sizeof ( cmd ) , NULL ) ; else ret = t4vf_wr_mbox ( adapter , & cmd , sizeof ( cmd ) , NULL ) ; if ( ret ) return ret ; } return 0 ; }
t4_config_rss_range - configure a portion of the RSS mapping table
 @adapter: the adapter
 @mbox: mbox to use for the FW command
 @viid: virtual interface whose RSS subtable is to be written
 @start: start entry in the table to write
 @n: how many table entries to write
 @rspq: values for the "response queue" (Ingress Queue) lookup table
 @nrspq: number of values in @rspq
t4_config_rss_range - configure a portion of the RSS mapping table @adapter : the adapter @mbox : mbox to use for the FW command @viid : virtual interface whose RSS subtable is to be written @start : start entry in the table to write @n : how many table entries to write @rspq : values for the " response queue " ( Ingress Queue ) lookup table @nrspq : number of values in @rspq
/*
	 * Each firmware RSS command can accommodate up to 32 RSS Ingress
	 * Queue Identifiers.  These Ingress Queue IDs are packed three to
	 * a 32-bit word as 10-bit values with the upper remaining 2 bits
	 * reserved.
	 */ /*
		 * Set up the firmware RSS command header to send the next
		 * "nq" Ingress Queue IDs to the firmware.
		 */ /*
		 * "nq" more done for the start of the next loop.
		 */ /*
		 * While there are still Ingress Queue IDs to stuff into the
		 * current firmware RSS command, retrieve them from the
		 * Ingress Queue ID array and insert them into the command.
		 */ /*
			 * Grab up to the next 3 Ingress Queue IDs (wrapping
			 * around the Ingress Queue ID array if necessary) and
			 * insert them into the firmware RSS command at the
			 * current 3-tuple position within the commad.
			 */ /*
		 * Send this portion of the RRS table update to the firmware;
		 * bail out on any errors.
		 */