* [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue
@ 2015-03-10 10:30 Fugang Duan
2015-03-10 11:04 ` Michael Grzeschik
2015-03-10 16:40 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Fugang Duan @ 2015-03-10 10:30 UTC (permalink / raw)
To: m.grzeschik, davem; +Cc: netdev, kernel, b38611
The current driver support receive VLAN CTAG HW acceleration feature
(NETIF_F_HW_VLAN_CTAG_RX) through software simulation. There calls the
api .skb_copy_to_linear_data_offset() to skip the VLAN tag, but there
have overlap between the two memory data point range. The patch just fix
the issue.
Reported-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Fugang Duan <B38611@freescale.com>
---
drivers/net/ethernet/freescale/fec_main.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 9bb6220..c9b1dbb 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1475,12 +1475,14 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
/* Push and remove the vlan tag */
struct vlan_hdr *vlan_header =
(struct vlan_hdr *) (data + ETH_HLEN);
+ unsigned char eth_hdr[12];
vlan_tag = ntohs(vlan_header->h_vlan_TCI);
vlan_packet_rcvd = true;
+ memcpy(eth_hdr, data, 2 * ETH_ALEN);
skb_copy_to_linear_data_offset(skb, VLAN_HLEN,
- data, (2 * ETH_ALEN));
+ eth_hdr, (2 * ETH_ALEN));
skb_pull(skb, VLAN_HLEN);
}
--
1.7.8
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue
2015-03-10 10:30 [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue Fugang Duan
@ 2015-03-10 11:04 ` Michael Grzeschik
2015-03-10 11:13 ` fugang.duan
2015-03-10 16:40 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Michael Grzeschik @ 2015-03-10 11:04 UTC (permalink / raw)
To: Fugang Duan; +Cc: davem, netdev, kernel
On Tue, Mar 10, 2015 at 06:30:42PM +0800, Fugang Duan wrote:
> The current driver support receive VLAN CTAG HW acceleration feature
> (NETIF_F_HW_VLAN_CTAG_RX) through software simulation. There calls the
> api .skb_copy_to_linear_data_offset() to skip the VLAN tag, but there
> have overlap between the two memory data point range. The patch just fix
> the issue.
>
> Reported-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 9bb6220..c9b1dbb 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1475,12 +1475,14 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
> /* Push and remove the vlan tag */
> struct vlan_hdr *vlan_header =
> (struct vlan_hdr *) (data + ETH_HLEN);
> + unsigned char eth_hdr[12];
> vlan_tag = ntohs(vlan_header->h_vlan_TCI);
>
> vlan_packet_rcvd = true;
>
> + memcpy(eth_hdr, data, 2 * ETH_ALEN);
> skb_copy_to_linear_data_offset(skb, VLAN_HLEN,
> - data, (2 * ETH_ALEN));
> + eth_hdr, (2 * ETH_ALEN));
> skb_pull(skb, VLAN_HLEN);
> }
>
> --
> 1.7.8
why not just use memmove instead of the skb_copy_to_linear_data_offset?
memmove(skb->data + VLAN_HLEN, data, (2 * ETH_ALEN));
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue
2015-03-10 11:04 ` Michael Grzeschik
@ 2015-03-10 11:13 ` fugang.duan
0 siblings, 0 replies; 4+ messages in thread
From: fugang.duan @ 2015-03-10 11:13 UTC (permalink / raw)
To: Michael Grzeschik
Cc: davem@davemloft.net, netdev@vger.kernel.org,
kernel@pengutronix.de
From: Michael Grzeschik <mgr@pengutronix.de> Sent: Tuesday, March 10, 2015 7:05 PM
> To: Duan Fugang-B38611
> Cc: davem@davemloft.net; netdev@vger.kernel.org; kernel@pengutronix.de
> Subject: Re: [PATCH] net: fec: fix receive VLAN CTAG HW acceleration
> issue
>
> On Tue, Mar 10, 2015 at 06:30:42PM +0800, Fugang Duan wrote:
> > The current driver support receive VLAN CTAG HW acceleration feature
> > (NETIF_F_HW_VLAN_CTAG_RX) through software simulation. There calls the
> > api .skb_copy_to_linear_data_offset() to skip the VLAN tag, but there
> > have overlap between the two memory data point range. The patch just
> > fix the issue.
> >
> > Reported-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
> > ---
> > drivers/net/ethernet/freescale/fec_main.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 9bb6220..c9b1dbb 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -1475,12 +1475,14 @@ fec_enet_rx_queue(struct net_device *ndev, int
> budget, u16 queue_id)
> > /* Push and remove the vlan tag */
> > struct vlan_hdr *vlan_header =
> > (struct vlan_hdr *) (data + ETH_HLEN);
> > + unsigned char eth_hdr[12];
> > vlan_tag = ntohs(vlan_header->h_vlan_TCI);
> >
> > vlan_packet_rcvd = true;
> >
> > + memcpy(eth_hdr, data, 2 * ETH_ALEN);
> > skb_copy_to_linear_data_offset(skb, VLAN_HLEN,
> > - data, (2 * ETH_ALEN));
> > + eth_hdr, (2 * ETH_ALEN));
> > skb_pull(skb, VLAN_HLEN);
> > }
> >
> > --
> > 1.7.8
>
> why not just use memmove instead of the skb_copy_to_linear_data_offset?
>
> memmove(skb->data + VLAN_HLEN, data, (2 * ETH_ALEN));
>
> Michael
Good suggestion. Thanks.
Regards,
Andy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue
2015-03-10 10:30 [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue Fugang Duan
2015-03-10 11:04 ` Michael Grzeschik
@ 2015-03-10 16:40 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-10 16:40 UTC (permalink / raw)
To: b38611; +Cc: m.grzeschik, netdev, kernel
From: Fugang Duan <b38611@freescale.com>
Date: Tue, 10 Mar 2015 18:30:42 +0800
> The current driver support receive VLAN CTAG HW acceleration feature
> (NETIF_F_HW_VLAN_CTAG_RX) through software simulation. There calls the
> api .skb_copy_to_linear_data_offset() to skip the VLAN tag, but there
> have overlap between the two memory data point range. The patch just fix
> the issue.
>
> Reported-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
How about simply using.... memmove()?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-10 16:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 10:30 [PATCH] net: fec: fix receive VLAN CTAG HW acceleration issue Fugang Duan
2015-03-10 11:04 ` Michael Grzeschik
2015-03-10 11:13 ` fugang.duan
2015-03-10 16:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox