Home | History | Annotate | Download | only in hpc
History log of /src/sys/arch/sgimips/hpc/if_sq.c
RevisionDateAuthorComments
 1.60  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.59  29-Jun-2024  riastradh branches: 1.59.2;
if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.58  10-Feb-2024  andvar s/alloted/allotted/ in comments.
 1.57  20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.56  05-Dec-2023  andvar add explicit braces around SQ_DPRINTF() to fix dangling else compiler error.

fixes build with SQ_DEBUG option enabled for sgimips.
 1.55  18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.54  30-Jan-2020  martin Fix typo
 1.53  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.52  23-May-2019  msaitoh branches: 1.52.4;
Whitespace fix (mainly tabify).
 1.51  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.50  05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.49  26-Jun-2018  msaitoh branches: 1.49.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.48  15-Dec-2016  ozaki-r branches: 1.48.14;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.47  08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.46  10-Jun-2016  ozaki-r branches: 1.46.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.45  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.44  18-Feb-2015  macallan switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
 1.43  02-Feb-2012  tls branches: 1.43.6; 1.43.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.42  01-Jul-2011  dyoung branches: 1.42.2; 1.42.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.41  20-Feb-2011  matt Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.
 1.40  25-Jan-2011  tsutsui KNF and misc cosmetics.
 1.39  25-Jan-2011  tsutsui Split device_t/softc. Tested on Indy.
 1.38  25-Jan-2011  tsutsui u_intNN_t -> uintNN_t
 1.37  10-Jan-2011  tsutsui branches: 1.37.2; 1.37.4;
Use ether_aton_r() in sys/net/if_ethersubr.c instead of home grown copies.
Hint from ryo@. Tested on IP32 mec(4).
 1.36  05-Apr-2010  joerg Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.35  19-Jan-2010  pooka branches: 1.35.2; 1.35.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.34  14-Dec-2009  matt Merge from matt-nb5-mips64
Merge mips-specific arch files.
 1.33  04-Mar-2007  christos branches: 1.33.44; 1.33.62;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32  20-Feb-2007  rumble Add a real probe so that we don't attach sq(4) on GIO32 SCSI adapters.
 1.31  19-Feb-2007  rumble Support the sq(4) interface on the Challenge S's IOPLUS mezzanine. This
requires us to configure the IOPLUS to use the appropriate DMA channel,
depending on what other expansion cards may be installed. Further, we need
to do a bit more configuration of the sq(4) DMA engine, which apparently
was formerly being configured properly by the PROM. Use the same values,
which appear to work fine.

Also, extend the gio_arb_config interface as needed.

NB: We're currently setting the IOPLUS board to long burst, but it may be
better to use realtime. This will require some experimentation.
 1.30  22-Dec-2006  rumble branches: 1.30.2;
Provide attaching hpc devices with the eeprom contents, should a chip be
connected to the HPC. The only real reason for doing this is to get the
mac addresses off of E++ ethernet boards and the Challenge S IOPLUS board.
If no eeprom is present, we read in invalid data and take some default
action (query ARCBIOS).
 1.29  11-Dec-2005  christos branches: 1.29.20;
merge ktrace-lwp.
 1.28  03-Jun-2005  martin branches: 1.28.2;
Constify
 1.27  31-Dec-2004  rumble Do not report unexpected interrupts when not debugging. These
seem to occur fairly often under normal operation with HPC1.5.
Also, do not return if the interrupt is unexpected, but see if
there is anything to handle regardless, which appears to always
be the case with HPC1.5.
 1.26  30-Dec-2004  rumble Prepend HPC3 macros universally with "HPC3_" to distinctly recognise
the corresponding revision and maintain consistency with HPC1.

No functional change intended.
 1.25  30-Dec-2004  rumble Remove a few HPC1 register definitions for ones that don't exist.

Also, HPC1_ENET_INTDELAYVAL isn't a magic number. It turns the
interrupt delay off (by being the timer trigger bit), so name it
more appropriately.
 1.24  30-Dec-2004  rumble Wrap seeq and hpc register reads and writes in macros for
readability. While here, engage in some KNF and 80-column policing.
No functional changes intended.
 1.23  29-Dec-2004  rumble Fix the HPC1 transmit logic, which was previously very broken.

HPC1 does not mark transmitted descriptors like HPC3. We must
query the HPC1 chip to determine what it expects the next
descriptor to be, reclaim used ones, and restart if necessary. Each
revision's corresponding logic now lives in its own
sq_txring_hpc{1,3} function.

HPC1's transmit interrupt conditions also differ from HPC3, so
remove the INTR bits from descriptors when tagging new packets on
to the end of the chain in order to avoid unwanted interrupts.

Also, be extra careful when restarting the transmit ring. Since
transmit interrupts seem to be relatively slow on HPC1, sq_start
may be called while the DMA engine is quiescent, and before a
transmit interrupt is asserted. We cannot behave like HPC3, which
begins transmission from the first packet pulled from IFQ if the
DMA engine is quiescent as this would skip enqueued packets. It
appears that sq_start is never called before HPC3 asserts an
interrupt, which restarts the transmit queue at the appropriate
place. However, this often happens with HPC1 and we cannot assume
that if DMA is inactive in sq_start, then all previously queued
packets have fled the coop.
XXX Is there a similar race possible with HPC3?

HPC3 logic should remain functionally unchanged, and HPC1 should
finally work properly.
 1.22  29-Dec-2004  rumble Remove the static sq_trace array and make it per-device as
multiple seeq interfaces may exist. While here, add a few trace
actions, move the related macros into sqvar.h, and enhance the
sq_trace_dump output a bit.
 1.21  30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.20  30-Dec-2003  sekiya branches: 1.20.2; 1.20.4;
Adapt if_sq to HPC abstraction layer. It took both Steve Rumble and myself
to untangle the unhappiness that arises from the design differences between
HPC1 and HPC3.
 1.19  30-Oct-2003  matt Fix another lasttx uninitialized variable
 1.18  04-Oct-2003  tsutsui TAB/space cleanup.
 1.17  15-Jul-2003  lukem __KERNEL_RCSID()
 1.16  13-Jan-2003  bouyer branches: 1.16.2;
When padding frames smaller than ethernet minimum size, make sure we supply
a buffer long enouth, with the padding bytes initialised.
Also pad to ETHER_MIN_LEN - ETHER_CRC_LEN, not ETHER_MIN_LEN (padded frames
were 4 bytes too long).
 1.15  09-Nov-2002  thorpej Fix signed/unsigned comparison warnings.
 1.14  02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.11  02-May-2002  rafal branches: 1.11.4;
Add interrupt counter for Seeq interrupts; also, make sure to reset back to
"recieve only my frames & broadcasts" and clear the ALLMULTI flag if we have
no multicast addresses in our list.
 1.10  13-Mar-2002  simonb Replace lots of 8x<space> with <tabs> and other miscellaneous indentation
fixes.
Wrap a couple of long lines.
Use <return-type>\n<function name> as per KNF in a few places.
 1.9  20-Nov-2001  rafal Post Jason's autoconfig cleanup, the DMA tags are actually passed in from
the parent, so we don't need to look at the innards of bus_dma anymore.
Also, remove the Todo item pertaining to autoconfig cleanup from the list
in the comments.
 1.8  18-Nov-2001  thorpej * Clean up HPC autoconfiguration a little. Pass device register and
DMA register offsets, as well as IRQ, to children. Use direct
config. Use machine type/subtype to determine which devices are
present.
* Add support for the second SCSI controller on the Indigo2.
 1.7  08-Jul-2001  thorpej branches: 1.7.2; 1.7.8;
bcopy -> memcpy, bzero -> memset
 1.6  08-Jul-2001  thorpej - If the multicast address list changes, make sure to kick the chip.
- Remove unnecessary includes.
- Slight cosmetic change in sq_start().
 1.5  08-Jul-2001  thorpej Use sys/dev/arcbios.
 1.4  08-Jun-2001  thorpej Make sure to always re-sync the rx buffer dmamap if recycling the
rx buffer.
 1.3  07-Jun-2001  thorpej - Differentiate beteen the 8003 and 80c03 (the 80c03 has some additional
features).
- Implement crude multicast support -- enable reception of all multicast
frames if we have any addresses on the multicast list. TODO: use the
64-bit hash table on the 80c03.
- Implement promiscuous mode.

IPv6 doesn't quite work yet -- DAD finds a duplicate for the
link-local. The 8003 hears its own transmissions, but IFF_SIMPLEX
is not set, so I'm a little confused.
 1.2  07-Jun-2001  rafal Fix a deadlock in the tx code -- the code checked the DMA status before
sync'ing the descriptor, leading to a race where the packet could complete
after the DMA check but before the sync of the descriptor, sending the code
into unknown territory and the DMA engine into space. Also, fix a bug with
spurious watchdog resets going off due to the if_timer not always being set
on transmit.

Finally, clean up use of hardcoded magic numbers, get them from hpcreg.h
when possible.
 1.1  11-May-2001  thorpej Support for the Seeq 8003 Ethernet attached to the HPC ASIC,
found on Indigo2 and Indy.

From Rafal K. Boni.
 1.7.8.7  15-Jan-2003  thorpej Sync with HEAD.
 1.7.8.6  11-Nov-2002  nathanw Catch up to -current
 1.7.8.5  18-Oct-2002  nathanw Catch up to -current.
 1.7.8.4  20-Jun-2002  nathanw Catch up to -current.
 1.7.8.3  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.8.2  08-Jan-2002  nathanw Catch up to -current.
 1.7.8.1  08-Jul-2001  nathanw file if_sq.c was added on branch nathanw_sa on 2002-01-08 00:27:28 +0000
 1.7.2.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.2  16-Mar-2002  jdolecek Catch up with -current.
 1.7.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.4.1  27-Jan-2003  jmc Pullup revisions 1.15-1.16 via hand patch (requested by bouyer in ticket #1097)
When padding frames smaller than ethernet minimum size, make sure
we supply a buffer long enouth, with the padding bytes initialised.
Also pad to ETHER_MIN_LEN - ETHER_CRC_LEN, not ETHER_MIN_LEN
(padded frames were 4 bytes too long).
 1.16.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.16.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.16.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1  03-Aug-2004  skrll Sync with HEAD
 1.20.4.2  06-Apr-2005  he Pull up revisions 1.22-1.23 (requested by rumble in ticket #1054):
Fix the HPC1 transmit logic, which was previously very broken.
 1.20.4.1  24-Jan-2005  he Pull up revision 1.21 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.20.2.2  06-Apr-2005  he Pull up revisions 1.22-1.23 (requested by rumble in ticket #1054):
Fix the HPC1 transmit logic, which was previously very broken.
 1.20.2.1  06-Apr-2005  he Pull up revision 1.21 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
Dragged along for the benefit of ticket #1054 which will be committed shortly.
 1.28.2.3  03-Sep-2007  yamt sync with head.
 1.28.2.2  26-Feb-2007  yamt sync with head.
 1.28.2.1  30-Dec-2006  yamt sync with head.
 1.29.20.1  12-Jan-2007  ad Sync with head.
 1.30.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.30.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.33.62.2  12-Sep-2009  matt Don't cast a paddr if you don't have to.
 1.33.62.1  10-Sep-2009  matt Add preliminary LP64 support for sgimips
 1.33.44.2  11-Aug-2010  yamt sync with head.
 1.33.44.1  11-Mar-2010  yamt sync with head
 1.35.4.2  05-Mar-2011  rmind sync with head
 1.35.4.1  30-May-2010  rmind sync with head
 1.35.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.37.4.2  05-Mar-2011  bouyer Sync with HEAD
 1.37.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.37.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.42.6.1  18-Feb-2012  mrg merge to -current.
 1.42.2.1  17-Apr-2012  yamt sync with head
 1.43.24.4  05-Feb-2017  skrll Sync with HEAD
 1.43.24.3  09-Jul-2016  skrll Sync with HEAD
 1.43.24.2  19-Mar-2016  skrll Sync with HEAD
 1.43.24.1  06-Apr-2015  skrll Sync with HEAD
 1.43.6.1  03-Dec-2017  jdolecek update from HEAD
 1.46.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.48.14.1  28-Jul-2018  pgoyette Sync with HEAD
 1.49.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.49.2.1  10-Jun-2019  christos Sync with HEAD
 1.52.4.1  29-Feb-2020  ad Sync with head.
 1.59.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed