Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standardise link/counter names #1025

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/apps/example/asm.dasl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function selftest ()
config.app(c, "source", basic_apps.Source)
config.app(c, "sink", basic_apps.Sink)
config.app(c, "asm", Asm)
config.link(c, "source.tx -> asm.rx")
config.link(c, "asm.tx -> sink.rx")
config.link(c, "source.output -> asm.input")
config.link(c, "asm.output -> sink.input")
app.configure(c)
app.main({duration = 0.1})
print("magic number: 0x"..bit.tohex(asm_status[0]))
Expand Down
14 changes: 7 additions & 7 deletions src/apps/intel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
## Intel10G (apps.intel.intel_app)

The `Intel10G` drives one port of an Intel 82599 Ethernet controller.
Packets taken from the `rx` port are transmitted onto the network.
Packets received from the network are put on the `tx` port.
Packets taken from the `input` port are transmitted onto the network.
Packets received from the network are put on the `output` port.

DIAGRAM: Intel10G
+----------+
| |
rx ---->* Intel10G *----> tx
| |
+----------+
+----------+
| |
input ---->* Intel10G *----> output
| |
+----------+

— Method **Intel10G.dev:get_rxstats**

Expand Down
44 changes: 22 additions & 22 deletions src/apps/intel/intel1g.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@ function Intel1g:new(conf)
poke32(r.TDT, tdt)
end

function self:push () -- move frames from link.rx to NIC.txQueue for transmission
function self:push () -- move frames from link.input to NIC.txQueue for transmission
counters.push= counters.push +1
--local li = self.input[1]
local li = self.input["rx"] -- same-same as [1]
local li = self.input.input -- same-same as [1]
assert(li, "intel1g:push: no input link")
if link.empty(li) then -- from SolarFlareNic:push()
counters.pushRxLinkEmpty= counters.pushRxLinkEmpty +1
Expand Down Expand Up @@ -580,10 +580,10 @@ function Intel1g:new(conf)
--print("sync_receive(): rdh=",rdh, " rdt=",rdt)
end

function self:pull () -- move received frames from NIC.rxQueue to link.tx
function self:pull () -- move received frames from NIC.rxQueue to link.output
counters.pull= counters.pull +1
--local lo = self.output[1]
local lo = self.output["tx"] -- same-same as [1]
local lo = self.output.output -- same-same as [1]
--assert(lo, "intel1g: no output link")
local limit = rxburst
while limit > 0 and can_receive() do
Expand Down Expand Up @@ -642,12 +642,12 @@ function selftest ()
config.app(c, "nic", Intel1g, {pciaddr=pciaddr, loopback="PHY", rxburst=512})
--config.app(c, "nic", Intel1g, {pciaddr=pciaddr, loopback="MAC", txqueue=1})
--config.app(c, "nic", Intel1g, {pciaddr=pciaddr, loopback="MAC", txqueue=1, rxqueue=1})
config.link(c, "source.tx -> nic.rx")
config.link(c, "nic.tx -> sink.rx")
config.link(c, "source.output -> nic.input")
config.link(c, "nic.output -> sink.input")
-- replace intel1g by Repeater
--config.app(c, "repeater", basic.Repeater)
--config.link(c, "source.tx -> repeater.input")
--config.link(c, "repeater.output -> sink.rx")
--config.link(c, "source.output -> repeater.input")
--config.link(c, "repeater.output -> sink.input")
engine.configure(c)

-- showlinks: src/core/app.lua calls report_links()
Expand All @@ -659,35 +659,35 @@ function selftest ()
local runtime = endTime - startTime
engine.app_table.nic.stop() -- outputs :report()

local source= engine.app_table.source.output.tx
local source= engine.app_table.source.output.output
assert(source, "Intel1g: no source?")
local s= link.stats(source)
print("source: txpackets= ", s.txpackets, " rxpackets= ", s.rxpackets, " txdrop= ", s.txdrop)
local txpackets= s.txpackets
print("source: input_packets= ", s.input_packets, " output_packets= ", s.output_packets, " input_drop= ", s.input_drop)
local input_packets= s.input_packets

--local li = engine.app_table.nic.input[1]
local li = engine.app_table.nic.input["rx"] -- same-same as [1]
local li = engine.app_table.nic.input["input"] -- same-same as [1]
assert(li, "Intel1g: no input link?")
local s= link.stats(li)
print("input link: txpackets= ", s.txpackets, " rxpackets= ", s.rxpackets, " txdrop= ", s.txdrop)
print("input link: input_packets= ", s.input_packets, " output_packets= ", s.output_packets, " input_drop= ", s.input_drop)

--local lo = engine.app_table.nic.output[1]
local lo = engine.app_table.nic.output["tx"] -- same-same as [1]
local lo = engine.app_table.nic.output["output"] -- same-same as [1]
assert(lo, "Intel1g: no output link?")
local s= link.stats(lo)
print("output link: txpackets= ", s.txpackets, " rxpackets= ", s.rxpackets, " txdrop= ", s.txdrop)
print("output link: input_packets= ", s.input_packets, " output_packets= ", s.output_packets, " input_drop= ", s.input_drop)

local sink= engine.app_table.sink.input.rx
local sink= engine.app_table.sink.input.input
assert(sink, "Intel1g: no sink?")
local s= link.stats(sink)
print("sink: txpackets= ", s.txpackets, " rxpackets= ", s.rxpackets, " txdrop= ", s.txdrop)
local rxpackets= s.rxpackets
print("sink: input_packets= ", s.input_packets, " output_packets= ", s.output_packets, " input_drop= ", s.input_drop)
local output_packets= s.output_packets

print(("Processed %.1f M 60 Byte packets in %.2f s (rate: %.1f Mpps, %.2f Gbit/s, %.2f %% packet loss).")
:format(
txpackets / 1e6, runtime,
txpackets / runtime / 1e6,
((txpackets * 60 * 8) / runtime) / (1024*1024*1024),
(txpackets - rxpackets) *100 / txpackets
input_packets / 1e6, runtime,
input_packets / runtime / 1e6,
((input_packets * 60 * 8) / runtime) / (1024*1024*1024),
(input_packets - output_packets) *100 / input_packets
))
end
116 changes: 58 additions & 58 deletions src/apps/intel/intel_app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,24 @@ function Intel82599:new (conf)
if not self.stats.shm then
self.stats.shm = shm.create_frame(
"pci/"..conf.pciaddr,
{dtime = {counter, C.get_unix_time()},
mtu = {counter, self.dev.mtu},
speed = {counter, 10000000000}, -- 10 Gbits
status = {counter, 2}, -- Link down
promisc = {counter},
macaddr = {counter},
rxbytes = {counter},
rxpackets = {counter},
rxmcast = {counter},
rxbcast = {counter},
rxdrop = {counter},
rxerrors = {counter},
txbytes = {counter},
txpackets = {counter},
txmcast = {counter},
txbcast = {counter},
txdrop = {counter},
txerrors = {counter}})
{dtime = {counter, C.get_unix_time()},
mtu = {counter, self.dev.mtu},
speed = {counter, 10000000000}, -- 10 Gbits
status = {counter, 2}, -- Link down
promisc = {counter},
macaddr = {counter},
input_bytes = {counter},
input_packets = {counter},
input_mcast = {counter},
input_bcast = {counter},
input_drop = {counter},
input_errors = {counter},
output_bytes = {counter},
output_packets = {counter},
output_mcast = {counter},
output_bcast = {counter},
output_drop = {counter},
output_errors = {counter}})
self.stats.sync_timer = lib.timer(0.001, 'repeating', engine.now)

if not conf.vmdq and conf.macaddr then
Expand Down Expand Up @@ -140,9 +140,9 @@ function Intel82599:set_rx_buffer_freelist (fl)
self.rx_buffer_freelist = fl
end

-- Pull in packets from the network and queue them on our 'tx' link.
-- Pull in packets from the network and queue them on our 'output' link.
function Intel82599:pull ()
local l = self.output.tx
local l = self.output.output
if l == nil then return end
self.dev:sync_receive()
for i = 1, engine.pull_npackets do
Expand Down Expand Up @@ -172,21 +172,21 @@ local promisc_mask = lib.bits{UPE=9}
function Intel82599:sync_stats ()
local counters = self.stats.shm
local s, r, qs = self.stats.s, self.stats.r, self.stats.qs
counter.set(counters.rxbytes, s.GORC64())
counter.set(counters.rxpackets, s.GPRC())
counter.set(counters.input_bytes, s.GORC64())
counter.set(counters.input_packets, s.GPRC())
local mprc, bprc = s.MPRC(), s.BPRC()
counter.set(counters.rxmcast, mprc + bprc)
counter.set(counters.rxbcast, bprc)
counter.set(counters.input_mcast, mprc + bprc)
counter.set(counters.input_bcast, bprc)
-- The RX receive drop counts are only available through the RX stats
-- register. We only read stats register #0 here.
counter.set(counters.rxdrop, qs.QPRDC[0]())
counter.set(counters.rxerrors, s.CRCERRS() + s.ILLERRC() + s.ERRBC() +
s.RUC() + s.RFC() + s.ROC() + s.RJC())
counter.set(counters.txbytes, s.GOTC64())
counter.set(counters.txpackets, s.GPTC())
counter.set(counters.input_drop, qs.QPRDC[0]())
counter.set(counters.input_errors, s.CRCERRS() + s.ILLERRC() + s.ERRBC() +
s.RUC() + s.RFC() + s.ROC() + s.RJC())
counter.set(counters.output_bytes, s.GOTC64())
counter.set(counters.output_packets, s.GPTC())
local mptc, bptc = s.MPTC(), s.BPTC()
counter.set(counters.txmcast, mptc + bptc)
counter.set(counters.txbcast, bptc)
counter.set(counters.output_mcast, mptc + bptc)
counter.set(counters.output_bcast, bptc)
if bit.band(r.LINKS(), link_up_mask) == link_up_mask then
counter.set(counters.status, 1) -- Up
else
Expand All @@ -199,16 +199,16 @@ function Intel82599:sync_stats ()
end
end

-- Push packets from our 'rx' link onto the network.
-- Push packets from our 'input' link onto the network.
function Intel82599:push ()
local l = self.input.rx
local l = self.input.input
if l == nil then return end
while not empty(l) and self.dev:can_transmit() do
-- We must not send packets that are bigger than the MTU. This
-- check is currently disabled to satisfy some selftests until
-- agreement on this strategy is reached.
-- if p.length > self.dev.mtu then
-- counter.add(self.stats.shm.txdrop)
-- counter.add(self.stats.shm.output_drop)
-- packet.free(p)
-- else
do local p = receive(l)
Expand Down Expand Up @@ -266,8 +266,8 @@ function selftest ()
mq_sw(pcideva)
engine.main({duration = 1, report={showlinks=true, showapps=false}})
do
local a0Sends = link.stats(engine.app_table.nicAm0.input.rx).txpackets
local a1Gets = link.stats(engine.app_table.nicAm1.output.tx).rxpackets
local a0Sends = link.stats(engine.app_table.nicAm0.input.input).input_packets
local a1Gets = link.stats(engine.app_table.nicAm1.output.output).output_packets
-- Check propertions with some modest margin for error
if a1Gets < a0Sends * 0.45 or a1Gets > a0Sends * 0.55 then
print("mq_sw: wrong proportion of packets passed/discarded")
Expand All @@ -290,10 +290,10 @@ function selftest ()
engine.main({duration = 1, report={showlinks=true, showapps=false}})

do
local aSends = link.stats(engine.app_table.nicA.input.rx).txpackets
local aGets = link.stats(engine.app_table.nicA.output.tx).rxpackets
local bSends = link.stats(engine.app_table.nicB.input.rx).txpackets
local bGets = link.stats(engine.app_table.nicB.output.tx).rxpackets
local aSends = link.stats(engine.app_table.nicA.input.input).input_packets
local aGets = link.stats(engine.app_table.nicA.output.output).output_packets
local bSends = link.stats(engine.app_table.nicB.input.input).input_packets
local bGets = link.stats(engine.app_table.nicB.output.output).output_packets

if bGets < aSends/2
or aGets < bSends/2
Expand All @@ -313,9 +313,9 @@ function selftest ()
engine.main({duration = 1, report={showlinks=true, showapps=false}})

do
local aSends = link.stats(engine.app_table.nicAs.input.rx).txpackets
local b0Gets = link.stats(engine.app_table.nicBm0.output.tx).rxpackets
local b1Gets = link.stats(engine.app_table.nicBm1.output.tx).rxpackets
local aSends = link.stats(engine.app_table.nicAs.input.input).input_packets
local b0Gets = link.stats(engine.app_table.nicBm0.output.output).output_packets
local b1Gets = link.stats(engine.app_table.nicBm1.output.output).output_packets

if b0Gets < b1Gets/2 or
b1Gets < b0Gets/2 or
Expand All @@ -339,10 +339,10 @@ function sq_sq(pcidevA, pcidevB)
config.app(c, 'nicA', Intel82599, {pciaddr=pcidevA})
config.app(c, 'nicB', Intel82599, {pciaddr=pcidevB})
config.app(c, 'sink', basic_apps.Sink)
config.link(c, 'source1.out -> nicA.rx')
config.link(c, 'source2.out -> nicB.rx')
config.link(c, 'nicA.tx -> sink.in1')
config.link(c, 'nicB.tx -> sink.in2')
config.link(c, 'source1.out -> nicA.input')
config.link(c, 'source2.out -> nicB.input')
config.link(c, 'nicA.output -> sink.in1')
config.link(c, 'nicB.output -> sink.in2')
engine.configure(c)
end

Expand Down Expand Up @@ -389,10 +389,10 @@ function mq_sq(pcidevA, pcidevB)
print("The packets should arrive evenly split between the VFs")
config.app(c, 'sink_ms', basic_apps.Sink)
config.link(c, 'source_ms.output -> repeater_ms.input')
config.link(c, 'repeater_ms.output -> nicAs.rx')
config.link(c, 'nicAs.tx -> sink_ms.in1')
config.link(c, 'nicBm0.tx -> sink_ms.in2')
config.link(c, 'nicBm1.tx -> sink_ms.in3')
config.link(c, 'repeater_ms.output -> nicAs.input')
config.link(c, 'nicAs.output -> sink_ms.in1')
config.link(c, 'nicBm0.output -> sink_ms.in2')
config.link(c, 'nicBm1.output -> sink_ms.in3')
engine.configure(c)
link.transmit(engine.app_table.source_ms.output.output, packet.from_string(d1))
link.transmit(engine.app_table.source_ms.output.output, packet.from_string(d2))
Expand Down Expand Up @@ -437,9 +437,9 @@ function mq_sw(pcidevA)
print ("half of them go to nicAm1 and half go nowhere")
config.app(c, 'sink_ms', basic_apps.Sink)
config.link(c, 'source_ms.output -> repeater_ms.input')
config.link(c, 'repeater_ms.output -> nicAm0.rx')
config.link(c, 'nicAm0.tx -> sink_ms.in1')
config.link(c, 'nicAm1.tx -> sink_ms.in2')
config.link(c, 'repeater_ms.output -> nicAm0.input')
config.link(c, 'nicAm0.output -> sink_ms.in1')
config.link(c, 'nicAm1.output -> sink_ms.in2')
engine.configure(c)
link.transmit(engine.app_table.source_ms.output.output, packet.from_string(d1))
link.transmit(engine.app_table.source_ms.output.output, packet.from_string(d2))
Expand Down Expand Up @@ -489,9 +489,9 @@ function manyreconf(pcidevA, pcidevB, n, do_pf)
})
config.app(c, 'sink_ms', basic_apps.Sink)
config.link(c, 'source_ms.output -> repeater_ms.input')
config.link(c, 'repeater_ms.output -> nicAm0.rx')
config.link(c, 'nicAm0.tx -> sink_ms.in1')
config.link(c, 'nicAm1.tx -> sink_ms.in2')
config.link(c, 'repeater_ms.output -> nicAm0.input')
config.link(c, 'nicAm0.output -> sink_ms.in1')
config.link(c, 'nicAm1.output -> sink_ms.in2')
if do_pf then engine.configure(config.new()) end
engine.configure(c)
link.transmit(engine.app_table.source_ms.output.output, packet.from_string(d1))
Expand All @@ -501,7 +501,7 @@ function manyreconf(pcidevA, pcidevB, n, do_pf)
redos = redos + engine.app_table.nicAm1.dev.pf.redos
maxredos = math.max(maxredos, engine.app_table.nicAm1.dev.pf.redos)
waits = waits + engine.app_table.nicAm1.dev.pf.waitlu_ms
local sent = link.stats(engine.app_table.nicAm0.input.rx).txpackets
local sent = link.stats(engine.app_table.nicAm0.input.input).input_packets
io.write (('test #%3d: VMDq VLAN=%d; 100ms burst. packet sent: %s\n'):format(i, 100+i, lib.comma_value(sent-prevsent)))
if sent == prevsent then
io.write("error: NIC transmit counter did not increase\n")
Expand Down
6 changes: 3 additions & 3 deletions src/apps/ipsec/esp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ AES128gcm = {
spi = {required=true}, key = {required=true}, window_size = {}
},
shm = {
txerrors = {counter}, rxerrors = {counter}
output_errors = {counter}, input_errors = {counter}
}
}

Expand Down Expand Up @@ -43,7 +43,7 @@ function AES128gcm:push ()
link.transmit(output, p)
else
packet.free(p)
counter.add(self.shm.txerrors)
counter.add(self.shm.output_errors)
end
end
-- Decapsulation path
Expand All @@ -55,7 +55,7 @@ function AES128gcm:push ()
link.transmit(output, p)
else
packet.free(p)
counter.add(self.shm.rxerrors)
counter.add(self.shm.input_errors)
end
end
end
Loading