Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0c2ee99 authored by Ben Hutchings's avatar Ben Hutchings
Browse files

sfc: Introduce and use MCDI_CTL_SDU_LEN_MAX_V1 macro for Siena-specific code



The MCDI version 2 protocol supports larger payloads, but will
not be implemented on Siena.

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent a649dfcb
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -100,7 +100,9 @@
#define MCDI_HEADER_XFLAGS_EVREQ 0x01
#define MCDI_HEADER_XFLAGS_EVREQ 0x01


/* Maximum number of payload bytes */
/* Maximum number of payload bytes */
#define MCDI_CTL_SDU_LEN_MAX 0xfc
#define MCDI_CTL_SDU_LEN_MAX_V1 0xfc

#define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V1


/* The MC can generate events for two reasons:
/* The MC can generate events for two reasons:
 *   - To complete a shared memory request if XFLAGS_EVREQ was set
 *   - To complete a shared memory request if XFLAGS_EVREQ was set
+4 −3
Original line number Original line Diff line number Diff line
@@ -248,11 +248,11 @@ static int efx_sriov_memcpy(struct efx_nic *efx, struct efx_memcpy_req *req,
	mb();	/* Finish writing source/reading dest before DMA starts */
	mb();	/* Finish writing source/reading dest before DMA starts */


	used = MC_CMD_MEMCPY_IN_LEN(count);
	used = MC_CMD_MEMCPY_IN_LEN(count);
	if (WARN_ON(used > MCDI_CTL_SDU_LEN_MAX))
	if (WARN_ON(used > MCDI_CTL_SDU_LEN_MAX_V1))
		return -ENOBUFS;
		return -ENOBUFS;


	/* Allocate room for the largest request */
	/* Allocate room for the largest request */
	inbuf = kzalloc(MCDI_CTL_SDU_LEN_MAX, GFP_KERNEL);
	inbuf = kzalloc(MCDI_CTL_SDU_LEN_MAX_V1, GFP_KERNEL);
	if (inbuf == NULL)
	if (inbuf == NULL)
		return -ENOMEM;
		return -ENOMEM;


@@ -270,7 +270,8 @@ static int efx_sriov_memcpy(struct efx_nic *efx, struct efx_memcpy_req *req,
			from_lo = (u32)req->from_addr;
			from_lo = (u32)req->from_addr;
			from_hi = (u32)(req->from_addr >> 32);
			from_hi = (u32)(req->from_addr >> 32);
		} else {
		} else {
			if (WARN_ON(used + req->length > MCDI_CTL_SDU_LEN_MAX)) {
			if (WARN_ON(used + req->length >
				    MCDI_CTL_SDU_LEN_MAX_V1)) {
				rc = -ENOBUFS;
				rc = -ENOBUFS;
				goto out;
				goto out;
			}
			}