netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Christophe Leroy <christophe.leroy@csgroup.eu>, netdev@vger.kernel.org
Cc: Li Yang <leoyang.li@nxp.com>,
	"David S . Miller" <davem@davemloft.net>,
	Zhao Qiang <qiang.zhao@nxp.com>, Andrew Lunn <andrew@lunn.ch>,
	Jakub Kicinski <kuba@kernel.org>,
	Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
Subject: Re: [PATCH net-next v2 13/17] ethernet: ucc_geth: remove bd_mem_part and all associated code
Date: Wed, 20 Jan 2021 12:33:33 +0100	[thread overview]
Message-ID: <8c31cc00-b1bc-cefa-8ea8-5907b8fbe6ef@prevas.dk> (raw)
In-Reply-To: <58e13bb0-11fa-95e7-e9d9-acc649af4df7@csgroup.eu>

On 20/01/2021 08.17, Christophe Leroy wrote:
> 
> Le 19/01/2021 à 16:07, Rasmus Villemoes a écrit :
>> The bd_mem_part member of ucc_geth_info always has the value
>> MEM_PART_SYSTEM, and AFAICT, there has never been any code setting it
>> to any other value. Moreover, muram is a somewhat precious resource,
>> so there's no point using that when normal memory serves just as well.
>>
>> Apart from removing a lot of dead code, this is also motivated by
>> wanting to clean up the "store result from kmalloc() in a u32" mess.
>>
>> @@ -2195,25 +2179,15 @@ static int ucc_geth_alloc_tx(struct
>> ucc_geth_private *ugeth)
>>           if ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)) %
>>               UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT)
>>               length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT;
>> -        }
>> +
>> +        ugeth->tx_bd_ring_offset[j] =
>> +            (u32) kmalloc((u32) (length + align), GFP_KERNEL);
> 
> Can't this fit on a single ? Nowadays, max allowed line length is 100
> chars.
> 
>> +
>> +        if (ugeth->tx_bd_ring_offset[j] != 0)
>> +            ugeth->p_tx_bd_ring[j] =
>> +                (u8 __iomem *)((ugeth->tx_bd_ring_offset[j] +
>> +                        align) & ~(align - 1));
> 
> Can we get the above fit on only 2 lines ?
> 
>> +
>> -        }
>> +        ugeth->rx_bd_ring_offset[j] =
>> +            (u32) kmalloc((u32) (length + align), GFP_KERNEL);
> 
> Same.

This is all deliberate: Verifying that this patch merely removes the
dead branch (and thus outdenting the always-taken branch) is easily done
by using "git show -w". That shows hunks like

@@ -2554,20 +2519,11 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
                endOfRing =
                    ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] -
                                              1) * sizeof(struct qe_bd);
-               if (ugeth->ug_info->uf_info.bd_mem_part ==
MEM_PART_SYSTEM) {
                out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
                         (u32) virt_to_phys(ugeth->p_tx_bd_ring[i]));
                out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
                         last_bd_completed_address,
                         (u32) virt_to_phys(endOfRing));
-               } else if (ugeth->ug_info->uf_info.bd_mem_part ==
-                          MEM_PART_MURAM) {
-
out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base,
-                                (u32)qe_muram_dma(ugeth->p_tx_bd_ring[i]));
-                       out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].
-                                last_bd_completed_address,
-                                (u32)qe_muram_dma(endOfRing));
-               }
        }

So I didn't want to rewrap any of the lines.

Rasmus

  reply	other threads:[~2021-01-20 12:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 15:07 [PATCH net-next v2 00/17] ucc_geth improvements Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 01/17] ethernet: ucc_geth: remove unused read of temoder field Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 02/17] soc: fsl: qe: make cpm_muram_offset take a const void* argument Rasmus Villemoes
2021-01-19 18:42   ` Leo Li
2021-01-19 15:07 ` [PATCH net-next v2 03/17] soc: fsl: qe: store muram_vbase as a void pointer instead of u8 Rasmus Villemoes
2021-01-19 18:45   ` Li Yang
2021-01-19 15:07 ` [PATCH net-next v2 04/17] soc: fsl: qe: add cpm_muram_free_addr() helper Rasmus Villemoes
2021-01-19 18:46   ` Li Yang
2021-01-19 15:07 ` [PATCH net-next v2 05/17] ethernet: ucc_geth: use qe_muram_free_addr() Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 06/17] ethernet: ucc_geth: remove unnecessary memset_io() calls Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 07/17] ethernet: ucc_geth: replace kmalloc+memset by kzalloc Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 08/17] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private Rasmus Villemoes
2021-01-20  6:57   ` Christophe Leroy
2021-01-20 11:26     ` Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 09/17] ethernet: ucc_geth: factor out parsing of {rx,tx}-clock{,-name} properties Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 10/17] ethernet: ucc_geth: constify ugeth_primary_info Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info Rasmus Villemoes
2021-01-20  7:02   ` Christophe Leroy
2021-01-20 11:25     ` Rasmus Villemoes
2021-01-20 11:30       ` Christophe Leroy
2021-01-19 15:07 ` [PATCH net-next v2 12/17] ethernet: ucc_geth: use UCC_GETH_{RX,TX}_BD_RING_ALIGNMENT macros directly Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 13/17] ethernet: ucc_geth: remove bd_mem_part and all associated code Rasmus Villemoes
2021-01-20  7:17   ` Christophe Leroy
2021-01-20 11:33     ` Rasmus Villemoes [this message]
2021-01-19 15:07 ` [PATCH net-next v2 14/17] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc() Rasmus Villemoes
2021-01-20  7:19   ` Christophe Leroy
2021-01-19 15:08 ` [PATCH net-next v2 15/17] ethernet: ucc_geth: add helper to replace repeated switch statements Rasmus Villemoes
2021-01-19 15:08 ` [PATCH net-next v2 16/17] ethernet: ucc_geth: inform the compiler that numQueues is always 1 Rasmus Villemoes
2021-01-19 15:08 ` [PATCH net-next v2 17/17] ethernet: ucc_geth: simplify rx/tx allocations Rasmus Villemoes
2021-01-19 17:52 ` [PATCH net-next v2 00/17] ucc_geth improvements Leo Li
2021-01-21 20:30 ` patchwork-bot+netdevbpf

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=8c31cc00-b1bc-cefa-8ea8-5907b8fbe6ef@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=Joakim.Tjernlund@infinera.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=qiang.zhao@nxp.com \
    /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).