diff options
author | Alex Elder <elder@linaro.org> | 2021-01-26 12:57:00 -0600 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-28 20:23:26 -0800 |
commit | f6aba7b5199ad2a73a3deb6c042dee770650719c (patch) | |
tree | 72810c0dbe20c57b323020fec589bbee07b8f9d9 | |
parent | 162fbc6f4519f9b083fbd96b60d908c78a9c87f6 (diff) | |
download | linux-f6aba7b5199ad2a73a3deb6c042dee770650719c.tar.gz linux-f6aba7b5199ad2a73a3deb6c042dee770650719c.tar.bz2 linux-f6aba7b5199ad2a73a3deb6c042dee770650719c.zip |
net: ipa: drop packet if status has valid tag
Introduce ipa_endpoint_status_tag(), which returns true if received
status indicates its tag field is valid. The endpoint parameter is
not yet used.
Call this from ipa_status_drop_packet(), and drop the packet if the
status indicates the tag was valid. Pass the endpoint pointer to
ipa_status_drop_packet(), and rename it ipa_endpoint_status_drop().
The endpoint will be used in the next patch.
Signed-off-by: Alex Elder <elder@linaro.org>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | drivers/net/ipa/ipa_endpoint.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index c5524215054c..68970a3baa47 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -69,8 +69,11 @@ struct ipa_status { }; /* Field masks for struct ipa_status structure fields */ +#define IPA_STATUS_MASK_TAG_VALID_FMASK GENMASK(4, 4) +#define IPA_STATUS_SRC_IDX_FMASK GENMASK(4, 0) #define IPA_STATUS_DST_IDX_FMASK GENMASK(4, 0) #define IPA_STATUS_FLAGS1_RT_RULE_ID_FMASK GENMASK(31, 22) +#define IPA_STATUS_FLAGS2_TAG_FMASK GENMASK_ULL(63, 16) #ifdef IPA_VALIDATE @@ -1172,11 +1175,22 @@ static bool ipa_endpoint_status_skip(struct ipa_endpoint *endpoint, return false; /* Don't skip this packet, process it */ } +static bool ipa_endpoint_status_tag(struct ipa_endpoint *endpoint, + const struct ipa_status *status) +{ + return !!le16_get_bits(status->mask, IPA_STATUS_MASK_TAG_VALID_FMASK); +} + /* Return whether the status indicates the packet should be dropped */ -static bool ipa_status_drop_packet(const struct ipa_status *status) +static bool ipa_endpoint_status_drop(struct ipa_endpoint *endpoint, + const struct ipa_status *status) { u32 val; + /* If the status indicates a tagged transfer, we'll drop the packet */ + if (ipa_endpoint_status_tag(endpoint, status)) + return true; + /* Deaggregation exceptions we drop; all other types we consume */ if (status->exception) return status->exception == IPA_STATUS_EXCEPTION_DEAGGR; @@ -1225,7 +1239,7 @@ static void ipa_endpoint_status_parse(struct ipa_endpoint *endpoint, if (endpoint->data->checksum) len += sizeof(struct rmnet_map_dl_csum_trailer); - if (!ipa_status_drop_packet(status)) { + if (!ipa_endpoint_status_drop(endpoint, status)) { void *data2; u32 extra; u32 len2; |