diff mbox series

[net-next,3/6] net: ipa: drop packet if status has valid tag

Message ID 20210125212947.17097-4-elder@linaro.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: ipa: hardware pipeline cleanup fixes | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 42 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 1 this patch: 2
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Alex Elder Jan. 25, 2021, 9:29 p.m. UTC
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>
---
 drivers/net/ipa/ipa_endpoint.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Jan. 26, 2021, 3:27 a.m. UTC | #1
On Mon, 25 Jan 2021 15:29:44 -0600 Alex Elder wrote:
> 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>

> @@ -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 !!(status->mask & IPA_STATUS_MASK_TAG_VALID_FMASK);

drivers/net/ipa/ipa_endpoint.c:1181:25: warning: restricted __le16 degrades to integer

> +}
> +
Alex Elder Jan. 26, 2021, 4:24 a.m. UTC | #2
On 1/25/21 9:27 PM, Jakub Kicinski wrote:
> On Mon, 25 Jan 2021 15:29:44 -0600 Alex Elder wrote:
>> 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>
> 
>> @@ -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 !!(status->mask & IPA_STATUS_MASK_TAG_VALID_FMASK);
> 
> drivers/net/ipa/ipa_endpoint.c:1181:25: warning: restricted __le16 degrades to integer

Wow, that's an important one.

Sparse is spewing errors for me.  I guess I'm finally going to have
to figure out what's wrong.

I'll send an update tomorrow.  I know how to fix it but I want to
verify it works before I send it out.

Thank you.

					-Alex

>> +}
>> +
diff mbox series

Patch

diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index c5524215054c8..f1764768f0602 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 !!(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;