]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: ipa: assign endpoint to a resource group
authorAlex Elder <elder@linaro.org>
Wed, 28 Oct 2020 19:41:46 +0000 (14:41 -0500)
committerJakub Kicinski <kuba@kernel.org>
Sat, 31 Oct 2020 00:20:07 +0000 (17:20 -0700)
The IPA hardware manages various resources (e.g. descriptors)
internally to perform its functions.  The resources are grouped,
allowing different endpoints to use separate resource pools.  This
way one group of endpoints can be configured to operate unaffected
by the resource use of endpoints in a different group.

Endpoints should be assigned to a resource group, but we currently
don't do that.

Define a new resource_group field in the endpoint configuration
data, and use it to assign the proper resource group to use for
each AP endpoint.

Tested-by: Sujit Kautkar <sujitka@chromium.org>
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/ipa_data-sc7180.c
drivers/net/ipa/ipa_data-sdm845.c
drivers/net/ipa/ipa_data.h
drivers/net/ipa/ipa_endpoint.c

index d4c2bc7ad24bf29a58414ff36968b4eabaeb40e1..37dada4da68087d0da1847be1ce1884b5bb8f0ec 100644 (file)
@@ -24,6 +24,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_DMA_ONLY,
                        .config = {
+                               .resource_group = 0,
                                .dma_mode       = true,
                                .dma_endpoint   = IPA_ENDPOINT_AP_LAN_RX,
                        },
@@ -42,6 +43,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 0,
                                .aggregation    = true,
                                .status_enable  = true,
                                .rx = {
@@ -65,6 +67,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                        .seq_type       =
                                IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP,
                        .config = {
+                               .resource_group = 0,
                                .checksum       = true,
                                .qmap           = true,
                                .status_enable  = true,
@@ -88,6 +91,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 0,
                                .checksum       = true,
                                .qmap           = true,
                                .aggregation    = true,
index de2768d71ab56b6dc38ad6c0a1549b9620fc1abb..a9a992404b39f81eb78960772a2390bfe97a699c 100644 (file)
@@ -26,6 +26,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_DMA_ONLY,
                        .config = {
+                               .resource_group = 1,
                                .dma_mode       = true,
                                .dma_endpoint   = IPA_ENDPOINT_AP_LAN_RX,
                        },
@@ -44,6 +45,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 1,
                                .aggregation    = true,
                                .status_enable  = true,
                                .rx = {
@@ -67,6 +69,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                        .seq_type       =
                                IPA_SEQ_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
                        .config = {
+                               .resource_group = 1,
                                .checksum       = true,
                                .qmap           = true,
                                .status_enable  = true,
@@ -90,6 +93,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .seq_type       = IPA_SEQ_INVALID,
                        .config = {
+                               .resource_group = 1,
                                .checksum       = true,
                                .qmap           = true,
                                .aggregation    = true,
index 7fc1058a5ca936e60f38a0bb6aab189f3521fedf..d084a83069db2a2be318281264c67818b5f97a19 100644 (file)
@@ -109,6 +109,7 @@ struct ipa_endpoint_rx_data {
 
 /**
  * struct ipa_endpoint_config_data - IPA endpoint hardware configuration
+ * @resource_group:    resource group to assign endpoint to
  * @checksum:          whether checksum offload is enabled
  * @qmap:              whether endpoint uses QMAP protocol
  * @aggregation:       whether endpoint supports aggregation
@@ -119,6 +120,7 @@ struct ipa_endpoint_rx_data {
  * @rx:                        RX-specific endpoint information (see above)
  */
 struct ipa_endpoint_config_data {
+       u32 resource_group;
        bool checksum;
        bool qmap;
        bool aggregation;
index b40b711cf4bd5911a365f8ccdaf5f19853f3afba..7386e10615d99e680796aa166787129f1c5e4866 100644 (file)
@@ -751,6 +751,16 @@ static void ipa_endpoint_init_deaggr(struct ipa_endpoint *endpoint)
        iowrite32(val, endpoint->ipa->reg_virt + offset);
 }
 
+static void ipa_endpoint_init_rsrc_grp(struct ipa_endpoint *endpoint)
+{
+       u32 offset = IPA_REG_ENDP_INIT_RSRC_GRP_N_OFFSET(endpoint->endpoint_id);
+       struct ipa *ipa = endpoint->ipa;
+       u32 val;
+
+       val = rsrc_grp_encoded(ipa->version, endpoint->data->resource_group);
+       iowrite32(val, ipa->reg_virt + offset);
+}
+
 static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint)
 {
        u32 offset = IPA_REG_ENDP_INIT_SEQ_N_OFFSET(endpoint->endpoint_id);
@@ -1328,6 +1338,7 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint)
        ipa_endpoint_init_mode(endpoint);
        ipa_endpoint_init_aggr(endpoint);
        ipa_endpoint_init_deaggr(endpoint);
+       ipa_endpoint_init_rsrc_grp(endpoint);
        ipa_endpoint_init_seq(endpoint);
        ipa_endpoint_status(endpoint);
 }