[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 02/12] lib/uknetdev: Add alignment for allocating packet buffers


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 1 Apr 2019 16:42:42 +0300
  • Cc: felipe.huici@xxxxxxxxx, Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Mon, 01 Apr 2019 13:43:02 +0000
  • Ironport-phdr: 9a23:wL2k+hKwm7j84GICOtmcpTZWNBhigK39O0sv0rFitYgXKvv6rarrMEGX3/hxlliBBdydt6sczbuK+P68EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCehbb9oKBi7ogrdu8gZjIB/Nqs/1xzFr2dSde9L321oP1WTnxj95se04pFu9jlbtuwi+cBdT6j0Zrw0QrNEAjsoNWA1/9DrugLYTQST/HscU34ZnQRODgPY8Rz1RJbxsi/9tupgxCmXOND9QL4oVTi+6apgVRnlgzoFOTEk6mHaksx+grxGrhyvpBJxxIzbYI+OOfZiYq/QZ88WSHBdUspNUSFKH4Oyb5EID+oEJetVsY79p0ASrRu/AwmnGeXhyiJQhn/rwKY31PguEQbd3Aw8HtIOtm7YrNHoNKcKTOC417XHzS7ZY/NOxDfy85LEcgomofyVW797bMnfyVE3Gg/YgVictJbpMjCV2+gXrWSX8ehtWfihhmI/tg18rSWjyt0vh4TJnI4Z1F7J+CtjzIooKtC0Vkh2asO+HpRKrSGVLY52T9snQ2FvpSk11KULuYW+fCgW0JQnwAPfa+Cff4iI/B3jUOGRLC9mhHJgYr2/hhKy/VK8xe3nTMW0yEtKoTFfntnWsXABzx3T6s6ZRfth5kqtxDmC2x3J5uxHIU04j7TXJ4Ajz7IqmJcfqUHDETX3mEXygq+WbEIk+u2w5uv7ZbXmvYOcN45yig3kNqQuh9S/AfkjPwcSRGiX4/y81KD48kHjWrVKieU6krPFv5DCOcQbuqm5DhdQ0oYi7Ra/DjCm0M8BkXYaMl1FZgyIj4zyNlHKIfD4Fuu/g0+2nDZk2f/GOKftApLXLnjMiL3hZ6py61ZAyAovytBS/5JaCrUGIPLpW0/+rtrYAgUkPQOow+bnDdR92Z4CWW+UBK+WLr/dsVuS6e00OeWDepIVsi7nK/c5//7ukWM5mVgFcKmnw5QXbHG4Hux4LEmDYXrsn9YBHnsLvgclSuzllkGNUTpJaHmpRa4z+Cw7Apq8DYjfXoCtnKCB3CCjE51NZmBJEEqMHm3ud4meQPcDciSSItNhkjMeU7iuUYoh2AqotADk17VnKvDb9TYCuZ39ydh///fTmg0q9TxoE8Sd1HmAT3p1nmMNQD822rpzoU9gylid16h5guJXFcZI6vNPTAg1KZrcwPZhBNzoRA3BY8+DSEy6TdW+HTExUtUxzscOYkZgAdWijwrP3zStA78Ri7OLBJ808qXC33XqIcZy1WrJ1K07gFY9WMdAK3Cm1eZD8F3WBojIlF7cm6u0eKA02C/W6HzF3WeI+kZCX11eS6LACFsYfVfXq5zd+1vfB+ulDq87Mw0HzdOaN4NBcZvxkF8AXvC1a4eWWH64h2rlXUXA/biLdoe/I2g=
  • Ironport-sdr: NjGaprisXrmYS/j/GlZIrdfSG2OBph7E6uB93IUL6xNZexdt9i8UP9RdMrykZfMB3Cd62nWQJx 7IFfAIDOklHg==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

On Xen, packet buffers have to be page aligned because they are saved in
page aligned memory regions which are shared between backend and
frontend by using grants.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/uknetdev/include/uk/netdev_core.h | 1 +
 plat/drivers/virtio/virtio_net.c      | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/lib/uknetdev/include/uk/netdev_core.h 
b/lib/uknetdev/include/uk/netdev_core.h
index f073e101..268d54d7 100644
--- a/lib/uknetdev/include/uk/netdev_core.h
+++ b/lib/uknetdev/include/uk/netdev_core.h
@@ -94,6 +94,7 @@ struct uk_netdev_info {
        uint16_t max_mtu;   /**< Maximum supported MTU size. */
        uint16_t nb_encap_tx;  /**< Number of bytes required as headroom for 
tx. */
        uint16_t nb_encap_rx;  /**< Number of bytes required as headroom for 
rx. */
+       uint16_t align;  /**< Alignment required for data address. */
 };
 
 /**
diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index efc2cb71..9f1873c5 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct uk_netdev *dev,
 
        dev_info->max_rx_queues = vndev->max_vqueue_pairs;
        dev_info->max_tx_queues = vndev->max_vqueue_pairs;
+       dev_info->max_mtu = vndev->max_mtu;
        dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
        dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
+       dev_info->align = sizeof(void *); /* word size alignment */
 }
 
 static int virtio_net_start(struct uk_netdev *n)
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.