Commit e83163b6 authored by Horatiu Vultur's avatar Horatiu Vultur Committed by David S. Miller

net: lan966x: Add define IFH_LEN_BYTES

The total length of IFH(inter frame header) in bytes is calculated as
IFH_LEN * sizeof(u32). Because IFH_LEN describes the length in words
and not in bytes. As the length of IFH in bytes is used quite often,
add a define for this. This is just to simplify the things.
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 42ba9654
...@@ -436,7 +436,7 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx) ...@@ -436,7 +436,7 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx)
DMA_ATTR_SKIP_CPU_SYNC); DMA_ATTR_SKIP_CPU_SYNC);
skb->dev = lan966x->ports[src_port]->dev; skb->dev = lan966x->ports[src_port]->dev;
skb_pull(skb, IFH_LEN * sizeof(u32)); skb_pull(skb, IFH_LEN_BYTES);
if (likely(!(skb->dev->features & NETIF_F_RXFCS))) if (likely(!(skb->dev->features & NETIF_F_RXFCS)))
skb_trim(skb, skb->len - ETH_FCS_LEN); skb_trim(skb, skb->len - ETH_FCS_LEN);
...@@ -592,7 +592,7 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev) ...@@ -592,7 +592,7 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev)
} }
/* skb processing */ /* skb processing */
needed_headroom = max_t(int, IFH_LEN * sizeof(u32) - skb_headroom(skb), 0); needed_headroom = max_t(int, IFH_LEN_BYTES - skb_headroom(skb), 0);
needed_tailroom = max_t(int, ETH_FCS_LEN - skb_tailroom(skb), 0); needed_tailroom = max_t(int, ETH_FCS_LEN - skb_tailroom(skb), 0);
if (needed_headroom || needed_tailroom || skb_header_cloned(skb)) { if (needed_headroom || needed_tailroom || skb_header_cloned(skb)) {
err = pskb_expand_head(skb, needed_headroom, needed_tailroom, err = pskb_expand_head(skb, needed_headroom, needed_tailroom,
...@@ -605,8 +605,8 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev) ...@@ -605,8 +605,8 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev)
} }
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
skb_push(skb, IFH_LEN * sizeof(u32)); skb_push(skb, IFH_LEN_BYTES);
memcpy(skb->data, ifh, IFH_LEN * sizeof(u32)); memcpy(skb->data, ifh, IFH_LEN_BYTES);
skb_put(skb, 4); skb_put(skb, 4);
dma_addr = dma_map_single(lan966x->dev, skb->data, skb->len, dma_addr = dma_map_single(lan966x->dev, skb->data, skb->len,
...@@ -740,7 +740,7 @@ int lan966x_fdma_change_mtu(struct lan966x *lan966x) ...@@ -740,7 +740,7 @@ int lan966x_fdma_change_mtu(struct lan966x *lan966x)
u32 val; u32 val;
max_mtu = lan966x_fdma_get_max_mtu(lan966x); max_mtu = lan966x_fdma_get_max_mtu(lan966x);
max_mtu += IFH_LEN * sizeof(u32); max_mtu += IFH_LEN_BYTES;
max_mtu += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); max_mtu += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
max_mtu += VLAN_HLEN * 2; max_mtu += VLAN_HLEN * 2;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#define IFH_LEN 7 #define IFH_LEN 7
#define IFH_LEN_BYTES (IFH_LEN * sizeof(u32))
/* Timestamp for frame */ /* Timestamp for frame */
#define IFH_POS_TIMESTAMP 192 #define IFH_POS_TIMESTAMP 192
......
...@@ -760,7 +760,7 @@ static int lan966x_probe_port(struct lan966x *lan966x, u32 p, ...@@ -760,7 +760,7 @@ static int lan966x_probe_port(struct lan966x *lan966x, u32 p,
NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_TX |
NETIF_F_HW_TC; NETIF_F_HW_TC;
dev->hw_features |= NETIF_F_HW_TC; dev->hw_features |= NETIF_F_HW_TC;
dev->needed_headroom = IFH_LEN * sizeof(u32); dev->needed_headroom = IFH_LEN_BYTES;
eth_hw_addr_gen(dev, lan966x->base_mac, p + 1); eth_hw_addr_gen(dev, lan966x->base_mac, p + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment