diff mbox series

[v7,1/9] hw/net/net_tx_pkt: Introduce net_tx_pkt_get_eth_hdr

Message ID 20230201042615.34706-2-akihiko.odaki@daynix.com (mailing list archive)
State New, archived
Headers show
Series Introduce igb | expand

Commit Message

Akihiko Odaki Feb. 1, 2023, 4:26 a.m. UTC
Expose the ethernet header so that igb can utilize it to perform the
internal routing among its SR-IOV functions.

Signed-off-by: Gal Hammer <gal.hammer@sap.com>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 hw/net/net_tx_pkt.c | 6 ++++++
 hw/net/net_tx_pkt.h | 8 ++++++++
 2 files changed, 14 insertions(+)

Comments

Cédric Le Goater Feb. 3, 2023, 10:28 a.m. UTC | #1
On 2/1/23 05:26, Akihiko Odaki wrote:
> Expose the ethernet header so that igb can utilize it to perform the
> internal routing among its SR-IOV functions.
> 
> Signed-off-by: Gal Hammer <gal.hammer@sap.com>
> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

I don't see where it is used ? Am I missing something ?

Thanks,

C.


> ---
>   hw/net/net_tx_pkt.c | 6 ++++++
>   hw/net/net_tx_pkt.h | 8 ++++++++
>   2 files changed, 14 insertions(+)
> 
> diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
> index 986a3adfe9..be5b65f0e9 100644
> --- a/hw/net/net_tx_pkt.c
> +++ b/hw/net/net_tx_pkt.c
> @@ -273,6 +273,12 @@ bool net_tx_pkt_parse(struct NetTxPkt *pkt)
>       }
>   }
>   
> +struct eth_header *net_tx_pkt_get_eth_hdr(struct NetTxPkt *pkt)
> +{
> +    assert(pkt);
> +    return (struct eth_header *)&pkt->l2_hdr;
> +}
> +
>   struct virtio_net_hdr *net_tx_pkt_get_vhdr(struct NetTxPkt *pkt)
>   {
>       assert(pkt);
> diff --git a/hw/net/net_tx_pkt.h b/hw/net/net_tx_pkt.h
> index f57b4e034b..2e51b73b6c 100644
> --- a/hw/net/net_tx_pkt.h
> +++ b/hw/net/net_tx_pkt.h
> @@ -45,6 +45,14 @@ void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev,
>    */
>   void net_tx_pkt_uninit(struct NetTxPkt *pkt);
>   
> +/**
> + * get ethernet header
> + *
> + * @pkt:            packet
> + * @ret:            ethernet header
> + */
> +struct eth_header *net_tx_pkt_get_eth_hdr(struct NetTxPkt *pkt);
> +
>   /**
>    * get virtio header
>    *
diff mbox series

Patch

diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
index 986a3adfe9..be5b65f0e9 100644
--- a/hw/net/net_tx_pkt.c
+++ b/hw/net/net_tx_pkt.c
@@ -273,6 +273,12 @@  bool net_tx_pkt_parse(struct NetTxPkt *pkt)
     }
 }
 
+struct eth_header *net_tx_pkt_get_eth_hdr(struct NetTxPkt *pkt)
+{
+    assert(pkt);
+    return (struct eth_header *)&pkt->l2_hdr;
+}
+
 struct virtio_net_hdr *net_tx_pkt_get_vhdr(struct NetTxPkt *pkt)
 {
     assert(pkt);
diff --git a/hw/net/net_tx_pkt.h b/hw/net/net_tx_pkt.h
index f57b4e034b..2e51b73b6c 100644
--- a/hw/net/net_tx_pkt.h
+++ b/hw/net/net_tx_pkt.h
@@ -45,6 +45,14 @@  void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev,
  */
 void net_tx_pkt_uninit(struct NetTxPkt *pkt);
 
+/**
+ * get ethernet header
+ *
+ * @pkt:            packet
+ * @ret:            ethernet header
+ */
+struct eth_header *net_tx_pkt_get_eth_hdr(struct NetTxPkt *pkt);
+
 /**
  * get virtio header
  *