netmap_vale.c (285359) | netmap_vale.c (285698) |
---|---|
1/* 2 * Copyright (C) 2013-2014 Universita` di Pisa. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 43 unchanged lines hidden (view full) --- 52/* 53 * OS-specific code that is used only within this file. 54 * Other OS-specific code that must be accessed by drivers 55 * is present in netmap_kern.h 56 */ 57 58#if defined(__FreeBSD__) 59#include <sys/cdefs.h> /* prerequisite */ | 1/* 2 * Copyright (C) 2013-2014 Universita` di Pisa. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 43 unchanged lines hidden (view full) --- 52/* 53 * OS-specific code that is used only within this file. 54 * Other OS-specific code that must be accessed by drivers 55 * is present in netmap_kern.h 56 */ 57 58#if defined(__FreeBSD__) 59#include <sys/cdefs.h> /* prerequisite */ |
60__FBSDID("$FreeBSD: head/sys/dev/netmap/netmap_vale.c 285359 2015-07-10 16:05:24Z luigi $"); | 60__FBSDID("$FreeBSD: head/sys/dev/netmap/netmap_vale.c 285698 2015-07-19 18:06:30Z luigi $"); |
61 62#include <sys/types.h> 63#include <sys/errno.h> 64#include <sys/param.h> /* defines used in kernel.h */ 65#include <sys/kernel.h> /* types used in module initialization */ 66#include <sys/conf.h> /* cdevsw struct, UID, GID */ 67#include <sys/sockio.h> 68#include <sys/socketvar.h> /* struct socket */ --- 432 unchanged lines hidden (view full) --- 501 502 ND("%s has %d references", na->name, na->na_refcount); 503 504 if (b) { 505 netmap_bdg_detach_common(b, vpna->bdg_port, -1); 506 } 507} 508 | 61 62#include <sys/types.h> 63#include <sys/errno.h> 64#include <sys/param.h> /* defines used in kernel.h */ 65#include <sys/kernel.h> /* types used in module initialization */ 66#include <sys/conf.h> /* cdevsw struct, UID, GID */ 67#include <sys/sockio.h> 68#include <sys/socketvar.h> /* struct socket */ --- 432 unchanged lines hidden (view full) --- 501 502 ND("%s has %d references", na->name, na->na_refcount); 503 504 if (b) { 505 netmap_bdg_detach_common(b, vpna->bdg_port, -1); 506 } 507} 508 |
509/* nm_dtor callback for persistent VALE ports */ 510static void 511netmap_persist_vp_dtor(struct netmap_adapter *na) 512{ 513 struct ifnet *ifp = na->ifp; 514 515 netmap_vp_dtor(na); 516 na->ifp = NULL; 517 nm_vi_detach(ifp); 518} 519 | |
520/* remove a persistent VALE port from the system */ 521static int 522nm_vi_destroy(const char *name) 523{ 524 struct ifnet *ifp; 525 int error; 526 527 ifp = ifunit_ref(name); --- 13 unchanged lines hidden (view full) --- 541 NMG_UNLOCK(); 542 543 D("destroying a persistent vale interface %s", ifp->if_xname); 544 /* Linux requires all the references are released 545 * before unregister 546 */ 547 if_rele(ifp); 548 netmap_detach(ifp); | 509/* remove a persistent VALE port from the system */ 510static int 511nm_vi_destroy(const char *name) 512{ 513 struct ifnet *ifp; 514 int error; 515 516 ifp = ifunit_ref(name); --- 13 unchanged lines hidden (view full) --- 530 NMG_UNLOCK(); 531 532 D("destroying a persistent vale interface %s", ifp->if_xname); 533 /* Linux requires all the references are released 534 * before unregister 535 */ 536 if_rele(ifp); 537 netmap_detach(ifp); |
538 nm_vi_detach(ifp); |
|
549 return 0; 550 551err: 552 NMG_UNLOCK(); 553 if_rele(ifp); 554 return error; 555} 556 --- 25 unchanged lines hidden (view full) --- 582 error = netmap_vp_create(nmr, ifp, &vpna); 583 if (error) { 584 D("error %d", error); 585 nm_vi_detach(ifp); 586 return error; 587 } 588 /* persist-specific routines */ 589 vpna->up.nm_bdg_ctl = netmap_vp_bdg_ctl; | 539 return 0; 540 541err: 542 NMG_UNLOCK(); 543 if_rele(ifp); 544 return error; 545} 546 --- 25 unchanged lines hidden (view full) --- 572 error = netmap_vp_create(nmr, ifp, &vpna); 573 if (error) { 574 D("error %d", error); 575 nm_vi_detach(ifp); 576 return error; 577 } 578 /* persist-specific routines */ 579 vpna->up.nm_bdg_ctl = netmap_vp_bdg_ctl; |
590 vpna->up.nm_dtor = netmap_persist_vp_dtor; | |
591 netmap_adapter_get(&vpna->up); 592 NMG_UNLOCK(); 593 D("created %s", ifp->if_xname); 594 return 0; 595} 596 597/* Try to get a reference to a netmap adapter attached to a VALE switch. 598 * If the adapter is found (or is created), this function returns 0, a --- 1219 unchanged lines hidden (view full) --- 1818 vpna->mfs = 1514; 1819 vpna->last_smac = ~0llu; 1820 /*if (vpna->mfs > netmap_buf_size) TODO netmap_buf_size is zero?? 1821 vpna->mfs = netmap_buf_size; */ 1822 if (netmap_verbose) 1823 D("max frame size %u", vpna->mfs); 1824 1825 na->na_flags |= NAF_BDG_MAYSLEEP; | 580 netmap_adapter_get(&vpna->up); 581 NMG_UNLOCK(); 582 D("created %s", ifp->if_xname); 583 return 0; 584} 585 586/* Try to get a reference to a netmap adapter attached to a VALE switch. 587 * If the adapter is found (or is created), this function returns 0, a --- 1219 unchanged lines hidden (view full) --- 1807 vpna->mfs = 1514; 1808 vpna->last_smac = ~0llu; 1809 /*if (vpna->mfs > netmap_buf_size) TODO netmap_buf_size is zero?? 1810 vpna->mfs = netmap_buf_size; */ 1811 if (netmap_verbose) 1812 D("max frame size %u", vpna->mfs); 1813 1814 na->na_flags |= NAF_BDG_MAYSLEEP; |
1815 /* persistent VALE ports look like hw devices 1816 * with a native netmap adapter 1817 */ 1818 if (ifp) 1819 na->na_flags |= NAF_NATIVE; |
|
1826 na->nm_txsync = netmap_vp_txsync; 1827 na->nm_rxsync = netmap_vp_rxsync; 1828 na->nm_register = netmap_vp_reg; 1829 na->nm_krings_create = netmap_vp_krings_create; 1830 na->nm_krings_delete = netmap_vp_krings_delete; 1831 na->nm_dtor = netmap_vp_dtor; 1832 na->nm_mem = netmap_mem_private_new(na->name, 1833 na->num_tx_rings, na->num_tx_desc, --- 600 unchanged lines hidden --- | 1820 na->nm_txsync = netmap_vp_txsync; 1821 na->nm_rxsync = netmap_vp_rxsync; 1822 na->nm_register = netmap_vp_reg; 1823 na->nm_krings_create = netmap_vp_krings_create; 1824 na->nm_krings_delete = netmap_vp_krings_delete; 1825 na->nm_dtor = netmap_vp_dtor; 1826 na->nm_mem = netmap_mem_private_new(na->name, 1827 na->num_tx_rings, na->num_tx_desc, --- 600 unchanged lines hidden --- |