1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Xen network backend - mac client edition.
*
* A driver that sits above an existing GLDv3/Nemo MAC driver and
* relays packets to/from that driver from/to a guest domain.
*/
#ifdef DEBUG
#define XNBO_DEBUG 1
#endif /* DEBUG */
#include "xnb.h"
#include <sys/sunddi.h>
#include <sys/ddi.h>
#include <sys/modctl.h>
#include <sys/strsubr.h>
#include <sys/mac_client.h>
#include <sys/mac_provider.h>
#include <sys/mac_client_priv.h>
#include <sys/mac.h>
#include <net/if.h>
#include <sys/dlpi.h>
#include <sys/pattr.h>
#include <xen/sys/xenbus_impl.h>
#include <xen/sys/xendev.h>
#include <sys/sdt.h>
#include <sys/note.h>
#ifdef XNBO_DEBUG
boolean_t xnbo_cksum_offload_to_peer = B_TRUE;
boolean_t xnbo_cksum_offload_from_peer = B_TRUE;
#endif /* XNBO_DEBUG */
/* Track multicast addresses. */
typedef struct xmca {
struct xmca *next;
ether_addr_t addr;
} xmca_t;
/* State about this device instance. */
typedef struct xnbo {
mac_handle_t o_mh;
mac_client_handle_t o_mch;
mac_unicast_handle_t o_mah;
mac_promisc_handle_t o_mphp;
boolean_t o_running;
boolean_t o_promiscuous;
uint32_t o_hcksum_capab;
xmca_t *o_mca;
char o_link_name[LIFNAMSIZ];
boolean_t o_need_rx_filter;
boolean_t o_need_setphysaddr;
boolean_t o_multicast_control;
} xnbo_t;
static void xnbo_close_mac(xnb_t *);
static void i_xnbo_close_mac(xnb_t *, boolean_t);
/*
* Packets from the peer come here. We pass them to the mac device.
*/
static void
xnbo_to_mac(xnb_t *xnbp, mblk_t *mp)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
ASSERT(mp != NULL);
if (!xnbop->o_running) {
xnbp->xnb_stat_tx_too_early++;
goto fail;
}
if (mac_tx(xnbop->o_mch, mp, 0,
MAC_DROP_ON_NO_DESC, NULL) != NULL) {
xnbp->xnb_stat_mac_full++;
}
return;
fail:
freemsgchain(mp);
}
/*
* Process the checksum flags `flags' provided by the peer for the
* packet `mp'.
*/
static mblk_t *
xnbo_cksum_from_peer(xnb_t *xnbp, mblk_t *mp, uint16_t flags)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
ASSERT(mp->b_next == NULL);
if ((flags & NETTXF_csum_blank) != 0) {
uint32_t capab = xnbop->o_hcksum_capab;
#ifdef XNBO_DEBUG
if (!xnbo_cksum_offload_from_peer)
capab = 0;
#endif /* XNBO_DEBUG */
/*
* The checksum in the packet is blank. Determine
* whether we can do hardware offload and, if so,
* update the flags on the mblk according. If not,
* calculate and insert the checksum using software.
*/
mp = xnb_process_cksum_flags(xnbp, mp, capab);
}
return (mp);
}
/*
* Calculate the checksum flags to be relayed to the peer for the
* packet `mp'.
*/
static uint16_t
xnbo_cksum_to_peer(xnb_t *xnbp, mblk_t *mp)
{
_NOTE(ARGUNUSED(xnbp));
uint16_t r = 0;
uint32_t pflags, csum;
#ifdef XNBO_DEBUG
if (!xnbo_cksum_offload_to_peer)
return (0);
#endif /* XNBO_DEBUG */
/*
* We might also check for HCK_PARTIALCKSUM here and,
* providing that the partial checksum covers the TCP/UDP
* payload, return NETRXF_data_validated.
*
* It seems that it's probably not worthwhile, as even MAC
* devices which advertise HCKSUM_INET_PARTIAL in their
* capabilities tend to use HCK_FULLCKSUM on the receive side
* - they are actually saying that in the output path the
* caller must use HCK_PARTIALCKSUM.
*
* Then again, if a NIC supports HCK_PARTIALCKSUM in its'
* output path, the host IP stack will use it. If such packets
* are destined for the peer (i.e. looped around) we would
* gain some advantage.
*/
mac_hcksum_get(mp, NULL, NULL, NULL, &csum, &pflags);
/*
* If the MAC driver has asserted that the checksum is
* good, let the peer know.
*/
if (((pflags & HCK_FULLCKSUM) != 0) &&
(((pflags & HCK_FULLCKSUM_OK) != 0) ||
(csum == 0xffff)))
r |= NETRXF_data_validated;
return (r);
}
/*
* Packets from the mac device come here. We pass them to the peer.
*/
/*ARGSUSED*/
static void
xnbo_from_mac(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
boolean_t loopback)
{
xnb_t *xnbp = arg;
mp = xnb_copy_to_peer(xnbp, mp);
if (mp != NULL)
freemsgchain(mp);
}
/*
* Packets from the mac device come here. We pass them to the peer if
* the destination mac address matches or it's a multicast/broadcast
* address.
*/
static void
xnbo_from_mac_filter(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
boolean_t loopback)
{
_NOTE(ARGUNUSED(loopback));
xnb_t *xnbp = arg;
xnbo_t *xnbop = xnbp->xnb_flavour_data;
mblk_t *next, *keep, *keep_head, *free, *free_head;
keep = keep_head = free = free_head = NULL;
#define ADD(list, bp) \
if (list != NULL) \
list->b_next = bp; \
else \
list##_head = bp; \
list = bp;
for (; mp != NULL; mp = next) {
mac_header_info_t hdr_info;
next = mp->b_next;
mp->b_next = NULL;
if (mac_header_info(xnbop->o_mh, mp, &hdr_info) != 0) {
ADD(free, mp);
continue;
}
if ((hdr_info.mhi_dsttype == MAC_ADDRTYPE_BROADCAST) ||
(hdr_info.mhi_dsttype == MAC_ADDRTYPE_MULTICAST)) {
ADD(keep, mp);
continue;
}
if (bcmp(hdr_info.mhi_daddr, xnbp->xnb_mac_addr,
sizeof (xnbp->xnb_mac_addr)) == 0) {
ADD(keep, mp);
continue;
}
ADD(free, mp);
}
#undef ADD
if (keep_head != NULL)
xnbo_from_mac(xnbp, mrh, keep_head, B_FALSE);
if (free_head != NULL)
freemsgchain(free_head);
}
static boolean_t
xnbo_open_mac(xnb_t *xnbp, char *mac)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
int err;
const mac_info_t *mi;
void (*rx_fn)(void *, mac_resource_handle_t, mblk_t *, boolean_t);
struct ether_addr ea;
uint_t max_sdu;
mac_diag_t diag;
if ((err = mac_open_by_linkname(mac, &xnbop->o_mh)) != 0) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"cannot open mac for link %s (%d)", mac, err);
return (B_FALSE);
}
ASSERT(xnbop->o_mh != NULL);
mi = mac_info(xnbop->o_mh);
ASSERT(mi != NULL);
if (mi->mi_media != DL_ETHER) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"device is not DL_ETHER (%d)", mi->mi_media);
i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
if (mi->mi_media != mi->mi_nativemedia) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"device media and native media mismatch (%d != %d)",
mi->mi_media, mi->mi_nativemedia);
i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
mac_sdu_get(xnbop->o_mh, NULL, &max_sdu);
if (max_sdu > XNBMAXPKT) {
cmn_err(CE_WARN, "xnbo_open_mac: mac device SDU too big (%d)",
max_sdu);
i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
/*
* MAC_OPEN_FLAGS_MULTI_PRIMARY is relevant when we are migrating a
* guest on the localhost itself. In this case we would have the MAC
* client open for the guest being migrated *and* also for the
* migrated guest (i.e. the former will be active till the migration
* is complete when the latter will be activated). This flag states
* that it is OK for mac_unicast_add to add the primary MAC unicast
* address multiple times.
*/
if (mac_client_open(xnbop->o_mh, &xnbop->o_mch, NULL,
MAC_OPEN_FLAGS_USE_DATALINK_NAME |
MAC_OPEN_FLAGS_MULTI_PRIMARY) != 0) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"error (%d) opening mac client", err);
i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
if (xnbop->o_need_rx_filter)
rx_fn = xnbo_from_mac_filter;
else
rx_fn = xnbo_from_mac;
err = mac_unicast_add_set_rx(xnbop->o_mch, NULL, MAC_UNICAST_PRIMARY,
&xnbop->o_mah, 0, &diag, xnbop->o_multicast_control ? rx_fn : NULL,
xnbp);
if (err != 0) {
cmn_err(CE_WARN, "xnbo_open_mac: failed to get the primary "
"MAC address of %s: %d", mac, err);
i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
if (!xnbop->o_multicast_control) {
err = mac_promisc_add(xnbop->o_mch, MAC_CLIENT_PROMISC_ALL,
rx_fn, xnbp, &xnbop->o_mphp, MAC_PROMISC_FLAGS_NO_TX_LOOP |
MAC_PROMISC_FLAGS_VLAN_TAG_STRIP);
if (err != 0) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"cannot enable promiscuous mode of %s: %d",
mac, err);
i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
xnbop->o_promiscuous = B_TRUE;
}
if (xnbop->o_need_setphysaddr) {
err = mac_unicast_primary_set(xnbop->o_mh, xnbp->xnb_mac_addr);
/* Warn, but continue on. */
if (err != 0) {
bcopy(xnbp->xnb_mac_addr, ea.ether_addr_octet,
ETHERADDRL);
cmn_err(CE_WARN, "xnbo_open_mac: "
"cannot set MAC address of %s to "
"%s: %d", mac, ether_sprintf(&ea), err);
}
}
if (!mac_capab_get(xnbop->o_mh, MAC_CAPAB_HCKSUM,
&xnbop->o_hcksum_capab))
xnbop->o_hcksum_capab = 0;
xnbop->o_running = B_TRUE;
return (B_TRUE);
}
static void
xnbo_close_mac(xnb_t *xnbp)
{
i_xnbo_close_mac(xnbp, B_FALSE);
}
static void
i_xnbo_close_mac(xnb_t *xnbp, boolean_t locked)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
xmca_t *loop;
ASSERT(!locked || MUTEX_HELD(&xnbp->xnb_state_lock));
if (xnbop->o_mh == NULL)
return;
if (xnbop->o_running)
xnbop->o_running = B_FALSE;
if (!locked)
mutex_enter(&xnbp->xnb_state_lock);
loop = xnbop->o_mca;
xnbop->o_mca = NULL;
if (!locked)
mutex_exit(&xnbp->xnb_state_lock);
while (loop != NULL) {
xmca_t *next = loop->next;
DTRACE_PROBE3(mcast_remove,
(char *), "close",
(void *), xnbp,
(etheraddr_t *), loop->addr);
(void) mac_multicast_remove(xnbop->o_mch, loop->addr);
kmem_free(loop, sizeof (*loop));
loop = next;
}
if (xnbop->o_promiscuous) {
if (xnbop->o_mphp != NULL) {
mac_promisc_remove(xnbop->o_mphp);
xnbop->o_mphp = NULL;
}
xnbop->o_promiscuous = B_FALSE;
} else {
if (xnbop->o_mch != NULL)
mac_rx_clear(xnbop->o_mch);
}
if (xnbop->o_mah != NULL) {
(void) mac_unicast_remove(xnbop->o_mch, xnbop->o_mah);
xnbop->o_mah = NULL;
}
if (xnbop->o_mch != NULL) {
mac_client_close(xnbop->o_mch, 0);
xnbop->o_mch = NULL;
}
mac_close(xnbop->o_mh);
xnbop->o_mh = NULL;
}
/*
* Hotplug has completed and we are connected to the peer. We have all
* the information we need to exchange traffic, so open the MAC device
* and configure it appropriately.
*/
static boolean_t
xnbo_start_connect(xnb_t *xnbp)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
return (xnbo_open_mac(xnbp, xnbop->o_link_name));
}
/*
* The guest has successfully synchronize with this instance. We read
* the configuration of the guest from xenstore to check whether the
* guest requests multicast control. If not (the default) we make a
* note that the MAC device needs to be used in promiscious mode.
*/
static boolean_t
xnbo_peer_connected(xnb_t *xnbp)
{
char *oename;
int request;
xnbo_t *xnbop = xnbp->xnb_flavour_data;
oename = xvdi_get_oename(xnbp->xnb_devinfo);
if (xenbus_scanf(XBT_NULL, oename,
"request-multicast-control", "%d", &request) != 0)
request = 0;
xnbop->o_multicast_control = (request > 0);
return (B_TRUE);
}
/*
* The guest domain has closed down the inter-domain connection. We
* close the underlying MAC device.
*/
static void
xnbo_peer_disconnected(xnb_t *xnbp)
{
xnbo_close_mac(xnbp);
}
/*
* The hotplug script has completed. We read information from xenstore
* about our configuration, most notably the name of the MAC device we
* should use.
*/
static boolean_t
xnbo_hotplug_connected(xnb_t *xnbp)
{
char *xsname;
xnbo_t *xnbop = xnbp->xnb_flavour_data;
int need;
xsname = xvdi_get_xsname(xnbp->xnb_devinfo);
if (xenbus_scanf(XBT_NULL, xsname,
"nic", "%s", xnbop->o_link_name) != 0) {
cmn_err(CE_WARN, "xnbo_connect: "
"cannot read nic name from %s", xsname);
return (B_FALSE);
}
if (xenbus_scanf(XBT_NULL, xsname,
"SUNW-need-rx-filter", "%d", &need) != 0)
need = 0;
xnbop->o_need_rx_filter = (need > 0);
if (xenbus_scanf(XBT_NULL, xsname,
"SUNW-need-set-physaddr", "%d", &need) != 0)
need = 0;
xnbop->o_need_setphysaddr = (need > 0);
return (B_TRUE);
}
/*
* Find the multicast address `addr', return B_TRUE if it is one that
* we receive. If `remove', remove it from the set received.
*/
static boolean_t
xnbo_mcast_find(xnb_t *xnbp, ether_addr_t *addr, boolean_t remove)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
xmca_t *prev, *del, *this;
ASSERT(MUTEX_HELD(&xnbp->xnb_state_lock));
ASSERT(xnbop->o_promiscuous == B_FALSE);
prev = del = NULL;
this = xnbop->o_mca;
while (this != NULL) {
if (bcmp(&this->addr, addr, sizeof (this->addr)) == 0) {
del = this;
if (remove) {
if (prev == NULL)
xnbop->o_mca = this->next;
else
prev->next = this->next;
}
break;
}
prev = this;
this = this->next;
}
if (del == NULL)
return (B_FALSE);
if (remove) {
DTRACE_PROBE3(mcast_remove,
(char *), "remove",
(void *), xnbp,
(etheraddr_t *), del->addr);
mac_multicast_remove(xnbop->o_mch, del->addr);
kmem_free(del, sizeof (*del));
}
return (B_TRUE);
}
/*
* Add the multicast address `addr' to the set received.
*/
static boolean_t
xnbo_mcast_add(xnb_t *xnbp, ether_addr_t *addr)
{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
boolean_t r = B_FALSE;
ASSERT(xnbop->o_promiscuous == B_FALSE);
mutex_enter(&xnbp->xnb_state_lock);
if (xnbo_mcast_find(xnbp, addr, B_FALSE)) {
r = B_TRUE;
} else if (mac_multicast_add(xnbop->o_mch,
(const uint8_t *)addr) == 0) {
xmca_t *mca;
DTRACE_PROBE3(mcast_add,
(char *), "add",
(void *), xnbp,
(etheraddr_t *), addr);
mca = kmem_alloc(sizeof (*mca), KM_SLEEP);
bcopy(addr, &mca->addr, sizeof (mca->addr));
mca->next = xnbop->o_mca;
xnbop->o_mca = mca;
r = B_TRUE;
}
mutex_exit(&xnbp->xnb_state_lock);
return (r);
}
/*
* Remove the multicast address `addr' from the set received.
*/
static boolean_t
xnbo_mcast_del(xnb_t *xnbp, ether_addr_t *addr)
{
boolean_t r;
mutex_enter(&xnbp->xnb_state_lock);
r = xnbo_mcast_find(xnbp, addr, B_TRUE);
mutex_exit(&xnbp->xnb_state_lock);
return (r);
}
static int
xnbo_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
{
static xnb_flavour_t flavour = {
xnbo_to_mac, xnbo_peer_connected, xnbo_peer_disconnected,
xnbo_hotplug_connected, xnbo_start_connect,
xnbo_cksum_from_peer, xnbo_cksum_to_peer,
xnbo_mcast_add, xnbo_mcast_del,
};
xnbo_t *xnbop;
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
xnbop = kmem_zalloc(sizeof (*xnbop), KM_SLEEP);
if (xnb_attach(dip, &flavour, xnbop) != DDI_SUCCESS) {
kmem_free(xnbop, sizeof (*xnbop));
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
xnbo_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
{
xnb_t *xnbp = ddi_get_driver_private(dip);
xnbo_t *xnbop = xnbp->xnb_flavour_data;
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
mutex_enter(&xnbp->xnb_tx_lock);
mutex_enter(&xnbp->xnb_rx_lock);
if (!xnbp->xnb_detachable || xnbp->xnb_connected ||
(xnbp->xnb_tx_buf_count > 0)) {
mutex_exit(&xnbp->xnb_rx_lock);
mutex_exit(&xnbp->xnb_tx_lock);
return (DDI_FAILURE);
}
mutex_exit(&xnbp->xnb_rx_lock);
mutex_exit(&xnbp->xnb_tx_lock);
xnbo_close_mac(xnbp);
kmem_free(xnbop, sizeof (*xnbop));
xnb_detach(dip);
return (DDI_SUCCESS);
}
static struct cb_ops cb_ops = {
nulldev, /* open */
nulldev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
0, /* streamtab */
D_NEW | D_MP | D_64BIT /* Driver compatibility flag */
};
static struct dev_ops ops = {
DEVO_REV, /* devo_rev */
0, /* devo_refcnt */
nulldev, /* devo_getinfo */
nulldev, /* devo_identify */
nulldev, /* devo_probe */
xnbo_attach, /* devo_attach */
xnbo_detach, /* devo_detach */
nodev, /* devo_reset */
&cb_ops, /* devo_cb_ops */
(struct bus_ops *)0, /* devo_bus_ops */
NULL, /* devo_power */
ddi_quiesce_not_needed, /* devo_quiesce */
};
static struct modldrv modldrv = {
&mod_driverops, "xnbo driver", &ops,
};
static struct modlinkage modlinkage = {
MODREV_1, &modldrv, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
|