Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133092612
D5454.id13756.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D5454.id13756.diff
View Options
Index: sys/dev/hyperv/include/hyperv.h
===================================================================
--- sys/dev/hyperv/include/hyperv.h
+++ sys/dev/hyperv/include/hyperv.h
@@ -822,10 +822,12 @@
* This will be NULL for the primary channel.
*/
struct hv_vmbus_channel *primary_channel;
+
/*
- * Support per channel state for use by vmbus drivers.
+ * Driver private data
*/
- void *per_channel_state;
+ void *hv_chan_priv1;
+ void *hv_chan_priv2;
} hv_vmbus_channel;
#define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL)
Index: sys/dev/hyperv/netvsc/hv_net_vsc.h
===================================================================
--- sys/dev/hyperv/netvsc/hv_net_vsc.h
+++ sys/dev/hyperv/netvsc/hv_net_vsc.h
@@ -1000,6 +1000,7 @@
#endif
struct hn_rx_ring {
+ struct ifnet *hn_ifp;
struct lro_ctrl hn_lro;
/* Trust csum verification on host side */
Index: sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
===================================================================
--- sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -117,6 +117,8 @@
#include "hv_rndis.h"
#include "hv_rndis_filter.h"
+#define hv_chan_rxr hv_chan_priv1
+#define hv_chan_txr hv_chan_priv2
/* Short for Hyper-V network interface */
#define NETVSC_DEVNAME "hn"
@@ -376,6 +378,7 @@
netvsc_attach(device_t dev)
{
struct hv_device *device_ctx = vmbus_get_devctx(dev);
+ struct hv_vmbus_channel *chan;
netvsc_device_info device_info;
hn_softc_t *sc;
int unit = device_get_unit(dev);
@@ -427,6 +430,13 @@
hn_create_rx_data(sc);
+ /*
+ * Associate the first TX/RX ring w/ the primary channel.
+ */
+ chan = device_ctx->channel;
+ chan->hv_chan_rxr = &sc->hn_rx_ring[0];
+ chan->hv_chan_txr = &sc->hn_tx_ring[0];
+
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_dunit = unit;
ifp->if_dname = NETVSC_DEVNAME;
@@ -686,11 +696,9 @@
void
netvsc_channel_rollup(struct hv_vmbus_channel *chan)
{
- struct hv_device *device_ctx = chan->device;
- struct hn_softc *sc = device_get_softc(device_ctx->device);
- struct hn_tx_ring *txr = &sc->hn_tx_ring[0]; /* TODO: vRSS */
+ struct hn_tx_ring *txr = chan->hv_chan_txr;
#if defined(INET) || defined(INET6)
- struct hn_rx_ring *rxr = &sc->hn_rx_ring[0]; /* TODO: vRSS */
+ struct hn_rx_ring *rxr = chan->hv_chan_rxr;
struct lro_ctrl *lro = &rxr->hn_lro;
struct lro_entry *queued;
@@ -700,7 +708,12 @@
}
#endif
- if (!txr->hn_has_txeof)
+ /*
+ * NOTE:
+ * 'txr' could be NULL, if multiple channels and
+ * ifnet.if_start method are enabled.
+ */
+ if (txr == NULL || !txr->hn_has_txeof)
return;
txr->hn_has_txeof = 0;
@@ -1139,22 +1152,13 @@
netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet,
rndis_tcp_ip_csum_info *csum_info)
{
- struct hv_device *device_ctx = chan->device;
- struct hn_softc *sc = device_get_softc(device_ctx->device);
- struct hn_rx_ring *rxr = &sc->hn_rx_ring[0]; /* TODO: vRSS */
+ struct hn_rx_ring *rxr = chan->hv_chan_rxr;
+ struct ifnet *ifp = rxr->hn_ifp;
struct mbuf *m_new;
- struct ifnet *ifp;
int size, do_lro = 0, do_csum = 1;
- if (sc == NULL) {
- return (0); /* TODO: KYS how can this be! */
- }
-
- ifp = sc->hn_ifp;
-
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
return (0);
- }
/*
* Bail out if packet contains more data than configured MTU.
@@ -2023,6 +2027,7 @@
rxr->hn_trust_hcsum |= HN_TRUST_HCSUM_UDP;
if (hn_trust_hostip)
rxr->hn_trust_hcsum |= HN_TRUST_HCSUM_IP;
+ rxr->hn_ifp = sc->hn_ifp;
/*
* Initialize LRO.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 23, 10:02 PM (5 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24105007
Default Alt Text
D5454.id13756.diff (3 KB)
Attached To
Mode
D5454: hyperv/hn: Associate TX/RX ring with channel
Attached
Detach File
Event Timeline
Log In to Comment