phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sireesh Kodali" <sireeshkodali1@gmail.com>
To: "Alex Elder" <elder@ieee.org>, <phone-devel@vger.kernel.org>,
	<~postmarketos/upstreaming@lists.sr.ht>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<elder@kernel.org>
Cc: "Vladimir Lypak" <vladimir.lypak@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>
Subject: Re: [RFC PATCH 02/17] net: ipa: revert to IPA_TABLE_ENTRY_SIZE for 32-bit IPA support
Date: Mon, 18 Oct 2021 21:46:45 +0530	[thread overview]
Message-ID: <CF2O1ZMOGK98.RQ3P9X0BFKNH@skynet-linux> (raw)
In-Reply-To: <3d0d6d98-201f-496f-a479-9aeaf8b2e837@ieee.org>

On Thu Oct 14, 2021 at 3:58 AM IST, Alex Elder wrote:
> On 9/19/21 10:07 PM, Sireesh Kodali wrote:
> > From: Vladimir Lypak <vladimir.lypak@gmail.com>
> > 
> > IPA v2.x is 32 bit. Having an IPA_TABLE_ENTRY size makes it easier to
> > deal with supporting both 32 bit and 64 bit IPA versions
>
> This looks reasonable. At this point filter/route tables aren't
> really used, so this is a simple fix. You use IPA_IS_64BIT()
> here, but it isn't defined until patch 7, which I expect is a
> build problem.

Oof, I probably messed this up while re-ordering the commits... will fix

Regards,
Sireesh
>
> -Alex
>
> > Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
> > Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
> > ---
> >   drivers/net/ipa/ipa_qmi.c   | 10 ++++++----
> >   drivers/net/ipa/ipa_table.c | 29 +++++++++++++----------------
> >   drivers/net/ipa/ipa_table.h |  4 ++++
> >   3 files changed, 23 insertions(+), 20 deletions(-)
> > 
> > diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c
> > index 90f3aec55b36..7e2fe701cc4d 100644
> > --- a/drivers/net/ipa/ipa_qmi.c
> > +++ b/drivers/net/ipa/ipa_qmi.c
> > @@ -308,12 +308,12 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi)
> >   	mem = ipa_mem_find(ipa, IPA_MEM_V4_ROUTE);
> >   	req.v4_route_tbl_info_valid = 1;
> >   	req.v4_route_tbl_info.start = ipa->mem_offset + mem->offset;
> > -	req.v4_route_tbl_info.count = mem->size / sizeof(__le64);
> > +	req.v4_route_tbl_info.count = mem->size / IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   
> >   	mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE);
> >   	req.v6_route_tbl_info_valid = 1;
> >   	req.v6_route_tbl_info.start = ipa->mem_offset + mem->offset;
> > -	req.v6_route_tbl_info.count = mem->size / sizeof(__le64);
> > +	req.v6_route_tbl_info.count = mem->size / IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   
> >   	mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER);
> >   	req.v4_filter_tbl_start_valid = 1;
> > @@ -352,7 +352,8 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi)
> >   		req.v4_hash_route_tbl_info_valid = 1;
> >   		req.v4_hash_route_tbl_info.start =
> >   				ipa->mem_offset + mem->offset;
> > -		req.v4_hash_route_tbl_info.count = mem->size / sizeof(__le64);
> > +		req.v4_hash_route_tbl_info.count =
> > +				mem->size / IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   	}
> >   
> >   	mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE_HASHED);
> > @@ -360,7 +361,8 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi)
> >   		req.v6_hash_route_tbl_info_valid = 1;
> >   		req.v6_hash_route_tbl_info.start =
> >   			ipa->mem_offset + mem->offset;
> > -		req.v6_hash_route_tbl_info.count = mem->size / sizeof(__le64);
> > +		req.v6_hash_route_tbl_info.count =
> > +				mem->size / IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   	}
> >   
> >   	mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED);
> > diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c
> > index 1da334f54944..96c467c80a2e 100644
> > --- a/drivers/net/ipa/ipa_table.c
> > +++ b/drivers/net/ipa/ipa_table.c
> > @@ -118,7 +118,8 @@
> >    * 32-bit all-zero rule list terminator.  The "zero rule" is simply an
> >    * all-zero rule followed by the list terminator.
> >    */
> > -#define IPA_ZERO_RULE_SIZE		(2 * sizeof(__le32))
> > +#define IPA_ZERO_RULE_SIZE(version) \
> > +	 (IPA_IS_64BIT(version) ? 2 * sizeof(__le32) : sizeof(__le32))
> >   
> >   /* Check things that can be validated at build time. */
> >   static void ipa_table_validate_build(void)
> > @@ -132,12 +133,6 @@ static void ipa_table_validate_build(void)
> >   	 */
> >   	BUILD_BUG_ON(sizeof(dma_addr_t) > sizeof(__le64));
> >   
> > -	/* A "zero rule" is used to represent no filtering or no routing.
> > -	 * It is a 64-bit block of zeroed memory.  Code in ipa_table_init()
> > -	 * assumes that it can be written using a pointer to __le64.
> > -	 */
> > -	BUILD_BUG_ON(IPA_ZERO_RULE_SIZE != sizeof(__le64));
> > -
> >   	/* Impose a practical limit on the number of routes */
> >   	BUILD_BUG_ON(IPA_ROUTE_COUNT_MAX > 32);
> >   	/* The modem must be allotted at least one route table entry */
> > @@ -236,7 +231,7 @@ static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count)
> >   	/* Skip over the zero rule and possibly the filter mask */
> >   	skip = filter_mask ? 1 : 2;
> >   
> > -	return ipa->table_addr + skip * sizeof(*ipa->table_virt);
> > +	return ipa->table_addr + skip * IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   }
> >   
> >   static void ipa_table_reset_add(struct gsi_trans *trans, bool filter,
> > @@ -255,8 +250,8 @@ static void ipa_table_reset_add(struct gsi_trans *trans, bool filter,
> >   	if (filter)
> >   		first++;	/* skip over bitmap */
> >   
> > -	offset = mem->offset + first * sizeof(__le64);
> > -	size = count * sizeof(__le64);
> > +	offset = mem->offset + first * IPA_TABLE_ENTRY_SIZE(ipa->version);
> > +	size = count * IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   	addr = ipa_table_addr(ipa, false, count);
> >   
> >   	ipa_cmd_dma_shared_mem_add(trans, offset, size, addr, true);
> > @@ -434,11 +429,11 @@ static void ipa_table_init_add(struct gsi_trans *trans, bool filter,
> >   		count = 1 + hweight32(ipa->filter_map);
> >   		hash_count = hash_mem->size ? count : 0;
> >   	} else {
> > -		count = mem->size / sizeof(__le64);
> > -		hash_count = hash_mem->size / sizeof(__le64);
> > +		count = mem->size / IPA_TABLE_ENTRY_SIZE(ipa->version);
> > +		hash_count = hash_mem->size / IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   	}
> > -	size = count * sizeof(__le64);
> > -	hash_size = hash_count * sizeof(__le64);
> > +	size = count * IPA_TABLE_ENTRY_SIZE(ipa->version);
> > +	hash_size = hash_count * IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   
> >   	addr = ipa_table_addr(ipa, filter, count);
> >   	hash_addr = ipa_table_addr(ipa, filter, hash_count);
> > @@ -621,7 +616,8 @@ int ipa_table_init(struct ipa *ipa)
> >   	 * by dma_alloc_coherent() is guaranteed to be a power-of-2 number
> >   	 * of pages, which satisfies the rule alignment requirement.
> >   	 */
> > -	size = IPA_ZERO_RULE_SIZE + (1 + count) * sizeof(__le64);
> > +	size = IPA_ZERO_RULE_SIZE(ipa->version) +
> > +	       (1 + count) * IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   	virt = dma_alloc_coherent(dev, size, &addr, GFP_KERNEL);
> >   	if (!virt)
> >   		return -ENOMEM;
> > @@ -653,7 +649,8 @@ void ipa_table_exit(struct ipa *ipa)
> >   	struct device *dev = &ipa->pdev->dev;
> >   	size_t size;
> >   
> > -	size = IPA_ZERO_RULE_SIZE + (1 + count) * sizeof(__le64);
> > +	size = IPA_ZERO_RULE_SIZE(ipa->version) +
> > +	       (1 + count) * IPA_TABLE_ENTRY_SIZE(ipa->version);
> >   
> >   	dma_free_coherent(dev, size, ipa->table_virt, ipa->table_addr);
> >   	ipa->table_addr = 0;
> > diff --git a/drivers/net/ipa/ipa_table.h b/drivers/net/ipa/ipa_table.h
> > index b6a9a0d79d68..78a168ce6558 100644
> > --- a/drivers/net/ipa/ipa_table.h
> > +++ b/drivers/net/ipa/ipa_table.h
> > @@ -10,6 +10,10 @@
> >   
> >   struct ipa;
> >   
> > +/* The size of a filter or route table entry */
> > +#define IPA_TABLE_ENTRY_SIZE(version)	\
> > +	(IPA_IS_64BIT(version) ? sizeof(__le64) : sizeof(__le32))
> > +
> >   /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) */
> >   #define IPA_FILTER_COUNT_MAX	14
> >   
> > 


  reply	other threads:[~2021-10-18 16:22 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  3:07 [RFC PATCH 00/17] net: ipa: Add support for IPA v2.x Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 01/17] net: ipa: Correct ipa_status_opcode enumeration Sireesh Kodali
2021-10-13 22:28   ` Alex Elder
2021-10-18 16:12     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 02/17] net: ipa: revert to IPA_TABLE_ENTRY_SIZE for 32-bit IPA support Sireesh Kodali
2021-10-13 22:28   ` Alex Elder
2021-10-18 16:16     ` Sireesh Kodali [this message]
2021-09-20  3:07 ` [RFC PATCH 04/17] net: ipa: Establish ipa_dma interface Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 16:45     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 05/17] net: ipa: Check interrupts for availability Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 06/17] net: ipa: Add timeout for ipa_cmd_pipeline_clear_wait Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 17:02     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 07/17] net: ipa: Add IPA v2.x register definitions Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 17:25     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 08/17] net: ipa: Add support for IPA v2.x interrupts Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 09/17] net: ipa: Add support for using BAM as a DMA transport Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 17:30     ` Sireesh Kodali
2021-09-20  3:08 ` [PATCH 10/17] net: ipa: Add support for IPA v2.x commands and table init Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:13     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 11/17] net: ipa: Add support for IPA v2.x endpoints Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:17     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 12/17] net: ipa: Add support for IPA v2.x memory map Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:19     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 13/17] net: ipa: Add support for IPA v2.x in the driver's QMI interface Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:22     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 14/17] net: ipa: Add support for IPA v2 microcontroller Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 15/17] net: ipa: Add IPA v2.6L initialization sequence support Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 16/17] net: ipa: Add hw config describing IPA v2.x hardware Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:35     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 17/17] dt-bindings: net: qcom,ipa: Add support for MSM8953 and MSM8996 IPA Sireesh Kodali
2021-09-23 12:42   ` Rob Herring
2021-10-13 22:31   ` Alex Elder
2021-10-13 22:27 ` [RFC PATCH 00/17] net: ipa: Add support for IPA v2.x Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CF2O1ZMOGK98.RQ3P9X0BFKNH@skynet-linux \
    --to=sireeshkodali1@gmail.com \
    --cc=davem@davemloft.net \
    --cc=elder@ieee.org \
    --cc=elder@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=vladimir.lypak@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).