diff mbox series

[v3] mvneta driver disallow XDP program on hardware buffer management

Message ID 20200124072338.75163-1-sven.auhagen@voleatech.de
State Superseded
Delegated to: David Miller
Headers show
Series [v3] mvneta driver disallow XDP program on hardware buffer management | expand

Commit Message

Sven Auhagen Jan. 24, 2020, 7:23 a.m. UTC
Recently XDP Support was added to the mvneta driver
for software buffer management only.
It is still possible to attach an XDP program if
hardware buffer management is used.
It is not doing anything at that point.

The patch disallows attaching XDP programs to mvneta
if hardware buffer management is used.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>

Comments

Lorenzo Bianconi Jan. 24, 2020, 8:13 a.m. UTC | #1
>
> Recently XDP Support was added to the mvneta driver
> for software buffer management only.
> It is still possible to attach an XDP program if
> hardware buffer management is used.
> It is not doing anything at that point.
>
> The patch disallows attaching XDP programs to mvneta
> if hardware buffer management is used.
>
> Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 71a872d46bc4..a2e9ba9b918f 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -2158,7 +2158,7 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp,
>  prefetch(data);
>
>  xdp->data_hard_start = data;
> -xdp->data = data + pp->rx_offset_correction + MVNETA_MH_SIZE;
> +xdp->data = data + pp->rx_offset_correction;

Hi Sven,

I think this is going to break XDP support for marvell espressobin (sw
buffer management).
I guess we need to identify when MH header is inserted.

Regards,
Lorenzo

>  xdp->data_end = xdp->data + data_len;
>  xdp_set_data_meta_invalid(xdp);
>
> @@ -4960,9 +4960,10 @@ static int mvneta_probe(struct platform_device *pdev)
>   * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit
>   * platforms and 0B for 32-bit ones.
>   */
> -pp->rx_offset_correction = max(0,
> -       NET_SKB_PAD -
> -       MVNETA_RX_PKT_OFFSET_CORRECTION);
> +if (pp->bm_priv)
> +pp->rx_offset_correction = max(0,
> +       NET_SKB_PAD -
> +       MVNETA_RX_PKT_OFFSET_CORRECTION);
>  }
>  of_node_put(bm_node);
>
>
> +++ Voleatech auf der E-World, 11. bis 13. Februar 2020, Halle 5, Stand 521 +++
>
> Beste Grüße/Best regards
>
> Sven Auhagen
> Dipl. Math. oec., M.Sc.
> Voleatech GmbH
> HRB: B 754643
> USTID: DE303643180
> Grathwohlstr. 5
> 72762 Reutlingen
> Tel: +49 7121539550
> Fax: +49 7121539551
> E-Mail: sven.auhagen@voleatech.de
> www.voleatech.de<https://www.voleatech.de>
> Diese Information ist ausschließlich für den Adressaten bestimmt und kann vertraulich oder gesetzlich geschützte Informationen enthalten. Wenn Sie nicht der bestimmungsgemäße Adressat sind, unterrichten Sie bitte den Absender und vernichten Sie diese Mail. Anderen als dem bestimmungsgemäßen Adressaten ist es untersagt, diese E-Mail zu lesen, zu speichern, weiterzuleiten oder ihren Inhalt auf welche Weise auch immer zu verwenden. Für den Adressaten sind die Informationen in dieser Mail nur zum persönlichen Gebrauch. Eine Weiterleitung darf nur nach Rücksprache mit dem Absender erfolgen. Wir verwenden aktuelle Virenschutzprogramme. Für Schäden, die dem Empfänger gleichwohl durch von uns zugesandte mit Viren befallene E-Mails entstehen, schließen wir jede Haftung aus.
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 71a872d46bc4..a2e9ba9b918f 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2158,7 +2158,7 @@  mvneta_swbm_rx_frame(struct mvneta_port *pp,
 	prefetch(data);
 
 	xdp->data_hard_start = data;
-	xdp->data = data + pp->rx_offset_correction + MVNETA_MH_SIZE;
+	xdp->data = data + pp->rx_offset_correction;
 	xdp->data_end = xdp->data + data_len;
 	xdp_set_data_meta_invalid(xdp);
 
@@ -4960,9 +4960,10 @@  static int mvneta_probe(struct platform_device *pdev)
 		 * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit
 		 * platforms and 0B for 32-bit ones.
 		 */
-		pp->rx_offset_correction = max(0,
-					       NET_SKB_PAD -
-					       MVNETA_RX_PKT_OFFSET_CORRECTION);
+		if (pp->bm_priv)
+			pp->rx_offset_correction = max(0,
+						       NET_SKB_PAD -
+						       MVNETA_RX_PKT_OFFSET_CORRECTION);
 	}
 	of_node_put(bm_node);