diff mbox series

[net-next,01/13] ravb: Remove the macros NUM_TX_DESC_GEN[23]

Message ID 20210825070154.14336-2-biju.das.jz@bp.renesas.com (mailing list archive)
State Accepted
Commit c81d894226b94439c543e9cfac406c8024172fd7
Delegated to: Netdev Maintainers
Headers show
Series Add Factorisation code to support Gigabit Ethernet driver | 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 warning 1 maintainers not CCed: yangyingliang@huawei.com
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, 24 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Biju Das Aug. 25, 2021, 7:01 a.m. UTC
For addressing 4 bytes alignment restriction on transmission
buffer for R-Car Gen2 we use 2 descriptors whereas it is a single
descriptor for other cases.
Replace the macros NUM_TX_DESC_GEN[23] with magic number and
add a comment to explain it.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 4 ----
 drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++--
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Sergey Shtylyov Aug. 25, 2021, 2:30 p.m. UTC | #1
Hello!

On 8/25/21 10:01 AM, Biju Das wrote:

> For addressing 4 bytes alignment restriction on transmission
> buffer for R-Car Gen2 we use 2 descriptors whereas it is a single
> descriptor for other cases.
> Replace the macros NUM_TX_DESC_GEN[23] with magic number and
> add a comment to explain it.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 02842b980a7f..073e690ab830 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2160,8 +2160,12 @@ static int ravb_probe(struct platform_device *pdev)
>  	ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
>  	ndev->min_mtu = ETH_MIN_MTU;
>  
> -	priv->num_tx_desc = info->aligned_tx ?
> -		NUM_TX_DESC_GEN2 : NUM_TX_DESC_GEN3;
> +	/* FIXME: R-Car Gen2 has 4byte alignment restriction for tx buffer

   Mhm, what are you going to fix here?

> +	 * Use two descriptor to handle such situation. First descriptor to
> +	 * handle aligned data buffer and second descriptor to handle the
> +	 * overflow data because of alignment.
> +	 */
> +	priv->num_tx_desc = info->aligned_tx ? 2 : 1;
>  
>  	/* Set function */
>  	ndev->netdev_ops = &ravb_netdev_ops;

   Other than that:

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 37ad0f8aaf3c..84700a82a41c 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -956,10 +956,6 @@  enum RAVB_QUEUE {
 
 #define RX_BUF_SZ	(2048 - ETH_FCS_LEN + sizeof(__sum16))
 
-/* TX descriptors per packet */
-#define NUM_TX_DESC_GEN2	2
-#define NUM_TX_DESC_GEN3	1
-
 struct ravb_tstamp_skb {
 	struct list_head list;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 02842b980a7f..073e690ab830 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2160,8 +2160,12 @@  static int ravb_probe(struct platform_device *pdev)
 	ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
 	ndev->min_mtu = ETH_MIN_MTU;
 
-	priv->num_tx_desc = info->aligned_tx ?
-		NUM_TX_DESC_GEN2 : NUM_TX_DESC_GEN3;
+	/* FIXME: R-Car Gen2 has 4byte alignment restriction for tx buffer
+	 * Use two descriptor to handle such situation. First descriptor to
+	 * handle aligned data buffer and second descriptor to handle the
+	 * overflow data because of alignment.
+	 */
+	priv->num_tx_desc = info->aligned_tx ? 2 : 1;
 
 	/* Set function */
 	ndev->netdev_ops = &ravb_netdev_ops;