Commit 8ee5df65 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: split sequencer type in two

An IPA endpoint has a sequencer that must be configured based on how
the endpoint is to be used.  Currently the IPA code programs the
sequencer type by splitting a value into four 4-bit nibbles.  Doing
that doesn't really add much value, and regardless, a better way of
splitting the sequencer type is into two halves--the lower byte
describing how normal packet processing is handled, and the next
byte describing information about processing replicas.

So split the sequencer type into two sub-parts:  the sequencer type
and the replication sequencer type.  Define the values supported for
the "main" sequencer type, and define the values supported for the
replication part separately.

In addition, the sequencer type names are quite verbose, encoding
what the type includes, but also what it *excludes*.  Rename the
sequencer types in a way that mainly describes the number of passes
that a packet takes through the IPA processing pipeline, and how
many of those passes end by supplying the processed packet to the
microprocessor.

The result expands the supported types beyond what is required for
now, but simplifies the way these are defined.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9aa0805
...@@ -31,7 +31,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -31,7 +31,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
.tlv_count = 20, .tlv_count = 20,
}, },
.endpoint = { .endpoint = {
.seq_type = IPA_SEQ_DMA_ONLY, .seq_type = IPA_SEQ_DMA,
.config = { .config = {
.resource_group = 0, .resource_group = 0,
.dma_mode = true, .dma_mode = true,
...@@ -51,6 +51,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -51,6 +51,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.seq_type = IPA_SEQ_INVALID, .seq_type = IPA_SEQ_INVALID,
.seq_rep_type = IPA_SEQ_REP_INVALID,
.config = { .config = {
.resource_group = 0, .resource_group = 0,
.aggregation = true, .aggregation = true,
...@@ -73,8 +74,8 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -73,8 +74,8 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.filter_support = true, .filter_support = true,
.seq_type = .seq_type = IPA_SEQ_1_PASS_SKIP_LAST_UC,
IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP, .seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
.config = { .config = {
.resource_group = 0, .resource_group = 0,
.checksum = true, .checksum = true,
...@@ -99,6 +100,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -99,6 +100,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.seq_type = IPA_SEQ_INVALID, .seq_type = IPA_SEQ_INVALID,
.seq_rep_type = IPA_SEQ_REP_INVALID,
.config = { .config = {
.resource_group = 0, .resource_group = 0,
.checksum = true, .checksum = true,
......
...@@ -36,7 +36,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -36,7 +36,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
.tlv_count = 20, .tlv_count = 20,
}, },
.endpoint = { .endpoint = {
.seq_type = IPA_SEQ_DMA_ONLY, .seq_type = IPA_SEQ_DMA,
.config = { .config = {
.resource_group = 1, .resource_group = 1,
.dma_mode = true, .dma_mode = true,
...@@ -56,6 +56,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -56,6 +56,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.seq_type = IPA_SEQ_INVALID, .seq_type = IPA_SEQ_INVALID,
.seq_rep_type = IPA_SEQ_REP_INVALID,
.config = { .config = {
.resource_group = 1, .resource_group = 1,
.aggregation = true, .aggregation = true,
...@@ -78,8 +79,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -78,8 +79,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.filter_support = true, .filter_support = true,
.seq_type = .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
IPA_SEQ_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
.config = { .config = {
.resource_group = 1, .resource_group = 1,
.checksum = true, .checksum = true,
...@@ -104,6 +104,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -104,6 +104,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.seq_type = IPA_SEQ_INVALID, .seq_type = IPA_SEQ_INVALID,
.seq_rep_type = IPA_SEQ_REP_INVALID,
.config = { .config = {
.resource_group = 1, .resource_group = 1,
.checksum = true, .checksum = true,
......
...@@ -154,7 +154,8 @@ struct ipa_endpoint_config_data { ...@@ -154,7 +154,8 @@ struct ipa_endpoint_config_data {
/** /**
* struct ipa_endpoint_data - IPA endpoint configuration data * struct ipa_endpoint_data - IPA endpoint configuration data
* @filter_support: whether endpoint supports filtering * @filter_support: whether endpoint supports filtering
* @seq_type: hardware sequencer type used for endpoint * @seq_type: primary packet processing sequencer type
* @seq_rep_type: sequencer type for replication processing
* @config: hardware configuration (see above) * @config: hardware configuration (see above)
* *
* Not all endpoints support the IPA filtering capability. A filter table * Not all endpoints support the IPA filtering capability. A filter table
...@@ -170,8 +171,9 @@ struct ipa_endpoint_config_data { ...@@ -170,8 +171,9 @@ struct ipa_endpoint_config_data {
*/ */
struct ipa_endpoint_data { struct ipa_endpoint_data {
bool filter_support; bool filter_support;
/* The next two are specified only for AP endpoints */ /* The next three are specified only for AP endpoints */
enum ipa_seq_type seq_type; enum ipa_seq_type seq_type;
enum ipa_seq_rep_type seq_rep_type;
struct ipa_endpoint_config_data config; struct ipa_endpoint_config_data config;
}; };
......
...@@ -884,18 +884,16 @@ static void ipa_endpoint_init_rsrc_grp(struct ipa_endpoint *endpoint) ...@@ -884,18 +884,16 @@ static void ipa_endpoint_init_rsrc_grp(struct ipa_endpoint *endpoint)
static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint)
{ {
u32 offset = IPA_REG_ENDP_INIT_SEQ_N_OFFSET(endpoint->endpoint_id); u32 offset = IPA_REG_ENDP_INIT_SEQ_N_OFFSET(endpoint->endpoint_id);
u32 seq_type = endpoint->seq_type;
u32 val = 0; u32 val = 0;
if (!endpoint->toward_ipa) if (!endpoint->toward_ipa)
return; /* Register not valid for RX endpoints */ return; /* Register not valid for RX endpoints */
/* Sequencer type is made up of four nibbles */ /* Low-order byte configures primary packet processing */
val |= u32_encode_bits(seq_type & 0xf, HPS_SEQ_TYPE_FMASK); val |= u32_encode_bits(endpoint->seq_type, SEQ_TYPE_FMASK);
val |= u32_encode_bits((seq_type >> 4) & 0xf, DPS_SEQ_TYPE_FMASK);
/* The second two apply to replicated packets */ /* Second byte configures replicated packet processing */
val |= u32_encode_bits((seq_type >> 8) & 0xf, HPS_REP_SEQ_TYPE_FMASK); val |= u32_encode_bits(endpoint->seq_rep_type, SEQ_REP_TYPE_FMASK);
val |= u32_encode_bits((seq_type >> 12) & 0xf, DPS_REP_SEQ_TYPE_FMASK);
iowrite32(val, endpoint->ipa->reg_virt + offset); iowrite32(val, endpoint->ipa->reg_virt + offset);
} }
...@@ -1767,6 +1765,7 @@ static void ipa_endpoint_init_one(struct ipa *ipa, enum ipa_endpoint_name name, ...@@ -1767,6 +1765,7 @@ static void ipa_endpoint_init_one(struct ipa *ipa, enum ipa_endpoint_name name,
endpoint->ipa = ipa; endpoint->ipa = ipa;
endpoint->ee_id = data->ee_id; endpoint->ee_id = data->ee_id;
endpoint->seq_type = data->endpoint.seq_type; endpoint->seq_type = data->endpoint.seq_type;
endpoint->seq_rep_type = data->endpoint.seq_rep_type;
endpoint->channel_id = data->channel_id; endpoint->channel_id = data->channel_id;
endpoint->endpoint_id = data->endpoint_id; endpoint->endpoint_id = data->endpoint_id;
endpoint->toward_ipa = data->toward_ipa; endpoint->toward_ipa = data->toward_ipa;
......
...@@ -47,6 +47,7 @@ enum ipa_endpoint_name { ...@@ -47,6 +47,7 @@ enum ipa_endpoint_name {
struct ipa_endpoint { struct ipa_endpoint {
struct ipa *ipa; struct ipa *ipa;
enum ipa_seq_type seq_type; enum ipa_seq_type seq_type;
enum ipa_seq_rep_type seq_rep_type;
enum gsi_ee_id ee_id; enum gsi_ee_id ee_id;
u32 channel_id; u32 channel_id;
u32 endpoint_id; u32 endpoint_id;
......
...@@ -580,28 +580,42 @@ static inline u32 rsrc_grp_encoded(enum ipa_version version, u32 rsrc_grp) ...@@ -580,28 +580,42 @@ static inline u32 rsrc_grp_encoded(enum ipa_version version, u32 rsrc_grp)
/* Valid only for TX (IPA consumer) endpoints */ /* Valid only for TX (IPA consumer) endpoints */
#define IPA_REG_ENDP_INIT_SEQ_N_OFFSET(txep) \ #define IPA_REG_ENDP_INIT_SEQ_N_OFFSET(txep) \
(0x0000083c + 0x0070 * (txep)) (0x0000083c + 0x0070 * (txep))
#define HPS_SEQ_TYPE_FMASK GENMASK(3, 0) #define SEQ_TYPE_FMASK GENMASK(7, 0)
#define DPS_SEQ_TYPE_FMASK GENMASK(7, 4) #define SEQ_REP_TYPE_FMASK GENMASK(15, 8)
#define HPS_REP_SEQ_TYPE_FMASK GENMASK(11, 8)
#define DPS_REP_SEQ_TYPE_FMASK GENMASK(15, 12)
/** /**
* enum ipa_seq_type - HPS and DPS sequencer type fields in ENDP_INIT_SEQ_N * enum ipa_seq_type - HPS and DPS sequencer type
* @IPA_SEQ_DMA_ONLY: only DMA is performed
* @IPA_SEQ_2ND_PKT_PROCESS_PASS_NO_DEC_UCP:
* second packet processing pass + no decipher + microcontroller
* @IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP:
* packet processing + no decipher + no uCP + HPS REP DMA parser
* @IPA_SEQ_INVALID: invalid sequencer type
* *
* The values defined here are broken into 4-bit nibbles that are written * The low-order byte of the sequencer type register defines the number of
* into fields of the ENDP_INIT_SEQ registers. * passes a packet takes through the IPA pipeline. The last pass through can
* optionally skip the microprocessor. Deciphering is optional for all types;
* if enabled, an additional mask (two bits) is added to the type value.
*
* Note: not all combinations of ipa_seq_type and ipa_seq_rep_type are
* supported (or meaningful).
*/ */
#define IPA_SEQ_DECIPHER 0x11
enum ipa_seq_type { enum ipa_seq_type {
IPA_SEQ_DMA_ONLY = 0x0000, IPA_SEQ_DMA = 0x00,
IPA_SEQ_2ND_PKT_PROCESS_PASS_NO_DEC_UCP = 0x0004, IPA_SEQ_1_PASS = 0x02,
IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP = 0x0806, IPA_SEQ_2_PASS_SKIP_LAST_UC = 0x04,
IPA_SEQ_INVALID = 0xffff, IPA_SEQ_1_PASS_SKIP_LAST_UC = 0x06,
IPA_SEQ_2_PASS = 0x0a,
IPA_SEQ_3_PASS_SKIP_LAST_UC = 0x0c,
IPA_SEQ_INVALID = 0x0c,
};
/**
* enum ipa_seq_rep_type - replicated packet sequencer type
*
* This goes in the second byte of the endpoint sequencer type register.
*
* Note: not all combinations of ipa_seq_type and ipa_seq_rep_type are
* supported (or meaningful).
*/
enum ipa_seq_rep_type {
IPA_SEQ_REP_DMA_PARSER = 0x08,
IPA_SEQ_REP_INVALID = 0x0c,
}; };
#define IPA_REG_ENDP_STATUS_N_OFFSET(ep) \ #define IPA_REG_ENDP_STATUS_N_OFFSET(ep) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment