PERFORCE change 195608 for review
Takuya ASADA
syuu at FreeBSD.org
Sat Jul 2 00:36:01 UTC 2011
http://p4web.freebsd.org/@@195608?ac=10
Change 195608 by syuu at x200 on 2011/07/02 00:35:38
queue len, queue affinity ioctls moved from bpf to NIC device, pt.2(some features still not working for now)
queue len, queue affinity info show up on ifconfig.
remove mq support on em.
Affected files ...
.. //depot/projects/soc2011/mq_bpf/src/sbin/ifconfig/ifconfig.c#2 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/amd64/conf/RSS#2 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/dev/e1000/if_em.c#4 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/dev/e1000/if_igb.c#8 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/kern/sys_socket.c#2 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/bpf.c#11 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/if.c#2 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/if.h#4 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/if_ethersubr.c#4 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/if_var.h#6 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/netisr.c#3 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/netinet/in_rss.c#2 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/sys/priv.h#3 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/sys/sockio.h#3 edit
Differences ...
==== //depot/projects/soc2011/mq_bpf/src/sbin/ifconfig/ifconfig.c#2 (text+ko) ====
@@ -885,7 +885,7 @@
#define IFCAPBITS \
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
-"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE"
+"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25MULTIQUEUE\26SOFT_MULTIQUEUE"
/*
* Print the status of the interface. If an address family was
@@ -952,6 +952,35 @@
}
}
+ if ((ifr.ifr_reqcap & IFCAP_MULTIQUEUE) |
+ (ifr.ifr_reqcap & IFCAP_SOFT_MULTIQUEUE)) {
+ int i, rxqlen = 0, txqlen = 0;
+
+ if (ioctl(s, SIOCGIFQLEN, &ifr) == 0) {
+ rxqlen = ifr.ifr_rxqueue_len;
+ txqlen = ifr.ifr_txqueue_len;
+ }else
+ perror("ioctl");
+
+ printf("\trxqueue len:%d affinity:", rxqlen);
+ for (i = 0; i < rxqlen; i++) {
+ ifr.ifr_queue_affinity_idx = i;
+ if (ioctl(s, SIOCGIFRXQAFFINITY, &ifr) == 0)
+ printf(" %d:%d", ifr.ifr_queue_affinity_idx,
+ ifr.ifr_queue_affinity_cpu);
+ }
+ putchar('\n');
+
+ printf("\ttxqueue len:%d affinity:", txqlen);
+ for (i = 0; i < txqlen; i++) {
+ ifr.ifr_queue_affinity_idx = i;
+ if (ioctl(s, SIOCGIFTXQAFFINITY, &ifr) == 0)
+ printf(" %d:%d", ifr.ifr_queue_affinity_idx,
+ ifr.ifr_queue_affinity_cpu);
+ }
+ putchar('\n');
+ }
+
tunnel_status(s);
for (ift = ifa; ift != NULL; ift = ift->ifa_next) {
==== //depot/projects/soc2011/mq_bpf/src/sys/amd64/conf/RSS#2 (text+ko) ====
@@ -1,4 +1,9 @@
-include GENERIC
+include VESA
ident RSS
options RSS
+options KDTRACE_HOOKS
+options DDB_CTF
+options KDTRACE_FRAME
+
+makeoptions WITH_CTF=1
==== //depot/projects/soc2011/mq_bpf/src/sys/dev/e1000/if_em.c#4 (text+ko) ====
@@ -436,7 +436,7 @@
{
struct adapter *adapter;
struct e1000_hw *hw;
- int error = 0, i;
+ int error = 0;
INIT_DEBUGOUT("em_attach: begin");
@@ -685,18 +685,7 @@
adapter->led_dev = led_create(em_led_func, adapter,
device_get_nameunit(dev));
- adapter->ifp->if_rxq_num = adapter->num_queues;
- adapter->ifp->if_txq_num = adapter->num_queues;
- adapter->ifp->if_rxq_affinity =
- (u_long *)malloc(sizeof(u_long) * adapter->num_queues,
- M_DEVBUF, M_NOWAIT);
- adapter->ifp->if_txq_affinity =
- (u_long *)malloc(sizeof(u_long) * adapter->num_queues,
- M_DEVBUF, M_NOWAIT);
- for (i = 0; i < adapter->num_queues; i++) {
- adapter->ifp->if_rxq_affinity[i] = i;
- adapter->ifp->if_rxq_affinity[i] = i;
- }
+
INIT_DEBUGOUT("em_attach: end");
return (0);
@@ -876,9 +865,6 @@
enq++;
drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
- next->m_pkthdr.rxqid = (uint32_t)-1;
- next->m_pkthdr.txqid = txr->me;
-
ETHER_BPF_MTAP(ifp, next);
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
break;
@@ -4304,8 +4290,6 @@
sendmp->m_pkthdr.flowid = rxr->msix;
sendmp->m_flags |= M_FLOWID;
#endif
- sendmp->m_pkthdr.rxqid = rxr->msix;
- sendmp->m_pkthdr.txqid = (uint32_t)-1;
#ifndef __NO_STRICT_ALIGNMENT
skip:
#endif
==== //depot/projects/soc2011/mq_bpf/src/sys/dev/e1000/if_igb.c#8 (text+ko) ====
@@ -37,7 +37,6 @@
#include "opt_device_polling.h"
#include "opt_inet.h"
#include "opt_altq.h"
-#include "opt_kdtrace.h"
#endif
#include <sys/param.h>
@@ -56,7 +55,6 @@
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
-#include <sys/sdt.h>
#include <sys/taskqueue.h>
#include <sys/eventhandler.h>
#include <sys/pcpu.h>
@@ -94,13 +92,6 @@
#include "e1000_82575.h"
#include "if_igb.h"
-SDT_PROVIDER_DECLARE(igb);
-SDT_PROVIDER_DEFINE(igb);
-SDT_PROBE_DEFINE1(igb, functions, igb_ioctl_rxqlen, entry, entry, "int");
-SDT_PROBE_DEFINE1(igb, functions, igb_ioctl_txqlen, entry, entry, "int");
-SDT_PROBE_DEFINE2(igb, functions, igb_ioctl_rxqaffinity, entry, entry, "int", "int");
-SDT_PROBE_DEFINE2(igb, functions, igb_ioctl_txqaffinity, entry, entry, "int", "int");
-
/*********************************************************************
* Set this to one to display debug statistics
*********************************************************************/
@@ -274,6 +265,11 @@
const char *, int *, int);
static int igb_set_flowcntl(SYSCTL_HANDLER_ARGS);
+static int igb_get_rxqueue_len(struct ifnet *);
+static int igb_get_txqueue_len(struct ifnet *);
+static int igb_get_rxqueue_affinity(struct ifnet *, int);
+static int igb_get_txqueue_affinity(struct ifnet *, int);
+
#ifdef DEVICE_POLLING
static poll_handler_t igb_poll;
#endif /* POLLING */
@@ -436,7 +432,7 @@
igb_attach(device_t dev)
{
struct adapter *adapter;
- int error = 0, i;
+ int error = 0;
u16 eeprom_data;
INIT_DEBUGOUT("igb_attach: begin");
@@ -660,19 +656,6 @@
adapter->led_dev = led_create(igb_led_func, adapter,
device_get_nameunit(dev));
-
- adapter->ifp->if_rxq_num = adapter->num_queues;
- adapter->ifp->if_txq_num = adapter->num_queues;
- adapter->ifp->if_rxq_affinity =
- (u_long *)malloc(sizeof(u_long) * adapter->ifp->if_rxq_num,
- M_DEVBUF, M_NOWAIT);
- adapter->ifp->if_txq_affinity =
- (u_long *)malloc(sizeof(u_long) * adapter->ifp->if_txq_num,
- M_DEVBUF, M_NOWAIT);
- for (i = 0; i < adapter->ifp->if_rxq_num; i++)
- adapter->ifp->if_rxq_affinity[i] = i;
- for (i = 0; i < adapter->ifp->if_txq_num; i++)
- adapter->ifp->if_txq_affinity[i] = i;
INIT_DEBUGOUT("igb_attach: end");
return (0);
@@ -1182,60 +1165,6 @@
break;
}
- case SIOCGIFRXQLEN:
- *(int *)data = ifp->if_rxq_num;
- SDT_PROBE1(igb, functions, igb_ioctl_rxqlen, entry, ifp->if_rxq_num);
- break;
-
- case SIOCGIFTXQLEN:
- *(int *)data = ifp->if_txq_num;
- SDT_PROBE1(igb, functions, igb_ioctl_txqlen, entry, ifp->if_txq_num);
- break;
-
- case SIOCGIFRXQAFFINITY:
- {
- u_long index;
-
- index = *(u_long *)data;
- if (index > ifp->if_rxq_num) {
- log(LOG_ERR, "SIOCGIFRXQAFFINITY: index too large index:%lx rxq_num:%d\n", index, ifp->if_rxq_num);
- error = EINVAL;
- SDT_PROBE2(igb, functions, igb_ioctl_rxqaffinity, entry, -1, -1);
- break;
- }
- if (!ifp->if_rxq_affinity) {
- log(LOG_ERR, "!ifp->if_rxq_affinity\n");
- error = EINVAL;
- SDT_PROBE2(igb, functions, igb_ioctl_rxqaffinity, entry, -1, -1);
- break;
- }
- *(u_long *)data = ifp->if_rxq_affinity[index];
- SDT_PROBE2(igb, functions, igb_ioctl_rxqaffinity, entry, index, ifp->if_rxq_affinity[index]);
- break;
- }
-
- case SIOCGIFTXQAFFINITY:
- {
- u_long index;
-
- index = *(u_long *)data;
- if (index > ifp->if_txq_num) {
- log(LOG_ERR, "SIOCGIFTXQAFFINITY: index too large index:%lx txq_num:%x\n", index, ifp->if_txq_num);
- error = EINVAL;
- SDT_PROBE2(igb, functions, igb_ioctl_txqaffinity, entry, -1, -1);
- break;
- }
- if (!ifp->if_txq_affinity) {
- log(LOG_ERR, "!ifp->if_txq_affinity\n");
- error = EINVAL;
- SDT_PROBE2(igb, functions, igb_ioctl_txqaffinity, entry, -1, -1);
- break;
- }
- *(u_long *)data = ifp->if_txq_affinity[index];
- SDT_PROBE2(igb, functions, igb_ioctl_txqaffinity, entry, index, ifp->if_txq_affinity[index]);
- break;
- }
-
default:
error = ether_ioctl(ifp, command, data);
break;
@@ -2831,12 +2760,15 @@
ifp->if_transmit = igb_mq_start;
ifp->if_qflush = igb_qflush;
#endif
+ ifp->if_get_rxqueue_len = igb_get_rxqueue_len;
+ ifp->if_get_txqueue_len = igb_get_txqueue_len;
+ ifp->if_get_rxqueue_affinity = igb_get_rxqueue_affinity;
+ ifp->if_get_txqueue_affinity = igb_get_txqueue_affinity;
+
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1);
ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1;
IFQ_SET_READY(&ifp->if_snd);
- ether_ifattach(ifp, adapter->hw.mac.addr);
-
ifp->if_capabilities = ifp->if_capenable = 0;
ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
@@ -2870,6 +2802,8 @@
*/
ifp->if_capabilities |= IFCAP_VLAN_HWFILTER;
+ ether_ifattach(ifp, adapter->hw.mac.addr);
+
/*
* Specify the media types supported by this adapter and register
* callbacks to update media and link information
@@ -5656,3 +5590,29 @@
e1000_force_mac_fc(&adapter->hw);
return error;
}
+
+static int
+igb_get_rxqueue_len(struct ifnet *ifp)
+{
+ struct adapter *adapter = ifp->if_softc;
+ return adapter->num_queues;
+}
+
+static int
+igb_get_txqueue_len(struct ifnet *ifp)
+{
+ struct adapter *adapter = ifp->if_softc;
+ return adapter->num_queues;
+}
+
+static int
+igb_get_rxqueue_affinity(struct ifnet *ifp, int queid)
+{
+ return queid;
+}
+
+static int
+igb_get_txqueue_affinity(struct ifnet *ifp, int queid)
+{
+ return queid;
+}
==== //depot/projects/soc2011/mq_bpf/src/sys/kern/sys_socket.c#2 (text+ko) ====
==== //depot/projects/soc2011/mq_bpf/src/sys/net/bpf.c#11 (text+ko) ====
@@ -41,7 +41,6 @@
#include "opt_compat.h"
#include "opt_netgraph.h"
#include "opt_kdtrace.h"
-#include "opt_rss.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -77,9 +76,6 @@
#include <net/bpf_zerocopy.h>
#include <net/bpfdesc.h>
#include <net/vnet.h>
-#ifdef SOFTRSS
-#include <net/netisr.h>
-#endif
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <sys/kernel.h>
@@ -1542,7 +1538,6 @@
case BIOCENAQMASK:
{
- int i;
struct ifnet *ifp;
if (d->bd_bif == NULL) {
@@ -1561,41 +1556,23 @@
break;
}
ifp = d->bd_bif->bif_ifp;
- if (!(ifp->if_capenable & IFCAP_MULTIQUEUE)) {
-#ifdef SOFTRSS
- ifp->if_rxq_num = netisr_get_cpucount();
- ifp->if_txq_num = 1;
- ifp->if_capabilities |= IFCAP_SOFT_MULTIQUEUE;
- ifp->if_capenable |= IFCAP_SOFT_MULTIQUEUE;
- ifp->if_rxq_affinity =
- (u_long *)malloc(sizeof(u_long) * ifp->if_rxq_num,
- M_DEVBUF, M_NOWAIT);
- ifp->if_txq_affinity =
- (u_long *)malloc(sizeof(u_long) * ifp->if_txq_num,
- M_DEVBUF, M_NOWAIT);
- for (i = 0; i < ifp->if_rxq_num; i++)
- ifp->if_rxq_affinity[i] = i;
- for (i = 0; i < ifp->if_txq_num; i++)
- ifp->if_txq_affinity[i] = i;
-#else
+ if (!((ifp->if_capabilities & IFCAP_MULTIQUEUE) |
+ (ifp->if_capabilities & IFCAP_SOFT_MULTIQUEUE))) {
log(LOG_ERR, "if doesn't support multiqueue");
error = EINVAL;
SDT_PROBE1(bpf, functions, bpfioctl_biocenaqmask, entry, -1);
break;
-#endif
+
}
-
- log(LOG_DEBUG, "if_rxq_num:%d\n", ifp->if_rxq_num);
- log(LOG_DEBUG, "if_txq_num:%d\n", ifp->if_txq_num);
d->bd_qmask.qm_enabled = TRUE;
d->bd_qmask.qm_rxq_mask =
- malloc(ifp->if_rxq_num * sizeof(boolean_t), M_BPF,
+ malloc(ifp->if_get_rxqueue_len(ifp) * sizeof(boolean_t), M_BPF,
M_WAITOK | M_ZERO);
d->bd_qmask.qm_txq_mask =
- malloc(ifp->if_txq_num * sizeof(boolean_t), M_BPF,
+ malloc(ifp->if_get_txqueue_len(ifp) * sizeof(boolean_t), M_BPF,
M_WAITOK | M_ZERO);
d->bd_qmask.qm_other_mask = FALSE;
- SDT_PROBE1(bpf, functions, bpfioctl_biocenaqmask, entry, ifp->if_rxq_num);
+ SDT_PROBE1(bpf, functions, bpfioctl_biocenaqmask, entry, ifp->if_get_rxqueue_len(ifp));
break;
}
@@ -1645,8 +1622,8 @@
}
ifp = d->bd_bif->bif_ifp;
index = *(uint32_t *)addr;
- if (index > ifp->if_rxq_num) {
- log(LOG_ERR, "BIOCSTRXQMASK: index too large index:%x rxq_num:%x\n", index, ifp->if_rxq_num);
+ if (index > ifp->if_get_rxqueue_len(ifp)) {
+ log(LOG_ERR, "BIOCSTRXQMASK: index too large index:%x rxq_num:%x\n", index, ifp->if_get_rxqueue_len(ifp));
error = EINVAL;
SDT_PROBE1(bpf, functions, bpfioctl_biocstrxqmask, entry, -1);
break;
@@ -1678,8 +1655,8 @@
}
ifp = d->bd_bif->bif_ifp;
index = *(uint32_t *)addr;
- if (index > ifp->if_rxq_num) {
- log(LOG_ERR, "BIOCCRRXQMASK: index too large index:%x rxq_num:%x\n", index, ifp->if_rxq_num);
+ if (index > ifp->if_get_rxqueue_len(ifp)) {
+ log(LOG_ERR, "BIOCCRRXQMASK: index too large index:%x rxq_num:%x\n", index, ifp->if_get_rxqueue_len(ifp));
error = EINVAL;
SDT_PROBE1(bpf, functions, bpfioctl_bioccrrxqmask, entry, -1);
break;
@@ -1711,8 +1688,8 @@
}
ifp = d->bd_bif->bif_ifp;
index = *(uint32_t *)addr;
- if (index > ifp->if_rxq_num) {
- log(LOG_ERR, "BIOCGTRXQMASK: index too large index:%x rxq_num:%x\n", index, ifp->if_rxq_num);
+ if (index > ifp->if_get_rxqueue_len(ifp)) {
+ log(LOG_ERR, "BIOCGTRXQMASK: index too large index:%x rxq_num:%x\n", index, ifp->if_get_rxqueue_len(ifp));
error = EINVAL;
SDT_PROBE1(bpf, functions, bpfioctl_biocgtrxqmask, entry, -1);
break;
@@ -1745,8 +1722,8 @@
ifp = d->bd_bif->bif_ifp;
index = *(uint32_t *)addr;
- if (index > ifp->if_txq_num) {
- log(LOG_ERR, "BIOCSTTXQMASK: index too large index:%x txq_num:%x\n", index, ifp->if_txq_num);
+ if (index > ifp->if_get_txqueue_len(ifp)) {
+ log(LOG_ERR, "BIOCSTTXQMASK: index too large index:%x txq_num:%x\n", index, ifp->if_get_txqueue_len(ifp));
error = EINVAL;
SDT_PROBE1(bpf, functions, bpfioctl_biocsttxqmask, entry, -1);
break;
@@ -1779,8 +1756,8 @@
ifp = d->bd_bif->bif_ifp;
index = *(uint32_t *)addr;
- if (index > ifp->if_txq_num) {
- log(LOG_ERR, "BIOCCRTXQMASK: index too large index:%x txq_num:%x\n", index, ifp->if_txq_num);
+ if (index > ifp->if_get_txqueue_len(ifp)) {
+ log(LOG_ERR, "BIOCCRTXQMASK: index too large index:%x txq_num:%x\n", index, ifp->if_get_txqueue_len(ifp));
error = EINVAL;
SDT_PROBE1(bpf, functions, bpfioctl_bioccrtxqmask, entry, -1);
break;
@@ -1812,8 +1789,8 @@
}
ifp = d->bd_bif->bif_ifp;
index = *(uint32_t *)addr;
- if (index > ifp->if_txq_num) {
- log(LOG_ERR, "BIOCGTTXQMASK: index too large index:%x txq_num:%x\n", index, ifp->if_txq_num);
+ if (index > ifp->if_get_txqueue_len(ifp)) {
+ log(LOG_ERR, "BIOCGTTXQMASK: index too large index:%x txq_num:%x\n", index, ifp->if_get_txqueue_len(ifp));
error = EINVAL;
SDT_PROBE2(bpf, functions, bpfioctl_biocgttxqmask, entry, -1, -1);
break;
@@ -2219,17 +2196,18 @@
if (!d->bd_qmask.qm_other_mask)
continue;
} else {
+ struct ifnet *ifp = bp->bif_ifp;
if (m->m_pkthdr.rxqid != (uint32_t)-1)
- KASSERT(m->m_pkthdr.rxqid < bp->bif_ifp->if_rxq_num,
+ KASSERT(m->m_pkthdr.rxqid < ifp->if_get_rxqueue_len(ifp),
("rxqid is not vaild rxqid:%x rxq_num:%x",
- m->m_pkthdr.rxqid, bp->bif_ifp->if_rxq_num));
+ m->m_pkthdr.rxqid, ifp->if_get_rxqueue_len(ifp)));
if (m->m_pkthdr.txqid != (uint32_t)-1)
- KASSERT(m->m_pkthdr.txqid < bp->bif_ifp->if_txq_num,
+ KASSERT(m->m_pkthdr.txqid < ifp->if_get_txqueue_len(ifp),
("txqid is not vaild txqid:%x txq_num:%x",
- m->m_pkthdr.txqid, bp->bif_ifp->if_txq_num));
+ m->m_pkthdr.txqid, ifp->if_get_txqueue_len(ifp)));
- SDT_PROBE3(bpf, functions, bpf_mtap_rx, entry, d, m->m_pkthdr.rxqid, bp->bif_ifp->if_rxq_num);
- SDT_PROBE3(bpf, functions, bpf_mtap_tx, entry, d, m->m_pkthdr.txqid, bp->bif_ifp->if_txq_num);
+ SDT_PROBE3(bpf, functions, bpf_mtap_rx, entry, d, m->m_pkthdr.rxqid, ifp->if_get_rxqueue_len(ifp));
+ SDT_PROBE3(bpf, functions, bpf_mtap_tx, entry, d, m->m_pkthdr.txqid, ifp->if_get_txqueue_len(ifp));
if (m->m_pkthdr.rxqid != (uint32_t)-1 &&
!d->bd_qmask.qm_rxq_mask[m->m_pkthdr.rxqid])
continue;
@@ -2300,8 +2278,9 @@
BPFIF_RLOCK(bp, &tracker);
LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
if (d->bd_qmask.qm_enabled) {
- SDT_PROBE3(bpf, functions, bpf_mtap2_rx, entry, d, m->m_pkthdr.rxqid, bp->bif_ifp->if_rxq_num);
- SDT_PROBE3(bpf, functions, bpf_mtap2_tx, entry, d, m->m_pkthdr.txqid, bp->bif_ifp->if_txq_num);
+ struct ifnet *ifp = bp->bif_ifp;
+ SDT_PROBE3(bpf, functions, bpf_mtap2_rx, entry, d, m->m_pkthdr.rxqid, ifp->if_get_rxqueue_len(ifp));
+ SDT_PROBE3(bpf, functions, bpf_mtap2_tx, entry, d, m->m_pkthdr.txqid, ifp->if_get_txqueue_len(ifp));
if (m->m_pkthdr.rxqid != (uint32_t)-1 &&
!d->bd_qmask.qm_rxq_mask[m->m_pkthdr.rxqid])
==== //depot/projects/soc2011/mq_bpf/src/sys/net/if.c#2 (text+ko) ====
@@ -2418,6 +2418,32 @@
break;
}
+ case SIOCGIFQLEN:
+ if (!ifp->if_capabilities & IFCAP_MULTIQUEUE &&
+ !ifp->if_capabilities & IFCAP_SOFT_MULTIQUEUE)
+ return (EOPNOTSUPP);
+ KASSERT(ifp->if_get_rxqueue_len, ("if_get_rxqueue_len not set"));
+ KASSERT(ifp->if_get_txqueue_len, ("if_get_txqueue_len not set"));
+ ifr->ifr_rxqueue_len = ifp->if_get_rxqueue_len(ifp);
+ ifr->ifr_txqueue_len = ifp->if_get_txqueue_len(ifp);
+ break;
+
+ case SIOCGIFRXQAFFINITY:
+ if (!ifp->if_capabilities & IFCAP_MULTIQUEUE &&
+ !ifp->if_capabilities & IFCAP_SOFT_MULTIQUEUE)
+ return (EOPNOTSUPP);
+ KASSERT(ifp->if_get_rxqueue_affinity, ("if_get_rxqueue_affinity not set"));
+ ifr->ifr_affinity_cpu = ifp->if_get_rxqueue_affinity(ifp, ifr->ifr_affinity_que);
+ break;
+
+ case SIOCGIFTXQAFFINITY:
+ if (!ifp->if_capabilities & IFCAP_MULTIQUEUE &&
+ !ifp->if_capabilities & IFCAP_SOFT_MULTIQUEUE)
+ return (EOPNOTSUPP);
+ KASSERT(ifp->if_get_rxqueue_affinity, ("if_get_rxqueue_affinity not set"));
+ ifr->ifr_affinity_cpu = ifp->if_get_rxqueue_affinity(ifp, ifr->ifr_affinity_que);
+ break;
+
default:
error = ENOIOCTL;
break;
==== //depot/projects/soc2011/mq_bpf/src/sys/net/if.h#4 (text+ko) ====
@@ -317,6 +317,8 @@
int ifru_media;
caddr_t ifru_data;
int ifru_cap[2];
+ int ifru_queue_len[2];
+ int ifru_queue_affinity[2];
} ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
@@ -333,6 +335,10 @@
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
#define ifr_index ifr_ifru.ifru_index /* interface index */
+#define ifr_rxqueue_len ifr_ifru.ifru_queue_len[0] /* rxqueue len */
+#define ifr_txqueue_len ifr_ifru.ifru_queue_len[1] /* txqueue len */
+#define ifr_affinity_que ifr_ifru.ifru_queue_affinity[0] /* queue id */
+#define ifr_affinity_cpu ifr_ifru.ifru_queue_affinity[1] /* cpu id */
};
#define _SIZEOF_ADDR_IFREQ(ifr) \
==== //depot/projects/soc2011/mq_bpf/src/sys/net/if_ethersubr.c#4 (text+ko) ====
@@ -153,6 +153,12 @@
#define V_ether_ipfw VNET(ether_ipfw)
#endif
+#ifdef SOFTRSS
+static int softrss_get_rxqueue_len(struct ifnet *);
+static int softrss_get_txqueue_len(struct ifnet *);
+static int softrss_get_rxqueue_affinity(struct ifnet *, int);
+static int softrss_get_txqueue_affinity(struct ifnet *, int);
+#endif
/*
* Ethernet output routine.
@@ -823,7 +829,6 @@
static void
ether_input(struct ifnet *ifp, struct mbuf *m)
{
- log(LOG_DEBUG, "%s ifp:%p m:%p\n", __func__, ifp, m);
#if defined(RSS) || defined(SOFTRSS)
/*
* We will rely on rcvif being set properly in the deferred context,
@@ -1054,6 +1059,17 @@
break;
if (i != ifp->if_addrlen)
if_printf(ifp, "Ethernet address: %6D\n", lla, ":");
+
+#ifdef SOFTRSS
+ if (!ifp->if_capabilities & IFCAP_MULTIQUEUE) {
+ ifp->if_capabilities |= IFCAP_SOFT_MULTIQUEUE;
+ ifp->if_capenable |= IFCAP_SOFT_MULTIQUEUE;
+ ifp->if_get_rxqueue_len = softrss_get_rxqueue_len;
+ ifp->if_get_txqueue_len = softrss_get_txqueue_len;
+ ifp->if_get_rxqueue_affinity = softrss_get_rxqueue_affinity;
+ ifp->if_get_txqueue_affinity = softrss_get_txqueue_affinity;
+ }
+#endif
}
/*
@@ -1439,5 +1455,31 @@
return (m);
}
+#ifdef SOFTRSS
+static int
+softrss_get_rxqueue_len(struct ifnet *ifp)
+{
+ return netisr_get_cpucount();
+}
+
+static int
+softrss_get_txqueue_len(struct ifnet *ifp)
+{
+ return 1;
+}
+
+static int
+softrss_get_rxqueue_affinity(struct ifnet *ifp, int queid)
+{
+ netisr_get_cpuid(queid);
+}
+
+static int
+softrss_get_txqueue_affinity(struct ifnet *ifp, int queid)
+{
+ return 0;
+}
+#endif
+
DECLARE_MODULE(ether, ether_mod, SI_SUB_INIT_IF, SI_ORDER_ANY);
MODULE_VERSION(ether, 1);
==== //depot/projects/soc2011/mq_bpf/src/sys/net/if_var.h#6 (text+ko) ====
@@ -171,6 +171,15 @@
(struct ifnet *, struct mbuf *);
void (*if_reassign) /* reassign to vnet routine */
(struct ifnet *, struct vnet *, char *);
+ int (*if_get_rxqueue_len)
+ (struct ifnet *);
+ int (*if_get_txqueue_len)
+ (struct ifnet *);
+ int (*if_get_rxqueue_affinity)
+ (struct ifnet *, int);
+ int (*if_get_txqueue_affinity)
+ (struct ifnet *, int);
+
struct vnet *if_home_vnet; /* where this ifnet originates from */
struct ifaddr *if_addr; /* pointer to link-level address */
void *if_llsoftc; /* link layer softc */
@@ -206,11 +215,6 @@
char *if_description; /* interface description */
void *if_pspare[7];
int if_ispare[4];
-
- int if_rxq_num;
- int if_txq_num;
- u_long *if_rxq_affinity;
- u_long *if_txq_affinity;
};
typedef void if_init_f_t(void *);
==== //depot/projects/soc2011/mq_bpf/src/sys/net/netisr.c#3 (text+ko) ====
@@ -65,7 +65,6 @@
#include "opt_ddb.h"
#include "opt_device_polling.h"
-#include "opt_kdtrace.h"
#include <sys/param.h>
#include <sys/bus.h>
@@ -83,7 +82,6 @@
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
-#include <sys/sdt.h>
#include <sys/syslog.h>
#ifdef DDB
@@ -306,11 +304,6 @@
#define NWS_UNLOCK(s) mtx_unlock(&(s)->nws_mtx)
#define NWS_SIGNAL(s) swi_sched((s)->nws_swi_cookie, 0)
-SDT_PROVIDER_DECLARE(netisr);
-SDT_PROVIDER_DEFINE(netisr);
-SDT_PROBE_DEFINE2(netisr, functions, netisr_dispatch_src, entry, entry, "u_int", "u_int");
-SDT_PROBE_DEFINE1(netisr, functions, netisr_select_cpuid, entry, entry, "u_int");
-
/*
* Utility routines for protocols that implement their own mapping of flows
* to CPUs.
@@ -751,8 +744,7 @@
{
struct ifnet *ifp;
u_int policy;
- log(LOG_DEBUG, "%s npp:%p dispatch_policy:%d m:%p\n",
- __func__, npp, dispatch_policy,m);
+
NETISR_LOCK_ASSERT();
/*
@@ -1021,7 +1013,6 @@
int
netisr_queue(u_int proto, struct mbuf *m)
{
- log(LOG_DEBUG, "%s: proto:%d m:%p\n", __func__, proto, m);
return (netisr_queue_src(proto, 0, m));
}
@@ -1050,8 +1041,6 @@
KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", __func__,
proto));
- SDT_PROBE2(netisr, functions, netisr_dispatch_src, entry, npp->np_dispatch, npp->np_policy);
-
dispatch_policy = netisr_get_dispatch(npp);
if (dispatch_policy == NETISR_DISPATCH_DEFERRED)
return (netisr_queue_src(proto, source, m));
@@ -1084,7 +1073,6 @@
sched_pin();
m = netisr_select_cpuid(&netisr_proto[proto], NETISR_DISPATCH_HYBRID,
source, m, &cpuid);
- SDT_PROBE1(netisr, functions, netisr_select_cpuid, entry, cpuid);
if (m == NULL) {
error = ENOBUFS;
goto out_unpin;
@@ -1158,7 +1146,6 @@
int
netisr_dispatch(u_int proto, struct mbuf *m)
{
- log(LOG_DEBUG, "%s proto:%d m:%p\n", __func__, proto, m);
return (netisr_dispatch_src(proto, 0, m));
}
==== //depot/projects/soc2011/mq_bpf/src/sys/netinet/in_rss.c#2 (text+ko) ====
@@ -179,8 +179,9 @@
};
static struct rss_table_entry rss_table[RSS_TABLE_MAXLEN];
-
+#ifdef SOFTRSS
static void softrss_set_flowid(struct mbuf *m);
+#endif
SDT_PROVIDER_DECLARE(rss);
SDT_PROVIDER_DEFINE(rss);
@@ -426,7 +427,6 @@
struct mbuf *
rss_m2cpuid(struct mbuf *m, uintptr_t source, u_int *cpuid)
{
- log(LOG_DEBUG,"%s m:%p\n", __func__, m);
M_ASSERTPKTHDR(m);
#ifdef SOFTRSS
==== //depot/projects/soc2011/mq_bpf/src/sys/sys/priv.h#3 (text+ko) ====
==== //depot/projects/soc2011/mq_bpf/src/sys/sys/sockio.h#3 (text+ko) ====
@@ -82,6 +82,10 @@
#define SIOCSIFDESCR _IOW('i', 41, struct ifreq) /* set ifnet descr */
#define SIOCGIFDESCR _IOWR('i', 42, struct ifreq) /* get ifnet descr */
+#define SIOCGIFQLEN _IOWR('i', 45, struct ifreq) /* get IF queue len */
+#define SIOCGIFRXQAFFINITY _IOWR('i', 46, u_long) /* get IF rx queue affinity */
+#define SIOCGIFTXQAFFINITY _IOWR('i', 47, u_long) /* get IF tx queue affinity */
+
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */
@@ -97,11 +101,6 @@
#define SIOCGIFSTATUS _IOWR('i', 59, struct ifstat) /* get IF status */
#define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set linklevel addr */
-#define SIOCGIFRXQLEN _IOR('B', 61, int) /* get IF rx queue len */
-#define SIOCGIFTXQLEN _IOR('B', 62, int) /* get IF tx queue len */
-#define SIOCGIFRXQAFFINITY _IOWR('B', 63, u_long) /* get IF rx queue affinity */
-#define SIOCGIFTXQAFFINITY _IOWR('B', 64, u_long) /* get IF tx queue affinity */
-
#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */
#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */
#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */
More information about the p4-projects
mailing list