Deleted Added
full compact
ubsec.c (109094) ubsec.c (109595)
1/* $FreeBSD: head/sys/dev/ubsec/ubsec.c 109094 2003-01-11 04:55:52Z sam $ */
1/* $FreeBSD: head/sys/dev/ubsec/ubsec.c 109595 2003-01-20 21:07:30Z sam $ */
2/* $OpenBSD: ubsec.c,v 1.115 2002/09/24 18:33:26 jason Exp $ */
3
4/*
5 * Copyright (c) 2000 Jason L. Wright (jason@thought.net)
6 * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org)
7 * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com)
8 *
9 * All rights reserved.

--- 145 unchanged lines hidden (view full) ---

155static int ubsec_kprocess_modexp_hw(struct ubsec_softc *, struct cryptkop *, int);
156static int ubsec_kprocess_modexp_sw(struct ubsec_softc *, struct cryptkop *, int);
157static int ubsec_kprocess_rsapriv(struct ubsec_softc *, struct cryptkop *, int);
158static void ubsec_kfree(struct ubsec_softc *, struct ubsec_q2 *);
159static int ubsec_ksigbits(struct crparam *);
160static void ubsec_kshift_r(u_int, u_int8_t *, u_int, u_int8_t *, u_int);
161static void ubsec_kshift_l(u_int, u_int8_t *, u_int, u_int8_t *, u_int);
162
2/* $OpenBSD: ubsec.c,v 1.115 2002/09/24 18:33:26 jason Exp $ */
3
4/*
5 * Copyright (c) 2000 Jason L. Wright (jason@thought.net)
6 * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org)
7 * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com)
8 *
9 * All rights reserved.

--- 145 unchanged lines hidden (view full) ---

155static int ubsec_kprocess_modexp_hw(struct ubsec_softc *, struct cryptkop *, int);
156static int ubsec_kprocess_modexp_sw(struct ubsec_softc *, struct cryptkop *, int);
157static int ubsec_kprocess_rsapriv(struct ubsec_softc *, struct cryptkop *, int);
158static void ubsec_kfree(struct ubsec_softc *, struct ubsec_q2 *);
159static int ubsec_ksigbits(struct crparam *);
160static void ubsec_kshift_r(u_int, u_int8_t *, u_int, u_int8_t *, u_int);
161static void ubsec_kshift_l(u_int, u_int8_t *, u_int, u_int8_t *, u_int);
162
163SYSCTL_NODE(_hw, OID_AUTO, ubsec, CTLFLAG_RD, 0, "Broadcom driver parameters");
164
163#ifdef UBSEC_DEBUG
164static void ubsec_dump_pb(volatile struct ubsec_pktbuf *);
165static void ubsec_dump_mcr(struct ubsec_mcr *);
166static void ubsec_dump_ctx2(struct ubsec_ctx_keyop *);
167
168static int ubsec_debug = 0;
165#ifdef UBSEC_DEBUG
166static void ubsec_dump_pb(volatile struct ubsec_pktbuf *);
167static void ubsec_dump_mcr(struct ubsec_mcr *);
168static void ubsec_dump_ctx2(struct ubsec_ctx_keyop *);
169
170static int ubsec_debug = 0;
169SYSCTL_INT(_debug, OID_AUTO, ubsec, CTLFLAG_RW, &ubsec_debug,
170 0, "UBSEC driver debugging printfs");
171SYSCTL_INT(_hw_ubsec, OID_AUTO, debug, CTLFLAG_RW, &ubsec_debug,
172 0, "control debugging msgs");
171#endif
172
173#define READ_REG(sc,r) \
174 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (r))
175
176#define WRITE_REG(sc,reg,val) \
177 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, reg, val)
178
179#define SWAP32(x) (x) = htole32(ntohl((x)))
180#define HTOLE32(x) (x) = htole32(x)
181
173#endif
174
175#define READ_REG(sc,r) \
176 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (r))
177
178#define WRITE_REG(sc,reg,val) \
179 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, reg, val)
180
181#define SWAP32(x) (x) = htole32(ntohl((x)))
182#define HTOLE32(x) (x) = htole32(x)
183
182
183struct ubsec_stats ubsecstats;
184struct ubsec_stats ubsecstats;
184SYSCTL_STRUCT(_kern, OID_AUTO, ubsec_stats, CTLFLAG_RD, &ubsecstats,
185 ubsec_stats, "Broadcom driver statistics");
185SYSCTL_STRUCT(_hw_ubsec, OID_AUTO, stats, CTLFLAG_RD, &ubsecstats,
186 ubsec_stats, "driver statistics");
186/*
187 * ubsec_maxbatch controls the number of crypto ops to voluntarily
188 * collect into one submission to the hardware. This batching happens
189 * when ops are dispatched from the crypto subsystem with a hint that
190 * more are to follow immediately. These ops must also not be marked
191 * with a ``no delay'' flag.
192 */
193static int ubsec_maxbatch = 1;
187/*
188 * ubsec_maxbatch controls the number of crypto ops to voluntarily
189 * collect into one submission to the hardware. This batching happens
190 * when ops are dispatched from the crypto subsystem with a hint that
191 * more are to follow immediately. These ops must also not be marked
192 * with a ``no delay'' flag.
193 */
194static int ubsec_maxbatch = 1;
194SYSCTL_INT(_kern, OID_AUTO, ubsec_maxbatch, CTLFLAG_RW, &ubsec_maxbatch,
195 0, "Broadcom driver: max ops to batch w/o interrupt");
195SYSCTL_INT(_hw_ubsec, OID_AUTO, maxbatch, CTLFLAG_RW, &ubsec_maxbatch,
196 0, "max ops to batch w/o interrupt");
196/*
197 * ubsec_maxaggr controls the number of crypto ops to submit to the
198 * hardware as a unit. This aggregation reduces the number of interrupts
199 * to the host at the expense of increased latency (for all but the last
200 * operation). For network traffic setting this to one yields the highest
201 * performance but at the expense of more interrupt processing.
202 */
203static int ubsec_maxaggr = 1;
197/*
198 * ubsec_maxaggr controls the number of crypto ops to submit to the
199 * hardware as a unit. This aggregation reduces the number of interrupts
200 * to the host at the expense of increased latency (for all but the last
201 * operation). For network traffic setting this to one yields the highest
202 * performance but at the expense of more interrupt processing.
203 */
204static int ubsec_maxaggr = 1;
204SYSCTL_INT(_kern, OID_AUTO, ubsec_maxaggr, CTLFLAG_RW, &ubsec_maxaggr,
205 0, "Broadcom driver: max ops to aggregate under one interrupt");
205SYSCTL_INT(_hw_ubsec, OID_AUTO, maxaggr, CTLFLAG_RW, &ubsec_maxaggr,
206 0, "max ops to aggregate under one interrupt");
206
207static int
208ubsec_probe(device_t dev)
209{
210 if (pci_get_vendor(dev) == PCI_VENDOR_BLUESTEEL &&
211 (pci_get_device(dev) == PCI_PRODUCT_BLUESTEEL_5501 ||
212 pci_get_device(dev) == PCI_PRODUCT_BLUESTEEL_5601))
213 return (0);

--- 2635 unchanged lines hidden ---
207
208static int
209ubsec_probe(device_t dev)
210{
211 if (pci_get_vendor(dev) == PCI_VENDOR_BLUESTEEL &&
212 (pci_get_device(dev) == PCI_PRODUCT_BLUESTEEL_5501 ||
213 pci_get_device(dev) == PCI_PRODUCT_BLUESTEEL_5601))
214 return (0);

--- 2635 unchanged lines hidden ---