2022-04-15 07:24:44

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH net-next 0/3] net: emaclite: Trivial code cleanup


This patchset fix coding style issues, remove BUFFER_ALIGN
macro and also update copyright text.


I have to resend as earlier series didn't reach mailing list
due to some configuration issue.


Michal Simek (1):
net: emaclite: Update copyright text to correct format

Radhey Shyam Pandey (1):
net: emaclite: Fix coding style

Shravya Kumbham (1):
net: emaclite: Remove custom BUFFER_ALIGN macro

drivers/net/ethernet/xilinx/xilinx_emaclite.c | 55 +++++++++------------------
1 file changed, 18 insertions(+), 37 deletions(-)

--
2.7.4


2022-04-15 16:31:10

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH net-next 3/3] net: emaclite: Remove custom BUFFER_ALIGN macro

From: Shravya Kumbham <[email protected]>

BUFFER_ALIGN macro is used to calculate the number of bytes
required for the next alignment. Instead of this, we can directly
use the skb_reserve(skb, NET_IP_ALIGN) to make the protocol header
buffer aligned on at least a 4-byte boundary, where the NET_IP_ALIGN
is by default defined as 2. So removing the BUFFER_ALIGN and its
related defines which it can be done by the skb_reserve() itself.

Signed-off-by: Shravya Kumbham <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index bb9c3ebde522..7a86ae82fcc1 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -91,10 +91,6 @@
#define XEL_HEADER_IP_LENGTH_OFFSET 16 /* IP Length Offset */

#define TX_TIMEOUT (60 * HZ) /* Tx timeout is 60 seconds. */
-#define ALIGNMENT 4
-
-/* BUFFER_ALIGN(adr) calculates the number of bytes to the next alignment. */
-#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((uintptr_t)adr)) % ALIGNMENT)

#ifdef __BIG_ENDIAN
#define xemaclite_readl ioread32be
@@ -595,11 +591,10 @@ static void xemaclite_rx_handler(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
struct sk_buff *skb;
- unsigned int align;
u32 len;

len = ETH_FRAME_LEN + ETH_FCS_LEN;
- skb = netdev_alloc_skb(dev, len + ALIGNMENT);
+ skb = netdev_alloc_skb(dev, len + NET_IP_ALIGN);
if (!skb) {
/* Couldn't get memory. */
dev->stats.rx_dropped++;
@@ -607,16 +602,7 @@ static void xemaclite_rx_handler(struct net_device *dev)
return;
}

- /* A new skb should have the data halfword aligned, but this code is
- * here just in case that isn't true. Calculate how many
- * bytes we should reserve to get the data to start on a word
- * boundary
- */
- align = BUFFER_ALIGN(skb->data);
- if (align)
- skb_reserve(skb, align);
-
- skb_reserve(skb, 2);
+ skb_reserve(skb, NET_IP_ALIGN);

len = xemaclite_recv_data(lp, (u8 *)skb->data, len);

--
2.7.4

2022-04-16 01:06:34

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next 0/3] net: emaclite: Trivial code cleanup

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <[email protected]>:

On Thu, 14 Apr 2022 18:07:08 +0530 you wrote:
> This patchset fix coding style issues, remove BUFFER_ALIGN
> macro and also update copyright text.
>
>
> I have to resend as earlier series didn't reach mailing list
> due to some configuration issue.
>
> [...]

Here is the summary with links:
- [net-next,1/3] net: emaclite: Fix coding style
https://git.kernel.org/netdev/net-next/c/945e659dffad
- [net-next,2/3] net: emaclite: Update copyright text to correct format
https://git.kernel.org/netdev/net-next/c/7ae7d494f626
- [net-next,3/3] net: emaclite: Remove custom BUFFER_ALIGN macro
https://git.kernel.org/netdev/net-next/c/7240bf6fb216

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


2022-04-16 02:24:43

by Radhey Shyam Pandey

[permalink] [raw]
Subject: [PATCH net-next 2/3] net: emaclite: Update copyright text to correct format

From: Michal Simek <[email protected]>

Based on recommended guidance Copyright term should be also present in
front of (c). That's why aligned driver to match this pattern.
It helps automated tools with source code scanning.

Signed-off-by: Michal Simek <[email protected]>
Signed-off-by: Radhey Shyam Pandey <[email protected]>
---
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 6294b714fbfa..bb9c3ebde522 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -4,7 +4,7 @@
* This is a new flat driver which is based on the original emac_lite
* driver from John Williams <[email protected]>.
*
- * 2007 - 2013 (c) Xilinx, Inc.
+ * Copyright (c) 2007 - 2013 Xilinx, Inc.
*/

#include <linux/module.h>
--
2.7.4