[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Minios-devel] [UNIKRAFT/LWIP PATCH 2/3] uknetdev: Extend private interface state
- To: minios-devel@xxxxxxxxxxxxx
- From: Costin Lupu <costin.lupu@xxxxxxxxx>
- Date: Mon, 1 Apr 2019 16:41:30 +0300
- Cc: felipe.huici@xxxxxxxxx, Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
- Delivery-date: Mon, 01 Apr 2019 13:41:46 +0000
- Ironport-phdr: 9a23:NmHE8hGEu9BoNkobLq9Hdp1GYnF86YWxBRYc798ds5kLTJ76p8u7bnLW6fgltlLVR4KTs6sC17OO9fG8EjJcqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5uIBmsqQjcucYajIptJ60s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlSEKPCM7/m7KkMx9lKJVrgy8qRJxwIDaZ4OaNPRlc6/BYd8XX3ZNU9xNWyBdBI63cosBD/AGPeZdt4TwuVwOrQCiBQmtAuPk1zlGhmLu3a0nzu8sFh3J3As7H9ISsXTUqs/5NKMPUeCt0anF1inMb+hM1Tfl9YjHaQotoeuLXb9pd8fa1EohFxvdg1mNpoHpIimZ2+cNvmSB8eZsS+Cih3Qppg1pvzSiydoghpPKi48V0FzI6yt0zYgvKdGlR0N3f9ipG4ZKuS6ALYt5WMYiTnltuCY917IJp4a2fDMPyJQ73x7fbOGHc5SQ7hLjSumRJTB4iWp7eLK6nRmy8EygxvfgWcmvylpKtjdFncLWunAX0Bzf8smHSv1j8Ue9wTuDyg/e5vxeLU03lafXMYAtzqAym5YJv0nPBir2l1/3jK+SeEUk4O+o6+H/b7r6oZ+cLJN0igD4Mqg0nsy/HPw4MhUVUmeH4uSwzqXj/VDiT7lQlP02lbHVsIrGKsQDuq65HwhV354m6xa+CTem0dMYnWIeIF1YZh2HkZbmO1XVLfD8DPe/mEiskCxxy/HJILLhBI/BLn/ZkLfuZbx98VJTyBIvzdBD4JJZErEPIPb0Wk/rtdzXFBk5Pxapzen7CNV904IeVn+TAqKCNqPdr0OH5uY1LOaXfoMapiv9IeA/5/HylX85hUMdfa6x0JsZdn+4GvVmI12Hbnb2gtcBDGYKsRY/TOHxjl2NTyJcZ3KoUK0n/D00Fp+mB5/ZRo+xmLyBwDu7HppOa2BdClCDC23oeJ+CW/sWcyKdOMlhkiAEVbe7TY8uzxSuuRT8y7V5MuXU/jcXuon52Ndr+u3ZjQsy+iBsD8SBz2GNSHl5nngJRz8z26B/p1ZxylSe0admhfxZFMJc5+lSXwc8K5HT0+h6BMrpVQ7bYNiJVU6sQs+6DjEpUtIx39gObl59GtW/lBDD3jCmA6ESl7yPGJM08qHc33/vJ8tmzXbJyrUuj108TcRUL2GpmLN/pEDvANvMkkOYkL3veakC0Srl8GaY0XHIrExeFglqXvbrR3caM2DRtsj44AvmUqezQeAsNRBdyMjELrZSd/XilhNeWf2lItOIMDH5oHu5GRvdnuDEV4HtYWhIhCg=
- Ironport-sdr: c/bAh3E0D4zKK8u87W8EmguGbnRzXjagcaxYvYk7xsIrreaD5wN5AX0bINnHQ15UfcHZfypdMo vAs3dsCtRqDw==
- List-id: Mini-os development list <minios-devel.lists.xenproject.org>
We introduce an encapsulating structure for keeping private information
of network interfaces which is intended for internal use.
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
uknetdev.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/uknetdev.c b/uknetdev.c
index 47d2fb1..8078ee1 100644
--- a/uknetdev.c
+++ b/uknetdev.c
@@ -74,8 +74,12 @@
static uint16_t rx_headroom = ETH_PAD_SIZE;
static uint16_t tx_headroom = ETH_PAD_SIZE;
+struct uk_netif_state {
+ struct uk_netdev *netdev;
+};
+
#define netif_to_uknetdev(nf) \
- ((struct uk_netdev *) (nf)->state)
+ (((struct uk_netif_state *) (nf)->state)->netdev)
static uint16_t netif_alloc_rxpkts(void *argp, struct uk_netbuf *nb[],
uint16_t count)
@@ -597,16 +601,20 @@ struct netif *uknetdev_addif(struct uk_netdev *n
static const void *pethernet_input = NETIF_INPUT;
struct netif *nf;
struct netif *ret;
+ struct uk_netif_state *state;
- nf = mem_calloc(1, sizeof(*nf));
+ nf = mem_calloc(1, sizeof(*nf) + sizeof(*state));
if (!nf)
return NULL;
+ state = (struct uk_netif_state *) (nf + 1);
+ state->netdev = n;
+
ret = netif_add(nf,
#if LWIP_IPV4
ipaddr, netmask, gw,
#endif /* LWIP_IPV4 */
- n, uknetdev_init, UK_READ_ONCE(pethernet_input));
+ state, uknetdev_init, UK_READ_ONCE(pethernet_input));
UK_ASSERT(nf->input);
if (!ret) {
--
2.11.0
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|