2 * Copyright IBM Corp. 2007, 2009
3 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>,
4 * Frank Pavlic <fpavlic@de.ibm.com>,
5 * Thomas Spatzier <tspat@de.ibm.com>,
6 * Frank Blaschka <frank.blaschka@de.ibm.com>
9 #define KMSG_COMPONENT "qeth"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 #include <linux/module.h>
13 #include <linux/moduleparam.h>
14 #include <linux/string.h>
15 #include <linux/errno.h>
16 #include <linux/kernel.h>
17 #include <linux/slab.h>
18 #include <linux/etherdevice.h>
19 #include <linux/mii.h>
21 #include <linux/list.h>
23 #include "qeth_core.h"
26 static int qeth_l2_set_offline(struct ccwgroup_device
*);
27 static int qeth_l2_stop(struct net_device
*);
28 static int qeth_l2_send_delmac(struct qeth_card
*, __u8
*);
29 static int qeth_l2_send_setdelmac(struct qeth_card
*, __u8
*,
31 static void qeth_l2_set_multicast_list(struct net_device
*);
32 static int qeth_l2_recover(void *);
33 static void qeth_bridgeport_query_support(struct qeth_card
*card
);
34 static void qeth_bridge_state_change(struct qeth_card
*card
,
35 struct qeth_ipa_cmd
*cmd
);
36 static void qeth_bridge_host_event(struct qeth_card
*card
,
37 struct qeth_ipa_cmd
*cmd
);
39 static int qeth_l2_do_ioctl(struct net_device
*dev
, struct ifreq
*rq
, int cmd
)
41 struct qeth_card
*card
= dev
->ml_priv
;
42 struct mii_ioctl_data
*mii_data
;
48 if (!qeth_card_hw_is_reachable(card
))
51 if (card
->info
.type
== QETH_CARD_TYPE_OSN
)
55 case SIOC_QETH_ADP_SET_SNMP_CONTROL
:
56 rc
= qeth_snmp_command(card
, rq
->ifr_ifru
.ifru_data
);
58 case SIOC_QETH_GET_CARD_TYPE
:
59 if ((card
->info
.type
== QETH_CARD_TYPE_OSD
||
60 card
->info
.type
== QETH_CARD_TYPE_OSM
||
61 card
->info
.type
== QETH_CARD_TYPE_OSX
) &&
67 mii_data
= if_mii(rq
);
71 mii_data
= if_mii(rq
);
72 if (mii_data
->phy_id
!= 0)
75 mii_data
->val_out
= qeth_mdio_read(dev
,
76 mii_data
->phy_id
, mii_data
->reg_num
);
78 case SIOC_QETH_QUERY_OAT
:
79 rc
= qeth_query_oat_command(card
, rq
->ifr_ifru
.ifru_data
);
85 QETH_CARD_TEXT_(card
, 2, "ioce%d", rc
);
89 static int qeth_l2_verify_dev(struct net_device
*dev
)
91 struct qeth_card
*card
;
95 read_lock_irqsave(&qeth_core_card_list
.rwlock
, flags
);
96 list_for_each_entry(card
, &qeth_core_card_list
.list
, list
) {
97 if (card
->dev
== dev
) {
102 read_unlock_irqrestore(&qeth_core_card_list
.rwlock
, flags
);
107 static struct net_device
*qeth_l2_netdev_by_devno(unsigned char *read_dev_no
)
109 struct qeth_card
*card
;
110 struct net_device
*ndev
;
113 struct ccw_dev_id read_devid
;
116 memcpy(&temp_dev_no
, read_dev_no
, 2);
117 read_lock_irqsave(&qeth_core_card_list
.rwlock
, flags
);
118 list_for_each_entry(card
, &qeth_core_card_list
.list
, list
) {
119 ccw_device_get_id(CARD_RDEV(card
), &read_devid
);
120 if (read_devid
.devno
== temp_dev_no
) {
125 read_unlock_irqrestore(&qeth_core_card_list
.rwlock
, flags
);
129 static int qeth_setdel_makerc(struct qeth_card
*card
, int retcode
)
134 QETH_CARD_TEXT_(card
, 2, "err%04x", retcode
);
139 case IPA_RC_L2_UNSUPPORTED_CMD
:
142 case IPA_RC_L2_ADDR_TABLE_FULL
:
145 case IPA_RC_L2_DUP_MAC
:
146 case IPA_RC_L2_DUP_LAYER3_MAC
:
149 case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP
:
150 case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP
:
153 case IPA_RC_L2_MAC_NOT_FOUND
:
166 static int qeth_l2_send_setgroupmac(struct qeth_card
*card
, __u8
*mac
)
170 QETH_CARD_TEXT(card
, 2, "L2Sgmac");
171 rc
= qeth_setdel_makerc(card
, qeth_l2_send_setdelmac(card
, mac
,
174 QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s\n",
175 mac
, QETH_CARD_IFNAME(card
));
177 QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %d\n",
178 mac
, QETH_CARD_IFNAME(card
), rc
);
182 static int qeth_l2_send_delgroupmac(struct qeth_card
*card
, __u8
*mac
)
186 QETH_CARD_TEXT(card
, 2, "L2Dgmac");
187 rc
= qeth_setdel_makerc(card
, qeth_l2_send_setdelmac(card
, mac
,
191 "Could not delete group MAC %pM on %s: %d\n",
192 mac
, QETH_CARD_IFNAME(card
), rc
);
196 static void qeth_l2_add_mc(struct qeth_card
*card
, __u8
*mac
, int vmac
)
198 struct qeth_mc_mac
*mc
;
201 mc
= kmalloc(sizeof(struct qeth_mc_mac
), GFP_ATOMIC
);
206 memcpy(mc
->mc_addr
, mac
, OSA_ADDR_LEN
);
207 mc
->mc_addrlen
= OSA_ADDR_LEN
;
211 rc
= qeth_setdel_makerc(card
,
212 qeth_l2_send_setdelmac(card
, mac
, IPA_CMD_SETVMAC
));
214 rc
= qeth_setdel_makerc(card
,
215 qeth_l2_send_setgroupmac(card
, mac
));
219 list_add_tail(&mc
->list
, &card
->mc_list
);
224 static void qeth_l2_del_all_mc(struct qeth_card
*card
, int del
)
226 struct qeth_mc_mac
*mc
, *tmp
;
228 spin_lock_bh(&card
->mclock
);
229 list_for_each_entry_safe(mc
, tmp
, &card
->mc_list
, list
) {
232 qeth_l2_send_setdelmac(card
, mc
->mc_addr
,
235 qeth_l2_send_delgroupmac(card
, mc
->mc_addr
);
240 spin_unlock_bh(&card
->mclock
);
243 static inline int qeth_l2_get_cast_type(struct qeth_card
*card
,
246 if (card
->info
.type
== QETH_CARD_TYPE_OSN
)
248 if (is_broadcast_ether_addr(skb
->data
))
249 return RTN_BROADCAST
;
250 if (is_multicast_ether_addr(skb
->data
))
251 return RTN_MULTICAST
;
255 static void qeth_l2_fill_header(struct qeth_card
*card
, struct qeth_hdr
*hdr
,
256 struct sk_buff
*skb
, int cast_type
)
258 struct vlan_ethhdr
*veth
= (struct vlan_ethhdr
*)skb_mac_header(skb
);
260 memset(hdr
, 0, sizeof(struct qeth_hdr
));
261 hdr
->hdr
.l2
.id
= QETH_HEADER_TYPE_LAYER2
;
263 /* set byte byte 3 to casting flags */
264 if (cast_type
== RTN_MULTICAST
)
265 hdr
->hdr
.l2
.flags
[2] |= QETH_LAYER2_FLAG_MULTICAST
;
266 else if (cast_type
== RTN_BROADCAST
)
267 hdr
->hdr
.l2
.flags
[2] |= QETH_LAYER2_FLAG_BROADCAST
;
269 hdr
->hdr
.l2
.flags
[2] |= QETH_LAYER2_FLAG_UNICAST
;
271 hdr
->hdr
.l2
.pkt_length
= skb
->len
-QETH_HEADER_SIZE
;
272 /* VSWITCH relies on the VLAN
273 * information to be present in
275 if (veth
->h_vlan_proto
== __constant_htons(ETH_P_8021Q
)) {
276 hdr
->hdr
.l2
.flags
[2] |= QETH_LAYER2_FLAG_VLAN
;
277 hdr
->hdr
.l2
.vlan_id
= ntohs(veth
->h_vlan_TCI
);
281 static int qeth_l2_send_setdelvlan_cb(struct qeth_card
*card
,
282 struct qeth_reply
*reply
, unsigned long data
)
284 struct qeth_ipa_cmd
*cmd
;
286 QETH_CARD_TEXT(card
, 2, "L2sdvcb");
287 cmd
= (struct qeth_ipa_cmd
*) data
;
288 if (cmd
->hdr
.return_code
) {
289 QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on %s: 0x%x. "
290 "Continuing\n", cmd
->data
.setdelvlan
.vlan_id
,
291 QETH_CARD_IFNAME(card
), cmd
->hdr
.return_code
);
292 QETH_CARD_TEXT_(card
, 2, "L2VL%4x", cmd
->hdr
.command
);
293 QETH_CARD_TEXT_(card
, 2, "err%d", cmd
->hdr
.return_code
);
298 static int qeth_l2_send_setdelvlan(struct qeth_card
*card
, __u16 i
,
299 enum qeth_ipa_cmds ipacmd
)
301 struct qeth_ipa_cmd
*cmd
;
302 struct qeth_cmd_buffer
*iob
;
304 QETH_CARD_TEXT_(card
, 4, "L2sdv%x", ipacmd
);
305 iob
= qeth_get_ipacmd_buffer(card
, ipacmd
, QETH_PROT_IPV4
);
308 cmd
= (struct qeth_ipa_cmd
*)(iob
->data
+IPA_PDU_HEADER_SIZE
);
309 cmd
->data
.setdelvlan
.vlan_id
= i
;
310 return qeth_send_ipa_cmd(card
, iob
,
311 qeth_l2_send_setdelvlan_cb
, NULL
);
314 static void qeth_l2_process_vlans(struct qeth_card
*card
)
316 struct qeth_vlan_vid
*id
;
317 QETH_CARD_TEXT(card
, 3, "L2prcvln");
318 spin_lock_bh(&card
->vlanlock
);
319 list_for_each_entry(id
, &card
->vid_list
, list
) {
320 qeth_l2_send_setdelvlan(card
, id
->vid
, IPA_CMD_SETVLAN
);
322 spin_unlock_bh(&card
->vlanlock
);
325 static int qeth_l2_vlan_rx_add_vid(struct net_device
*dev
,
326 __be16 proto
, u16 vid
)
328 struct qeth_card
*card
= dev
->ml_priv
;
329 struct qeth_vlan_vid
*id
;
332 QETH_CARD_TEXT_(card
, 4, "aid:%d", vid
);
335 if (card
->info
.type
== QETH_CARD_TYPE_OSM
) {
336 QETH_CARD_TEXT(card
, 3, "aidOSM");
339 if (qeth_wait_for_threads(card
, QETH_RECOVER_THREAD
)) {
340 QETH_CARD_TEXT(card
, 3, "aidREC");
343 id
= kmalloc(sizeof(struct qeth_vlan_vid
), GFP_ATOMIC
);
346 rc
= qeth_l2_send_setdelvlan(card
, vid
, IPA_CMD_SETVLAN
);
351 spin_lock_bh(&card
->vlanlock
);
352 list_add_tail(&id
->list
, &card
->vid_list
);
353 spin_unlock_bh(&card
->vlanlock
);
360 static int qeth_l2_vlan_rx_kill_vid(struct net_device
*dev
,
361 __be16 proto
, u16 vid
)
363 struct qeth_vlan_vid
*id
, *tmpid
= NULL
;
364 struct qeth_card
*card
= dev
->ml_priv
;
367 QETH_CARD_TEXT_(card
, 4, "kid:%d", vid
);
368 if (card
->info
.type
== QETH_CARD_TYPE_OSM
) {
369 QETH_CARD_TEXT(card
, 3, "kidOSM");
372 if (qeth_wait_for_threads(card
, QETH_RECOVER_THREAD
)) {
373 QETH_CARD_TEXT(card
, 3, "kidREC");
376 spin_lock_bh(&card
->vlanlock
);
377 list_for_each_entry(id
, &card
->vid_list
, list
) {
378 if (id
->vid
== vid
) {
384 spin_unlock_bh(&card
->vlanlock
);
386 rc
= qeth_l2_send_setdelvlan(card
, vid
, IPA_CMD_DELVLAN
);
389 qeth_l2_set_multicast_list(card
->dev
);
393 static int qeth_l2_stop_card(struct qeth_card
*card
, int recovery_mode
)
397 QETH_DBF_TEXT(SETUP
, 2, "stopcard");
398 QETH_DBF_HEX(SETUP
, 2, &card
, sizeof(void *));
400 qeth_set_allowed_threads(card
, 0, 1);
401 if (card
->read
.state
== CH_STATE_UP
&&
402 card
->write
.state
== CH_STATE_UP
&&
403 (card
->state
== CARD_STATE_UP
)) {
405 card
->info
.type
!= QETH_CARD_TYPE_OSN
) {
406 qeth_l2_stop(card
->dev
);
409 dev_close(card
->dev
);
412 card
->info
.mac_bits
&= ~QETH_LAYER2_MAC_REGISTERED
;
413 card
->state
= CARD_STATE_SOFTSETUP
;
415 if (card
->state
== CARD_STATE_SOFTSETUP
) {
416 qeth_l2_del_all_mc(card
, 0);
417 qeth_clear_ipacmd_list(card
);
418 card
->state
= CARD_STATE_HARDSETUP
;
420 if (card
->state
== CARD_STATE_HARDSETUP
) {
421 qeth_qdio_clear_card(card
, 0);
422 qeth_clear_qdio_buffers(card
);
423 qeth_clear_working_pool_list(card
);
424 card
->state
= CARD_STATE_DOWN
;
426 if (card
->state
== CARD_STATE_DOWN
) {
427 qeth_clear_cmd_buffers(&card
->read
);
428 qeth_clear_cmd_buffers(&card
->write
);
433 static int qeth_l2_process_inbound_buffer(struct qeth_card
*card
,
434 int budget
, int *done
)
438 struct qeth_hdr
*hdr
;
442 WARN_ON_ONCE(!budget
);
444 skb
= qeth_core_get_next_skb(card
,
445 &card
->qdio
.in_q
->bufs
[card
->rx
.b_index
],
446 &card
->rx
.b_element
, &card
->rx
.e_offset
, &hdr
);
451 skb
->dev
= card
->dev
;
452 switch (hdr
->hdr
.l2
.id
) {
453 case QETH_HEADER_TYPE_LAYER2
:
454 skb
->pkt_type
= PACKET_HOST
;
455 skb
->protocol
= eth_type_trans(skb
, skb
->dev
);
456 skb
->ip_summed
= CHECKSUM_NONE
;
457 if (skb
->protocol
== htons(ETH_P_802_2
))
458 *((__u32
*)skb
->cb
) = ++card
->seqno
.pkt_seqno
;
460 netif_receive_skb(skb
);
462 case QETH_HEADER_TYPE_OSN
:
463 if (card
->info
.type
== QETH_CARD_TYPE_OSN
) {
464 skb_push(skb
, sizeof(struct qeth_hdr
));
465 skb_copy_to_linear_data(skb
, hdr
,
466 sizeof(struct qeth_hdr
));
468 card
->osn_info
.data_cb(skb
);
473 dev_kfree_skb_any(skb
);
474 QETH_CARD_TEXT(card
, 3, "inbunkno");
475 QETH_DBF_HEX(CTRL
, 3, hdr
, QETH_DBF_CTRL_LEN
);
480 card
->stats
.rx_packets
++;
481 card
->stats
.rx_bytes
+= len
;
486 static int qeth_l2_poll(struct napi_struct
*napi
, int budget
)
488 struct qeth_card
*card
= container_of(napi
, struct qeth_card
, napi
);
490 struct qeth_qdio_buffer
*buffer
;
492 int new_budget
= budget
;
494 if (card
->options
.performance_stats
) {
495 card
->perf_stats
.inbound_cnt
++;
496 card
->perf_stats
.inbound_start_time
= qeth_get_micros();
500 if (!card
->rx
.b_count
) {
501 card
->rx
.qdio_err
= 0;
502 card
->rx
.b_count
= qdio_get_next_buffers(
503 card
->data
.ccwdev
, 0, &card
->rx
.b_index
,
505 if (card
->rx
.b_count
<= 0) {
506 card
->rx
.b_count
= 0;
510 &card
->qdio
.in_q
->bufs
[card
->rx
.b_index
]
512 card
->rx
.e_offset
= 0;
515 while (card
->rx
.b_count
) {
516 buffer
= &card
->qdio
.in_q
->bufs
[card
->rx
.b_index
];
517 if (!(card
->rx
.qdio_err
&&
518 qeth_check_qdio_errors(card
, buffer
->buffer
,
519 card
->rx
.qdio_err
, "qinerr")))
520 work_done
+= qeth_l2_process_inbound_buffer(
521 card
, new_budget
, &done
);
526 if (card
->options
.performance_stats
)
527 card
->perf_stats
.bufs_rec
++;
528 qeth_put_buffer_pool_entry(card
,
530 qeth_queue_input_buffer(card
, card
->rx
.b_index
);
532 if (card
->rx
.b_count
) {
534 (card
->rx
.b_index
+ 1) %
535 QDIO_MAX_BUFFERS_PER_Q
;
538 ->bufs
[card
->rx
.b_index
]
540 card
->rx
.e_offset
= 0;
544 if (work_done
>= budget
)
547 new_budget
= budget
- work_done
;
552 if (qdio_start_irq(card
->data
.ccwdev
, 0))
553 napi_schedule(&card
->napi
);
555 if (card
->options
.performance_stats
)
556 card
->perf_stats
.inbound_time
+= qeth_get_micros() -
557 card
->perf_stats
.inbound_start_time
;
561 static int qeth_l2_send_setdelmac(struct qeth_card
*card
, __u8
*mac
,
562 enum qeth_ipa_cmds ipacmd
)
564 struct qeth_ipa_cmd
*cmd
;
565 struct qeth_cmd_buffer
*iob
;
567 QETH_CARD_TEXT(card
, 2, "L2sdmac");
568 iob
= qeth_get_ipacmd_buffer(card
, ipacmd
, QETH_PROT_IPV4
);
571 cmd
= (struct qeth_ipa_cmd
*)(iob
->data
+IPA_PDU_HEADER_SIZE
);
572 cmd
->data
.setdelmac
.mac_length
= OSA_ADDR_LEN
;
573 memcpy(&cmd
->data
.setdelmac
.mac
, mac
, OSA_ADDR_LEN
);
574 return qeth_send_ipa_cmd(card
, iob
, NULL
, NULL
);
577 static int qeth_l2_send_setmac(struct qeth_card
*card
, __u8
*mac
)
581 QETH_CARD_TEXT(card
, 2, "L2Setmac");
582 rc
= qeth_setdel_makerc(card
, qeth_l2_send_setdelmac(card
, mac
,
585 card
->info
.mac_bits
|= QETH_LAYER2_MAC_REGISTERED
;
586 memcpy(card
->dev
->dev_addr
, mac
, OSA_ADDR_LEN
);
587 dev_info(&card
->gdev
->dev
,
588 "MAC address %pM successfully registered on device %s\n",
589 card
->dev
->dev_addr
, card
->dev
->name
);
591 card
->info
.mac_bits
&= ~QETH_LAYER2_MAC_REGISTERED
;
594 dev_warn(&card
->gdev
->dev
,
595 "MAC address %pM already exists\n", mac
);
598 dev_warn(&card
->gdev
->dev
,
599 "MAC address %pM is not authorized\n", mac
);
606 static int qeth_l2_send_delmac(struct qeth_card
*card
, __u8
*mac
)
610 QETH_CARD_TEXT(card
, 2, "L2Delmac");
611 if (!(card
->info
.mac_bits
& QETH_LAYER2_MAC_REGISTERED
))
613 rc
= qeth_setdel_makerc(card
, qeth_l2_send_setdelmac(card
, mac
,
616 card
->info
.mac_bits
&= ~QETH_LAYER2_MAC_REGISTERED
;
620 static int qeth_l2_request_initial_mac(struct qeth_card
*card
)
623 char vendor_pre
[] = {0x02, 0x00, 0x00};
625 QETH_DBF_TEXT(SETUP
, 2, "doL2init");
626 QETH_DBF_TEXT_(SETUP
, 2, "doL2%s", CARD_BUS_ID(card
));
628 if (qeth_is_supported(card
, IPA_SETADAPTERPARMS
)) {
629 rc
= qeth_query_setadapterparms(card
);
631 QETH_DBF_MESSAGE(2, "could not query adapter "
632 "parameters on device %s: x%x\n",
633 CARD_BUS_ID(card
), rc
);
637 if (card
->info
.type
== QETH_CARD_TYPE_IQD
||
638 card
->info
.type
== QETH_CARD_TYPE_OSM
||
639 card
->info
.type
== QETH_CARD_TYPE_OSX
||
640 card
->info
.guestlan
) {
641 rc
= qeth_setadpparms_change_macaddr(card
);
643 QETH_DBF_MESSAGE(2, "couldn't get MAC address on "
644 "device %s: x%x\n", CARD_BUS_ID(card
), rc
);
645 QETH_DBF_TEXT_(SETUP
, 2, "1err%04x", rc
);
648 QETH_DBF_HEX(SETUP
, 2, card
->dev
->dev_addr
, OSA_ADDR_LEN
);
650 eth_random_addr(card
->dev
->dev_addr
);
651 memcpy(card
->dev
->dev_addr
, vendor_pre
, 3);
656 static int qeth_l2_set_mac_address(struct net_device
*dev
, void *p
)
658 struct sockaddr
*addr
= p
;
659 struct qeth_card
*card
= dev
->ml_priv
;
662 QETH_CARD_TEXT(card
, 3, "setmac");
664 if (qeth_l2_verify_dev(dev
) != QETH_REAL_CARD
) {
665 QETH_CARD_TEXT(card
, 3, "setmcINV");
669 if (card
->info
.type
== QETH_CARD_TYPE_OSN
||
670 card
->info
.type
== QETH_CARD_TYPE_OSM
||
671 card
->info
.type
== QETH_CARD_TYPE_OSX
) {
672 QETH_CARD_TEXT(card
, 3, "setmcTYP");
675 QETH_CARD_HEX(card
, 3, addr
->sa_data
, OSA_ADDR_LEN
);
676 if (qeth_wait_for_threads(card
, QETH_RECOVER_THREAD
)) {
677 QETH_CARD_TEXT(card
, 3, "setmcREC");
680 rc
= qeth_l2_send_delmac(card
, &card
->dev
->dev_addr
[0]);
681 if (!rc
|| (rc
== -ENOENT
))
682 rc
= qeth_l2_send_setmac(card
, addr
->sa_data
);
683 return rc
? -EINVAL
: 0;
686 static void qeth_promisc_to_bridge(struct qeth_card
*card
)
688 struct net_device
*dev
= card
->dev
;
689 enum qeth_ipa_promisc_modes promisc_mode
;
693 QETH_CARD_TEXT(card
, 3, "pmisc2br");
695 if (!card
->options
.sbp
.reflect_promisc
)
697 promisc_mode
= (dev
->flags
& IFF_PROMISC
) ? SET_PROMISC_MODE_ON
698 : SET_PROMISC_MODE_OFF
;
699 if (promisc_mode
== card
->info
.promisc_mode
)
702 if (promisc_mode
== SET_PROMISC_MODE_ON
) {
703 if (card
->options
.sbp
.reflect_promisc_primary
)
704 role
= QETH_SBP_ROLE_PRIMARY
;
706 role
= QETH_SBP_ROLE_SECONDARY
;
708 role
= QETH_SBP_ROLE_NONE
;
710 rc
= qeth_bridgeport_setrole(card
, role
);
711 QETH_DBF_TEXT_(SETUP
, 2, "bpm%c%04x",
712 (promisc_mode
== SET_PROMISC_MODE_ON
) ? '+' : '-', rc
);
714 card
->options
.sbp
.role
= role
;
715 card
->info
.promisc_mode
= promisc_mode
;
719 static void qeth_l2_set_multicast_list(struct net_device
*dev
)
721 struct qeth_card
*card
= dev
->ml_priv
;
722 struct netdev_hw_addr
*ha
;
724 if (card
->info
.type
== QETH_CARD_TYPE_OSN
)
727 QETH_CARD_TEXT(card
, 3, "setmulti");
728 if (qeth_threads_running(card
, QETH_RECOVER_THREAD
) &&
729 (card
->state
!= CARD_STATE_UP
))
731 qeth_l2_del_all_mc(card
, 1);
732 spin_lock_bh(&card
->mclock
);
733 netdev_for_each_mc_addr(ha
, dev
)
734 qeth_l2_add_mc(card
, ha
->addr
, 0);
736 netdev_for_each_uc_addr(ha
, dev
)
737 qeth_l2_add_mc(card
, ha
->addr
, 1);
739 spin_unlock_bh(&card
->mclock
);
740 if (qeth_adp_supported(card
, IPA_SETADP_SET_PROMISC_MODE
))
741 qeth_setadp_promisc_mode(card
);
743 qeth_promisc_to_bridge(card
);
746 static int qeth_l2_hard_start_xmit(struct sk_buff
*skb
, struct net_device
*dev
)
749 struct qeth_hdr
*hdr
= NULL
;
751 struct qeth_card
*card
= dev
->ml_priv
;
752 struct sk_buff
*new_skb
= skb
;
753 int cast_type
= qeth_l2_get_cast_type(card
, skb
);
754 struct qeth_qdio_out_q
*queue
;
755 int tx_bytes
= skb
->len
;
756 int data_offset
= -1;
757 int elements_needed
= 0;
760 if (card
->qdio
.do_prio_queueing
|| (cast_type
&&
761 card
->info
.is_multicast_different
))
762 queue
= card
->qdio
.out_qs
[qeth_get_priority_queue(card
, skb
,
763 qeth_get_ip_version(skb
), cast_type
)];
765 queue
= card
->qdio
.out_qs
[card
->qdio
.default_out_queue
];
767 if ((card
->state
!= CARD_STATE_UP
) || !card
->lan_online
) {
768 card
->stats
.tx_carrier_errors
++;
772 if ((card
->info
.type
== QETH_CARD_TYPE_OSN
) &&
773 (skb
->protocol
== htons(ETH_P_IPV6
)))
776 if (card
->options
.performance_stats
) {
777 card
->perf_stats
.outbound_cnt
++;
778 card
->perf_stats
.outbound_start_time
= qeth_get_micros();
780 netif_stop_queue(dev
);
782 if (card
->info
.type
== QETH_CARD_TYPE_OSN
)
783 hdr
= (struct qeth_hdr
*)skb
->data
;
785 if (card
->info
.type
== QETH_CARD_TYPE_IQD
) {
787 data_offset
= ETH_HLEN
;
789 hdr
= kmem_cache_alloc(qeth_core_header_cache
,
794 skb_reset_mac_header(new_skb
);
795 qeth_l2_fill_header(card
, hdr
, new_skb
, cast_type
);
796 hdr
->hdr
.l2
.pkt_length
= new_skb
->len
;
797 memcpy(((char *)hdr
) + sizeof(struct qeth_hdr
),
798 skb_mac_header(new_skb
), ETH_HLEN
);
800 /* create a clone with writeable headroom */
801 new_skb
= skb_realloc_headroom(skb
,
802 sizeof(struct qeth_hdr
));
805 hdr
= (struct qeth_hdr
*)skb_push(new_skb
,
806 sizeof(struct qeth_hdr
));
807 skb_set_mac_header(new_skb
, sizeof(struct qeth_hdr
));
808 qeth_l2_fill_header(card
, hdr
, new_skb
, cast_type
);
812 elements
= qeth_get_elements_no(card
, new_skb
, elements_needed
);
814 if (data_offset
>= 0)
815 kmem_cache_free(qeth_core_header_cache
, hdr
);
819 if (card
->info
.type
!= QETH_CARD_TYPE_IQD
) {
820 if (qeth_hdr_chk_and_bounce(new_skb
, &hdr
,
821 sizeof(struct qeth_hdr_layer2
)))
823 rc
= qeth_do_send_packet(card
, queue
, new_skb
, hdr
,
826 rc
= qeth_do_send_packet_fast(card
, queue
, new_skb
, hdr
,
827 elements
, data_offset
, hd_len
);
829 card
->stats
.tx_packets
++;
830 card
->stats
.tx_bytes
+= tx_bytes
;
832 dev_kfree_skb_any(skb
);
835 if (data_offset
>= 0)
836 kmem_cache_free(qeth_core_header_cache
, hdr
);
840 dev_kfree_skb_any(new_skb
);
841 return NETDEV_TX_BUSY
;
846 netif_wake_queue(dev
);
847 if (card
->options
.performance_stats
)
848 card
->perf_stats
.outbound_time
+= qeth_get_micros() -
849 card
->perf_stats
.outbound_start_time
;
853 card
->stats
.tx_dropped
++;
854 card
->stats
.tx_errors
++;
855 if ((new_skb
!= skb
) && new_skb
)
856 dev_kfree_skb_any(new_skb
);
857 dev_kfree_skb_any(skb
);
858 netif_wake_queue(dev
);
862 static int __qeth_l2_open(struct net_device
*dev
)
864 struct qeth_card
*card
= dev
->ml_priv
;
867 QETH_CARD_TEXT(card
, 4, "qethopen");
868 if (card
->state
== CARD_STATE_UP
)
870 if (card
->state
!= CARD_STATE_SOFTSETUP
)
873 if ((card
->info
.type
!= QETH_CARD_TYPE_OSN
) &&
874 (!(card
->info
.mac_bits
& QETH_LAYER2_MAC_REGISTERED
))) {
875 QETH_CARD_TEXT(card
, 4, "nomacadr");
878 card
->data
.state
= CH_STATE_UP
;
879 card
->state
= CARD_STATE_UP
;
880 netif_start_queue(dev
);
882 if (qdio_stop_irq(card
->data
.ccwdev
, 0) >= 0) {
883 napi_enable(&card
->napi
);
884 napi_schedule(&card
->napi
);
890 static int qeth_l2_open(struct net_device
*dev
)
892 struct qeth_card
*card
= dev
->ml_priv
;
894 QETH_CARD_TEXT(card
, 5, "qethope_");
895 if (qeth_wait_for_threads(card
, QETH_RECOVER_THREAD
)) {
896 QETH_CARD_TEXT(card
, 3, "openREC");
899 return __qeth_l2_open(dev
);
902 static int qeth_l2_stop(struct net_device
*dev
)
904 struct qeth_card
*card
= dev
->ml_priv
;
906 QETH_CARD_TEXT(card
, 4, "qethstop");
907 netif_tx_disable(dev
);
908 if (card
->state
== CARD_STATE_UP
) {
909 card
->state
= CARD_STATE_SOFTSETUP
;
910 napi_disable(&card
->napi
);
915 static int qeth_l2_probe_device(struct ccwgroup_device
*gdev
)
917 struct qeth_card
*card
= dev_get_drvdata(&gdev
->dev
);
919 qeth_l2_create_device_attributes(&gdev
->dev
);
920 INIT_LIST_HEAD(&card
->vid_list
);
921 INIT_LIST_HEAD(&card
->mc_list
);
922 card
->options
.layer2
= 1;
923 card
->info
.hwtrap
= 0;
927 static void qeth_l2_remove_device(struct ccwgroup_device
*cgdev
)
929 struct qeth_card
*card
= dev_get_drvdata(&cgdev
->dev
);
931 qeth_l2_remove_device_attributes(&cgdev
->dev
);
932 qeth_set_allowed_threads(card
, 0, 1);
933 wait_event(card
->wait_q
, qeth_threads_running(card
, 0xffffffff) == 0);
935 if (cgdev
->state
== CCWGROUP_ONLINE
)
936 qeth_l2_set_offline(cgdev
);
939 unregister_netdev(card
->dev
);
945 static const struct ethtool_ops qeth_l2_ethtool_ops
= {
946 .get_link
= ethtool_op_get_link
,
947 .get_strings
= qeth_core_get_strings
,
948 .get_ethtool_stats
= qeth_core_get_ethtool_stats
,
949 .get_sset_count
= qeth_core_get_sset_count
,
950 .get_drvinfo
= qeth_core_get_drvinfo
,
951 .get_settings
= qeth_core_ethtool_get_settings
,
954 static const struct ethtool_ops qeth_l2_osn_ops
= {
955 .get_strings
= qeth_core_get_strings
,
956 .get_ethtool_stats
= qeth_core_get_ethtool_stats
,
957 .get_sset_count
= qeth_core_get_sset_count
,
958 .get_drvinfo
= qeth_core_get_drvinfo
,
961 static const struct net_device_ops qeth_l2_netdev_ops
= {
962 .ndo_open
= qeth_l2_open
,
963 .ndo_stop
= qeth_l2_stop
,
964 .ndo_get_stats
= qeth_get_stats
,
965 .ndo_start_xmit
= qeth_l2_hard_start_xmit
,
966 .ndo_validate_addr
= eth_validate_addr
,
967 .ndo_set_rx_mode
= qeth_l2_set_multicast_list
,
968 .ndo_do_ioctl
= qeth_l2_do_ioctl
,
969 .ndo_set_mac_address
= qeth_l2_set_mac_address
,
970 .ndo_change_mtu
= qeth_change_mtu
,
971 .ndo_vlan_rx_add_vid
= qeth_l2_vlan_rx_add_vid
,
972 .ndo_vlan_rx_kill_vid
= qeth_l2_vlan_rx_kill_vid
,
973 .ndo_tx_timeout
= qeth_tx_timeout
,
976 static int qeth_l2_setup_netdev(struct qeth_card
*card
)
978 switch (card
->info
.type
) {
979 case QETH_CARD_TYPE_IQD
:
980 card
->dev
= alloc_netdev(0, "hsi%d", NET_NAME_UNKNOWN
,
983 case QETH_CARD_TYPE_OSN
:
984 card
->dev
= alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN
,
986 card
->dev
->flags
|= IFF_NOARP
;
989 card
->dev
= alloc_etherdev(0);
995 card
->dev
->ml_priv
= card
;
996 card
->dev
->watchdog_timeo
= QETH_TX_TIMEOUT
;
997 card
->dev
->mtu
= card
->info
.initial_mtu
;
998 card
->dev
->netdev_ops
= &qeth_l2_netdev_ops
;
999 card
->dev
->ethtool_ops
=
1000 (card
->info
.type
!= QETH_CARD_TYPE_OSN
) ?
1001 &qeth_l2_ethtool_ops
: &qeth_l2_osn_ops
;
1002 card
->dev
->features
|= NETIF_F_HW_VLAN_CTAG_FILTER
;
1003 card
->info
.broadcast_capable
= 1;
1004 qeth_l2_request_initial_mac(card
);
1005 SET_NETDEV_DEV(card
->dev
, &card
->gdev
->dev
);
1006 netif_napi_add(card
->dev
, &card
->napi
, qeth_l2_poll
, QETH_NAPI_WEIGHT
);
1007 return register_netdev(card
->dev
);
1010 static int __qeth_l2_set_online(struct ccwgroup_device
*gdev
, int recovery_mode
)
1012 struct qeth_card
*card
= dev_get_drvdata(&gdev
->dev
);
1014 enum qeth_card_states recover_flag
;
1016 mutex_lock(&card
->discipline_mutex
);
1017 mutex_lock(&card
->conf_mutex
);
1018 QETH_DBF_TEXT(SETUP
, 2, "setonlin");
1019 QETH_DBF_HEX(SETUP
, 2, &card
, sizeof(void *));
1021 recover_flag
= card
->state
;
1022 rc
= qeth_core_hardsetup_card(card
);
1024 QETH_DBF_TEXT_(SETUP
, 2, "2err%04x", rc
);
1028 qeth_bridgeport_query_support(card
);
1029 if (card
->options
.sbp
.supported_funcs
)
1030 dev_info(&card
->gdev
->dev
,
1031 "The device represents a Bridge Capable Port\n");
1032 qeth_trace_features(card
);
1034 if (!card
->dev
&& qeth_l2_setup_netdev(card
)) {
1039 if (card
->info
.type
!= QETH_CARD_TYPE_OSN
)
1040 qeth_l2_send_setmac(card
, &card
->dev
->dev_addr
[0]);
1042 if (qeth_is_diagass_supported(card
, QETH_DIAGS_CMD_TRAP
)) {
1043 if (card
->info
.hwtrap
&&
1044 qeth_hw_trap(card
, QETH_DIAGS_TRAP_ARM
))
1045 card
->info
.hwtrap
= 0;
1047 card
->info
.hwtrap
= 0;
1049 qeth_l2_setup_bridgeport_attrs(card
);
1051 card
->state
= CARD_STATE_HARDSETUP
;
1052 memset(&card
->rx
, 0, sizeof(struct qeth_rx
));
1053 qeth_print_status_message(card
);
1056 QETH_DBF_TEXT(SETUP
, 2, "softsetp");
1058 rc
= qeth_send_startlan(card
);
1060 QETH_DBF_TEXT_(SETUP
, 2, "1err%d", rc
);
1062 dev_warn(&card
->gdev
->dev
,
1063 "The LAN is offline\n");
1064 card
->lan_online
= 0;
1070 card
->lan_online
= 1;
1073 if ((card
->info
.type
== QETH_CARD_TYPE_OSD
) ||
1074 (card
->info
.type
== QETH_CARD_TYPE_OSX
)) {
1075 /* configure isolation level */
1076 rc
= qeth_set_access_ctrl_online(card
, 0);
1083 if (card
->info
.type
!= QETH_CARD_TYPE_OSN
&&
1084 card
->info
.type
!= QETH_CARD_TYPE_OSM
)
1085 qeth_l2_process_vlans(card
);
1087 netif_tx_disable(card
->dev
);
1089 rc
= qeth_init_qdio_queues(card
);
1091 QETH_DBF_TEXT_(SETUP
, 2, "6err%d", rc
);
1095 card
->state
= CARD_STATE_SOFTSETUP
;
1096 if (card
->lan_online
)
1097 netif_carrier_on(card
->dev
);
1099 netif_carrier_off(card
->dev
);
1101 qeth_set_allowed_threads(card
, 0xffffffff, 0);
1102 if (recover_flag
== CARD_STATE_RECOVER
) {
1103 if (recovery_mode
&&
1104 card
->info
.type
!= QETH_CARD_TYPE_OSN
) {
1105 __qeth_l2_open(card
->dev
);
1108 dev_open(card
->dev
);
1111 /* this also sets saved unicast addresses */
1112 qeth_l2_set_multicast_list(card
->dev
);
1114 /* let user_space know that device is online */
1115 kobject_uevent(&gdev
->dev
.kobj
, KOBJ_CHANGE
);
1116 mutex_unlock(&card
->conf_mutex
);
1117 mutex_unlock(&card
->discipline_mutex
);
1121 qeth_l2_stop_card(card
, 0);
1122 ccw_device_set_offline(CARD_DDEV(card
));
1123 ccw_device_set_offline(CARD_WDEV(card
));
1124 ccw_device_set_offline(CARD_RDEV(card
));
1125 qdio_free(CARD_DDEV(card
));
1126 if (recover_flag
== CARD_STATE_RECOVER
)
1127 card
->state
= CARD_STATE_RECOVER
;
1129 card
->state
= CARD_STATE_DOWN
;
1130 mutex_unlock(&card
->conf_mutex
);
1131 mutex_unlock(&card
->discipline_mutex
);
1135 static int qeth_l2_set_online(struct ccwgroup_device
*gdev
)
1137 return __qeth_l2_set_online(gdev
, 0);
1140 static int __qeth_l2_set_offline(struct ccwgroup_device
*cgdev
,
1143 struct qeth_card
*card
= dev_get_drvdata(&cgdev
->dev
);
1144 int rc
= 0, rc2
= 0, rc3
= 0;
1145 enum qeth_card_states recover_flag
;
1147 mutex_lock(&card
->discipline_mutex
);
1148 mutex_lock(&card
->conf_mutex
);
1149 QETH_DBF_TEXT(SETUP
, 3, "setoffl");
1150 QETH_DBF_HEX(SETUP
, 3, &card
, sizeof(void *));
1152 if (card
->dev
&& netif_carrier_ok(card
->dev
))
1153 netif_carrier_off(card
->dev
);
1154 recover_flag
= card
->state
;
1155 if ((!recovery_mode
&& card
->info
.hwtrap
) || card
->info
.hwtrap
== 2) {
1156 qeth_hw_trap(card
, QETH_DIAGS_TRAP_DISARM
);
1157 card
->info
.hwtrap
= 1;
1159 qeth_l2_stop_card(card
, recovery_mode
);
1160 rc
= ccw_device_set_offline(CARD_DDEV(card
));
1161 rc2
= ccw_device_set_offline(CARD_WDEV(card
));
1162 rc3
= ccw_device_set_offline(CARD_RDEV(card
));
1164 rc
= (rc2
) ? rc2
: rc3
;
1166 QETH_DBF_TEXT_(SETUP
, 2, "1err%d", rc
);
1167 qdio_free(CARD_DDEV(card
));
1168 if (recover_flag
== CARD_STATE_UP
)
1169 card
->state
= CARD_STATE_RECOVER
;
1170 /* let user_space know that device is offline */
1171 kobject_uevent(&cgdev
->dev
.kobj
, KOBJ_CHANGE
);
1172 mutex_unlock(&card
->conf_mutex
);
1173 mutex_unlock(&card
->discipline_mutex
);
1177 static int qeth_l2_set_offline(struct ccwgroup_device
*cgdev
)
1179 return __qeth_l2_set_offline(cgdev
, 0);
1182 static int qeth_l2_recover(void *ptr
)
1184 struct qeth_card
*card
;
1187 card
= (struct qeth_card
*) ptr
;
1188 QETH_CARD_TEXT(card
, 2, "recover1");
1189 if (!qeth_do_run_thread(card
, QETH_RECOVER_THREAD
))
1191 QETH_CARD_TEXT(card
, 2, "recover2");
1192 dev_warn(&card
->gdev
->dev
,
1193 "A recovery process has been started for the device\n");
1194 qeth_set_recovery_task(card
);
1195 __qeth_l2_set_offline(card
->gdev
, 1);
1196 rc
= __qeth_l2_set_online(card
->gdev
, 1);
1198 dev_info(&card
->gdev
->dev
,
1199 "Device successfully recovered!\n");
1201 qeth_close_dev(card
);
1202 dev_warn(&card
->gdev
->dev
, "The qeth device driver "
1203 "failed to recover an error on the device\n");
1205 qeth_clear_recovery_task(card
);
1206 qeth_clear_thread_start_bit(card
, QETH_RECOVER_THREAD
);
1207 qeth_clear_thread_running_bit(card
, QETH_RECOVER_THREAD
);
1211 static int __init
qeth_l2_init(void)
1213 pr_info("register layer 2 discipline\n");
1217 static void __exit
qeth_l2_exit(void)
1219 pr_info("unregister layer 2 discipline\n");
1222 static void qeth_l2_shutdown(struct ccwgroup_device
*gdev
)
1224 struct qeth_card
*card
= dev_get_drvdata(&gdev
->dev
);
1225 qeth_set_allowed_threads(card
, 0, 1);
1226 if ((gdev
->state
== CCWGROUP_ONLINE
) && card
->info
.hwtrap
)
1227 qeth_hw_trap(card
, QETH_DIAGS_TRAP_DISARM
);
1228 qeth_qdio_clear_card(card
, 0);
1229 qeth_clear_qdio_buffers(card
);
1230 qdio_free(CARD_DDEV(card
));
1233 static int qeth_l2_pm_suspend(struct ccwgroup_device
*gdev
)
1235 struct qeth_card
*card
= dev_get_drvdata(&gdev
->dev
);
1238 netif_device_detach(card
->dev
);
1239 qeth_set_allowed_threads(card
, 0, 1);
1240 wait_event(card
->wait_q
, qeth_threads_running(card
, 0xffffffff) == 0);
1241 if (gdev
->state
== CCWGROUP_OFFLINE
)
1243 if (card
->state
== CARD_STATE_UP
) {
1244 if (card
->info
.hwtrap
)
1245 qeth_hw_trap(card
, QETH_DIAGS_TRAP_DISARM
);
1246 __qeth_l2_set_offline(card
->gdev
, 1);
1248 __qeth_l2_set_offline(card
->gdev
, 0);
1252 static int qeth_l2_pm_resume(struct ccwgroup_device
*gdev
)
1254 struct qeth_card
*card
= dev_get_drvdata(&gdev
->dev
);
1257 if (gdev
->state
== CCWGROUP_OFFLINE
)
1260 if (card
->state
== CARD_STATE_RECOVER
) {
1261 rc
= __qeth_l2_set_online(card
->gdev
, 1);
1264 dev_close(card
->dev
);
1268 rc
= __qeth_l2_set_online(card
->gdev
, 0);
1270 qeth_set_allowed_threads(card
, 0xffffffff, 0);
1272 netif_device_attach(card
->dev
);
1274 dev_warn(&card
->gdev
->dev
, "The qeth device driver "
1275 "failed to recover an error on the device\n");
1279 /* Returns zero if the command is successfully "consumed" */
1280 static int qeth_l2_control_event(struct qeth_card
*card
,
1281 struct qeth_ipa_cmd
*cmd
)
1283 switch (cmd
->hdr
.command
) {
1284 case IPA_CMD_SETBRIDGEPORT_OSA
:
1285 case IPA_CMD_SETBRIDGEPORT_IQD
:
1286 if (cmd
->data
.sbp
.hdr
.command_code
==
1287 IPA_SBP_BRIDGE_PORT_STATE_CHANGE
) {
1288 qeth_bridge_state_change(card
, cmd
);
1292 case IPA_CMD_ADDRESS_CHANGE_NOTIF
:
1293 qeth_bridge_host_event(card
, cmd
);
1300 struct qeth_discipline qeth_l2_discipline
= {
1301 .start_poll
= qeth_qdio_start_poll
,
1302 .input_handler
= (qdio_handler_t
*) qeth_qdio_input_handler
,
1303 .output_handler
= (qdio_handler_t
*) qeth_qdio_output_handler
,
1304 .recover
= qeth_l2_recover
,
1305 .setup
= qeth_l2_probe_device
,
1306 .remove
= qeth_l2_remove_device
,
1307 .set_online
= qeth_l2_set_online
,
1308 .set_offline
= qeth_l2_set_offline
,
1309 .shutdown
= qeth_l2_shutdown
,
1310 .freeze
= qeth_l2_pm_suspend
,
1311 .thaw
= qeth_l2_pm_resume
,
1312 .restore
= qeth_l2_pm_resume
,
1313 .control_event_handler
= qeth_l2_control_event
,
1315 EXPORT_SYMBOL_GPL(qeth_l2_discipline
);
1317 static int qeth_osn_send_control_data(struct qeth_card
*card
, int len
,
1318 struct qeth_cmd_buffer
*iob
)
1320 unsigned long flags
;
1323 QETH_CARD_TEXT(card
, 5, "osndctrd");
1325 wait_event(card
->wait_q
,
1326 atomic_cmpxchg(&card
->write
.irq_pending
, 0, 1) == 0);
1327 qeth_prepare_control_data(card
, len
, iob
);
1328 QETH_CARD_TEXT(card
, 6, "osnoirqp");
1329 spin_lock_irqsave(get_ccwdev_lock(card
->write
.ccwdev
), flags
);
1330 rc
= ccw_device_start(card
->write
.ccwdev
, &card
->write
.ccw
,
1331 (addr_t
) iob
, 0, 0);
1332 spin_unlock_irqrestore(get_ccwdev_lock(card
->write
.ccwdev
), flags
);
1334 QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: "
1335 "ccw_device_start rc = %i\n", rc
);
1336 QETH_CARD_TEXT_(card
, 2, " err%d", rc
);
1337 qeth_release_buffer(iob
->channel
, iob
);
1338 atomic_set(&card
->write
.irq_pending
, 0);
1339 wake_up(&card
->wait_q
);
1344 static int qeth_osn_send_ipa_cmd(struct qeth_card
*card
,
1345 struct qeth_cmd_buffer
*iob
, int data_len
)
1349 QETH_CARD_TEXT(card
, 4, "osndipa");
1351 qeth_prepare_ipa_cmd(card
, iob
, QETH_PROT_OSN2
);
1352 s1
= (u16
)(IPA_PDU_HEADER_SIZE
+ data_len
);
1354 memcpy(QETH_IPA_PDU_LEN_TOTAL(iob
->data
), &s1
, 2);
1355 memcpy(QETH_IPA_PDU_LEN_PDU1(iob
->data
), &s2
, 2);
1356 memcpy(QETH_IPA_PDU_LEN_PDU2(iob
->data
), &s2
, 2);
1357 memcpy(QETH_IPA_PDU_LEN_PDU3(iob
->data
), &s2
, 2);
1358 return qeth_osn_send_control_data(card
, s1
, iob
);
1361 int qeth_osn_assist(struct net_device
*dev
, void *data
, int data_len
)
1363 struct qeth_cmd_buffer
*iob
;
1364 struct qeth_card
*card
;
1369 card
= dev
->ml_priv
;
1372 QETH_CARD_TEXT(card
, 2, "osnsdmc");
1373 if (!qeth_card_hw_is_reachable(card
))
1375 iob
= qeth_wait_for_buffer(&card
->write
);
1376 memcpy(iob
->data
+IPA_PDU_HEADER_SIZE
, data
, data_len
);
1377 rc
= qeth_osn_send_ipa_cmd(card
, iob
, data_len
);
1380 EXPORT_SYMBOL(qeth_osn_assist
);
1382 int qeth_osn_register(unsigned char *read_dev_no
, struct net_device
**dev
,
1383 int (*assist_cb
)(struct net_device
*, void *),
1384 int (*data_cb
)(struct sk_buff
*))
1386 struct qeth_card
*card
;
1388 *dev
= qeth_l2_netdev_by_devno(read_dev_no
);
1391 card
= (*dev
)->ml_priv
;
1394 QETH_CARD_TEXT(card
, 2, "osnreg");
1395 if ((assist_cb
== NULL
) || (data_cb
== NULL
))
1397 card
->osn_info
.assist_cb
= assist_cb
;
1398 card
->osn_info
.data_cb
= data_cb
;
1401 EXPORT_SYMBOL(qeth_osn_register
);
1403 void qeth_osn_deregister(struct net_device
*dev
)
1405 struct qeth_card
*card
;
1409 card
= dev
->ml_priv
;
1412 QETH_CARD_TEXT(card
, 2, "osndereg");
1413 card
->osn_info
.assist_cb
= NULL
;
1414 card
->osn_info
.data_cb
= NULL
;
1417 EXPORT_SYMBOL(qeth_osn_deregister
);
1419 /* SETBRIDGEPORT support, async notifications */
1421 enum qeth_an_event_type
{anev_reg_unreg
, anev_abort
, anev_reset
};
1424 * qeth_bridge_emit_host_event() - bridgeport address change notification
1425 * @card: qeth_card structure pointer, for udev events.
1426 * @evtype: "normal" register/unregister, or abort, or reset. For abort
1427 * and reset token and addr_lnid are unused and may be NULL.
1428 * @code: event bitmask: high order bit 0x80 value 1 means removal of an
1429 * object, 0 - addition of an object.
1430 * 0x01 - VLAN, 0x02 - MAC, 0x03 - VLAN and MAC.
1431 * @token: "network token" structure identifying physical address of the port.
1432 * @addr_lnid: pointer to structure with MAC address and VLAN ID.
1434 * This function is called when registrations and deregistrations are
1435 * reported by the hardware, and also when notifications are enabled -
1436 * for all currently registered addresses.
1438 static void qeth_bridge_emit_host_event(struct qeth_card
*card
,
1439 enum qeth_an_event_type evtype
,
1440 u8 code
, struct net_if_token
*token
, struct mac_addr_lnid
*addr_lnid
)
1447 case anev_reg_unreg
:
1448 snprintf(str
[i
], sizeof(str
[i
]), "BRIDGEDHOST=%s",
1449 (code
& IPA_ADDR_CHANGE_CODE_REMOVAL
)
1450 ? "deregister" : "register");
1451 env
[i
] = str
[i
]; i
++;
1452 if (code
& IPA_ADDR_CHANGE_CODE_VLANID
) {
1453 snprintf(str
[i
], sizeof(str
[i
]), "VLAN=%d",
1455 env
[i
] = str
[i
]; i
++;
1457 if (code
& IPA_ADDR_CHANGE_CODE_MACADDR
) {
1458 snprintf(str
[i
], sizeof(str
[i
]), "MAC=%pM6",
1460 env
[i
] = str
[i
]; i
++;
1462 snprintf(str
[i
], sizeof(str
[i
]), "NTOK_BUSID=%x.%x.%04x",
1463 token
->cssid
, token
->ssid
, token
->devnum
);
1464 env
[i
] = str
[i
]; i
++;
1465 snprintf(str
[i
], sizeof(str
[i
]), "NTOK_IID=%02x", token
->iid
);
1466 env
[i
] = str
[i
]; i
++;
1467 snprintf(str
[i
], sizeof(str
[i
]), "NTOK_CHPID=%02x",
1469 env
[i
] = str
[i
]; i
++;
1470 snprintf(str
[i
], sizeof(str
[i
]), "NTOK_CHID=%04x", token
->chid
);
1471 env
[i
] = str
[i
]; i
++;
1474 snprintf(str
[i
], sizeof(str
[i
]), "BRIDGEDHOST=abort");
1475 env
[i
] = str
[i
]; i
++;
1478 snprintf(str
[i
], sizeof(str
[i
]), "BRIDGEDHOST=reset");
1479 env
[i
] = str
[i
]; i
++;
1483 kobject_uevent_env(&card
->gdev
->dev
.kobj
, KOBJ_CHANGE
, env
);
1486 struct qeth_bridge_state_data
{
1487 struct work_struct worker
;
1488 struct qeth_card
*card
;
1489 struct qeth_sbp_state_change qports
;
1492 static void qeth_bridge_state_change_worker(struct work_struct
*work
)
1494 struct qeth_bridge_state_data
*data
=
1495 container_of(work
, struct qeth_bridge_state_data
, worker
);
1496 /* We are only interested in the first entry - local port */
1497 struct qeth_sbp_port_entry
*entry
= &data
->qports
.entry
[0];
1498 char env_locrem
[32];
1508 /* Role should not change by itself, but if it did, */
1509 /* information from the hardware is authoritative. */
1510 mutex_lock(&data
->card
->conf_mutex
);
1511 data
->card
->options
.sbp
.role
= entry
->role
;
1512 mutex_unlock(&data
->card
->conf_mutex
);
1514 snprintf(env_locrem
, sizeof(env_locrem
), "BRIDGEPORT=statechange");
1515 snprintf(env_role
, sizeof(env_role
), "ROLE=%s",
1516 (entry
->role
== QETH_SBP_ROLE_NONE
) ? "none" :
1517 (entry
->role
== QETH_SBP_ROLE_PRIMARY
) ? "primary" :
1518 (entry
->role
== QETH_SBP_ROLE_SECONDARY
) ? "secondary" :
1520 snprintf(env_state
, sizeof(env_state
), "STATE=%s",
1521 (entry
->state
== QETH_SBP_STATE_INACTIVE
) ? "inactive" :
1522 (entry
->state
== QETH_SBP_STATE_STANDBY
) ? "standby" :
1523 (entry
->state
== QETH_SBP_STATE_ACTIVE
) ? "active" :
1525 kobject_uevent_env(&data
->card
->gdev
->dev
.kobj
,
1530 static void qeth_bridge_state_change(struct qeth_card
*card
,
1531 struct qeth_ipa_cmd
*cmd
)
1533 struct qeth_sbp_state_change
*qports
=
1534 &cmd
->data
.sbp
.data
.state_change
;
1535 struct qeth_bridge_state_data
*data
;
1538 QETH_CARD_TEXT(card
, 2, "brstchng");
1539 if (qports
->entry_length
!= sizeof(struct qeth_sbp_port_entry
)) {
1540 QETH_CARD_TEXT_(card
, 2, "BPsz%04x", qports
->entry_length
);
1543 extrasize
= sizeof(struct qeth_sbp_port_entry
) * qports
->num_entries
;
1544 data
= kzalloc(sizeof(struct qeth_bridge_state_data
) + extrasize
,
1547 QETH_CARD_TEXT(card
, 2, "BPSalloc");
1550 INIT_WORK(&data
->worker
, qeth_bridge_state_change_worker
);
1552 memcpy(&data
->qports
, qports
,
1553 sizeof(struct qeth_sbp_state_change
) + extrasize
);
1554 queue_work(qeth_wq
, &data
->worker
);
1557 struct qeth_bridge_host_data
{
1558 struct work_struct worker
;
1559 struct qeth_card
*card
;
1560 struct qeth_ipacmd_addr_change hostevs
;
1563 static void qeth_bridge_host_event_worker(struct work_struct
*work
)
1565 struct qeth_bridge_host_data
*data
=
1566 container_of(work
, struct qeth_bridge_host_data
, worker
);
1569 if (data
->hostevs
.lost_event_mask
) {
1570 dev_info(&data
->card
->gdev
->dev
,
1571 "Address notification from the Bridge Port stopped %s (%s)\n",
1572 data
->card
->dev
->name
,
1573 (data
->hostevs
.lost_event_mask
== 0x01)
1575 : (data
->hostevs
.lost_event_mask
== 0x02)
1576 ? "Bridge port state change"
1577 : "Unknown reason");
1578 mutex_lock(&data
->card
->conf_mutex
);
1579 data
->card
->options
.sbp
.hostnotification
= 0;
1580 mutex_unlock(&data
->card
->conf_mutex
);
1581 qeth_bridge_emit_host_event(data
->card
, anev_abort
,
1584 for (i
= 0; i
< data
->hostevs
.num_entries
; i
++) {
1585 struct qeth_ipacmd_addr_change_entry
*entry
=
1586 &data
->hostevs
.entry
[i
];
1587 qeth_bridge_emit_host_event(data
->card
,
1590 &entry
->token
, &entry
->addr_lnid
);
1595 static void qeth_bridge_host_event(struct qeth_card
*card
,
1596 struct qeth_ipa_cmd
*cmd
)
1598 struct qeth_ipacmd_addr_change
*hostevs
=
1599 &cmd
->data
.addrchange
;
1600 struct qeth_bridge_host_data
*data
;
1603 QETH_CARD_TEXT(card
, 2, "brhostev");
1604 if (cmd
->hdr
.return_code
!= 0x0000) {
1605 if (cmd
->hdr
.return_code
== 0x0010) {
1606 if (hostevs
->lost_event_mask
== 0x00)
1607 hostevs
->lost_event_mask
= 0xff;
1609 QETH_CARD_TEXT_(card
, 2, "BPHe%04x",
1610 cmd
->hdr
.return_code
);
1614 extrasize
= sizeof(struct qeth_ipacmd_addr_change_entry
) *
1615 hostevs
->num_entries
;
1616 data
= kzalloc(sizeof(struct qeth_bridge_host_data
) + extrasize
,
1619 QETH_CARD_TEXT(card
, 2, "BPHalloc");
1622 INIT_WORK(&data
->worker
, qeth_bridge_host_event_worker
);
1624 memcpy(&data
->hostevs
, hostevs
,
1625 sizeof(struct qeth_ipacmd_addr_change
) + extrasize
);
1626 queue_work(qeth_wq
, &data
->worker
);
1629 /* SETBRIDGEPORT support; sending commands */
1631 struct _qeth_sbp_cbctl
{
1637 enum qeth_sbp_roles
*role
;
1638 enum qeth_sbp_states
*state
;
1644 * qeth_bridgeport_makerc() - derive "traditional" error from hardware codes.
1645 * @card: qeth_card structure pointer, for debug messages.
1646 * @cbctl: state structure with hardware return codes.
1647 * @setcmd: IPA command code
1649 * Returns negative errno-compatible error indication or 0 on success.
1651 static int qeth_bridgeport_makerc(struct qeth_card
*card
,
1652 struct _qeth_sbp_cbctl
*cbctl
, enum qeth_ipa_sbp_cmd setcmd
)
1655 int is_iqd
= (card
->info
.type
== QETH_CARD_TYPE_IQD
);
1657 if ((is_iqd
&& (cbctl
->ipa_rc
== IPA_RC_SUCCESS
)) ||
1658 (!is_iqd
&& (cbctl
->ipa_rc
== cbctl
->cmd_rc
)))
1659 switch (cbctl
->cmd_rc
) {
1668 case 0x000C: /* Not configured as bridge Port */
1669 rc
= -ENODEV
; /* maybe not the best code here? */
1670 dev_err(&card
->gdev
->dev
,
1671 "The device is not configured as a Bridge Port\n");
1674 case 0x0014: /* Another device is Primary */
1676 case IPA_SBP_SET_PRIMARY_BRIDGE_PORT
:
1678 dev_err(&card
->gdev
->dev
,
1679 "The LAN already has a primary Bridge Port\n");
1681 case IPA_SBP_SET_SECONDARY_BRIDGE_PORT
:
1683 dev_err(&card
->gdev
->dev
,
1684 "The device is already a primary Bridge Port\n");
1691 case 0x0018: /* This device is currently Secondary */
1693 dev_err(&card
->gdev
->dev
,
1694 "The device is already a secondary Bridge Port\n");
1697 case 0x001C: /* Limit for Secondary devices reached */
1699 dev_err(&card
->gdev
->dev
,
1700 "The LAN cannot have more secondary Bridge Ports\n");
1703 case 0x0024: /* This device is currently Primary */
1705 dev_err(&card
->gdev
->dev
,
1706 "The device is already a primary Bridge Port\n");
1709 case 0x0020: /* Not authorized by zManager */
1711 dev_err(&card
->gdev
->dev
,
1712 "The device is not authorized to be a Bridge Port\n");
1718 switch (cbctl
->ipa_rc
) {
1719 case IPA_RC_NOTSUPP
:
1722 case IPA_RC_UNSUPPORTED_COMMAND
:
1730 QETH_CARD_TEXT_(card
, 2, "SBPi%04x", cbctl
->ipa_rc
);
1731 QETH_CARD_TEXT_(card
, 2, "SBPc%04x", cbctl
->cmd_rc
);
1736 static inline int ipa_cmd_sbp(struct qeth_card
*card
)
1738 return (card
->info
.type
== QETH_CARD_TYPE_IQD
) ?
1739 IPA_CMD_SETBRIDGEPORT_IQD
:
1740 IPA_CMD_SETBRIDGEPORT_OSA
;
1743 static int qeth_bridgeport_query_support_cb(struct qeth_card
*card
,
1744 struct qeth_reply
*reply
, unsigned long data
)
1746 struct qeth_ipa_cmd
*cmd
= (struct qeth_ipa_cmd
*) data
;
1747 struct _qeth_sbp_cbctl
*cbctl
= (struct _qeth_sbp_cbctl
*)reply
->param
;
1748 QETH_CARD_TEXT(card
, 2, "brqsupcb");
1749 cbctl
->ipa_rc
= cmd
->hdr
.return_code
;
1750 cbctl
->cmd_rc
= cmd
->data
.sbp
.hdr
.return_code
;
1751 if ((cbctl
->ipa_rc
== 0) && (cbctl
->cmd_rc
== 0)) {
1752 cbctl
->data
.supported
=
1753 cmd
->data
.sbp
.data
.query_cmds_supp
.supported_cmds
;
1755 cbctl
->data
.supported
= 0;
1761 * qeth_bridgeport_query_support() - store bitmask of supported subfunctions.
1762 * @card: qeth_card structure pointer.
1764 * Sets bitmask of supported setbridgeport subfunctions in the qeth_card
1765 * strucutre: card->options.sbp.supported_funcs.
1767 static void qeth_bridgeport_query_support(struct qeth_card
*card
)
1769 struct qeth_cmd_buffer
*iob
;
1770 struct qeth_ipa_cmd
*cmd
;
1771 struct _qeth_sbp_cbctl cbctl
;
1773 QETH_CARD_TEXT(card
, 2, "brqsuppo");
1774 iob
= qeth_get_ipacmd_buffer(card
, ipa_cmd_sbp(card
), 0);
1777 cmd
= (struct qeth_ipa_cmd
*)(iob
->data
+IPA_PDU_HEADER_SIZE
);
1778 cmd
->data
.sbp
.hdr
.cmdlength
=
1779 sizeof(struct qeth_ipacmd_sbp_hdr
) +
1780 sizeof(struct qeth_sbp_query_cmds_supp
);
1781 cmd
->data
.sbp
.hdr
.command_code
=
1782 IPA_SBP_QUERY_COMMANDS_SUPPORTED
;
1783 cmd
->data
.sbp
.hdr
.used_total
= 1;
1784 cmd
->data
.sbp
.hdr
.seq_no
= 1;
1785 if (qeth_send_ipa_cmd(card
, iob
, qeth_bridgeport_query_support_cb
,
1787 qeth_bridgeport_makerc(card
, &cbctl
,
1788 IPA_SBP_QUERY_COMMANDS_SUPPORTED
)) {
1789 /* non-zero makerc signifies failure, and produce messages */
1790 card
->options
.sbp
.role
= QETH_SBP_ROLE_NONE
;
1793 card
->options
.sbp
.supported_funcs
= cbctl
.data
.supported
;
1796 static int qeth_bridgeport_query_ports_cb(struct qeth_card
*card
,
1797 struct qeth_reply
*reply
, unsigned long data
)
1799 struct qeth_ipa_cmd
*cmd
= (struct qeth_ipa_cmd
*) data
;
1800 struct qeth_sbp_query_ports
*qports
= &cmd
->data
.sbp
.data
.query_ports
;
1801 struct _qeth_sbp_cbctl
*cbctl
= (struct _qeth_sbp_cbctl
*)reply
->param
;
1803 QETH_CARD_TEXT(card
, 2, "brqprtcb");
1804 cbctl
->ipa_rc
= cmd
->hdr
.return_code
;
1805 cbctl
->cmd_rc
= cmd
->data
.sbp
.hdr
.return_code
;
1806 if ((cbctl
->ipa_rc
!= 0) || (cbctl
->cmd_rc
!= 0))
1808 if (qports
->entry_length
!= sizeof(struct qeth_sbp_port_entry
)) {
1809 cbctl
->cmd_rc
= 0xffff;
1810 QETH_CARD_TEXT_(card
, 2, "SBPs%04x", qports
->entry_length
);
1813 /* first entry contains the state of the local port */
1814 if (qports
->num_entries
> 0) {
1815 if (cbctl
->data
.qports
.role
)
1816 *cbctl
->data
.qports
.role
= qports
->entry
[0].role
;
1817 if (cbctl
->data
.qports
.state
)
1818 *cbctl
->data
.qports
.state
= qports
->entry
[0].state
;
1824 * qeth_bridgeport_query_ports() - query local bridgeport status.
1825 * @card: qeth_card structure pointer.
1826 * @role: Role of the port: 0-none, 1-primary, 2-secondary.
1827 * @state: State of the port: 0-inactive, 1-standby, 2-active.
1829 * Returns negative errno-compatible error indication or 0 on success.
1831 * 'role' and 'state' are not updated in case of hardware operation failure.
1833 int qeth_bridgeport_query_ports(struct qeth_card
*card
,
1834 enum qeth_sbp_roles
*role
, enum qeth_sbp_states
*state
)
1837 struct qeth_cmd_buffer
*iob
;
1838 struct qeth_ipa_cmd
*cmd
;
1839 struct _qeth_sbp_cbctl cbctl
= {
1848 QETH_CARD_TEXT(card
, 2, "brqports");
1849 if (!(card
->options
.sbp
.supported_funcs
& IPA_SBP_QUERY_BRIDGE_PORTS
))
1851 iob
= qeth_get_ipacmd_buffer(card
, ipa_cmd_sbp(card
), 0);
1854 cmd
= (struct qeth_ipa_cmd
*)(iob
->data
+IPA_PDU_HEADER_SIZE
);
1855 cmd
->data
.sbp
.hdr
.cmdlength
=
1856 sizeof(struct qeth_ipacmd_sbp_hdr
);
1857 cmd
->data
.sbp
.hdr
.command_code
=
1858 IPA_SBP_QUERY_BRIDGE_PORTS
;
1859 cmd
->data
.sbp
.hdr
.used_total
= 1;
1860 cmd
->data
.sbp
.hdr
.seq_no
= 1;
1861 rc
= qeth_send_ipa_cmd(card
, iob
, qeth_bridgeport_query_ports_cb
,
1865 return qeth_bridgeport_makerc(card
, &cbctl
, IPA_SBP_QUERY_BRIDGE_PORTS
);
1867 EXPORT_SYMBOL_GPL(qeth_bridgeport_query_ports
);
1869 static int qeth_bridgeport_set_cb(struct qeth_card
*card
,
1870 struct qeth_reply
*reply
, unsigned long data
)
1872 struct qeth_ipa_cmd
*cmd
= (struct qeth_ipa_cmd
*)data
;
1873 struct _qeth_sbp_cbctl
*cbctl
= (struct _qeth_sbp_cbctl
*)reply
->param
;
1874 QETH_CARD_TEXT(card
, 2, "brsetrcb");
1875 cbctl
->ipa_rc
= cmd
->hdr
.return_code
;
1876 cbctl
->cmd_rc
= cmd
->data
.sbp
.hdr
.return_code
;
1881 * qeth_bridgeport_setrole() - Assign primary role to the port.
1882 * @card: qeth_card structure pointer.
1883 * @role: Role to assign.
1885 * Returns negative errno-compatible error indication or 0 on success.
1887 int qeth_bridgeport_setrole(struct qeth_card
*card
, enum qeth_sbp_roles role
)
1891 struct qeth_cmd_buffer
*iob
;
1892 struct qeth_ipa_cmd
*cmd
;
1893 struct _qeth_sbp_cbctl cbctl
;
1894 enum qeth_ipa_sbp_cmd setcmd
;
1896 QETH_CARD_TEXT(card
, 2, "brsetrol");
1898 case QETH_SBP_ROLE_NONE
:
1899 setcmd
= IPA_SBP_RESET_BRIDGE_PORT_ROLE
;
1900 cmdlength
= sizeof(struct qeth_ipacmd_sbp_hdr
) +
1901 sizeof(struct qeth_sbp_reset_role
);
1903 case QETH_SBP_ROLE_PRIMARY
:
1904 setcmd
= IPA_SBP_SET_PRIMARY_BRIDGE_PORT
;
1905 cmdlength
= sizeof(struct qeth_ipacmd_sbp_hdr
) +
1906 sizeof(struct qeth_sbp_set_primary
);
1908 case QETH_SBP_ROLE_SECONDARY
:
1909 setcmd
= IPA_SBP_SET_SECONDARY_BRIDGE_PORT
;
1910 cmdlength
= sizeof(struct qeth_ipacmd_sbp_hdr
) +
1911 sizeof(struct qeth_sbp_set_secondary
);
1916 if (!(card
->options
.sbp
.supported_funcs
& setcmd
))
1918 iob
= qeth_get_ipacmd_buffer(card
, ipa_cmd_sbp(card
), 0);
1921 cmd
= (struct qeth_ipa_cmd
*)(iob
->data
+IPA_PDU_HEADER_SIZE
);
1922 cmd
->data
.sbp
.hdr
.cmdlength
= cmdlength
;
1923 cmd
->data
.sbp
.hdr
.command_code
= setcmd
;
1924 cmd
->data
.sbp
.hdr
.used_total
= 1;
1925 cmd
->data
.sbp
.hdr
.seq_no
= 1;
1926 rc
= qeth_send_ipa_cmd(card
, iob
, qeth_bridgeport_set_cb
,
1930 return qeth_bridgeport_makerc(card
, &cbctl
, setcmd
);
1934 * qeth_anset_makerc() - derive "traditional" error from hardware codes.
1935 * @card: qeth_card structure pointer, for debug messages.
1937 * Returns negative errno-compatible error indication or 0 on success.
1939 static int qeth_anset_makerc(struct qeth_card
*card
, int pnso_rc
, u16 response
)
1952 dev_err(&card
->gdev
->dev
,
1953 "Setting address notification failed\n");
1965 QETH_CARD_TEXT_(card
, 2, "SBPp%04x", pnso_rc
);
1966 QETH_CARD_TEXT_(card
, 2, "SBPr%04x", response
);
1971 static void qeth_bridgeport_an_set_cb(void *priv
,
1972 enum qdio_brinfo_entry_type type
, void *entry
)
1974 struct qeth_card
*card
= (struct qeth_card
*)priv
;
1975 struct qdio_brinfo_entry_l2
*l2entry
;
1978 if (type
!= l2_addr_lnid
) {
1983 l2entry
= (struct qdio_brinfo_entry_l2
*)entry
;
1984 code
= IPA_ADDR_CHANGE_CODE_MACADDR
;
1985 if (l2entry
->addr_lnid
.lnid
)
1986 code
|= IPA_ADDR_CHANGE_CODE_VLANID
;
1987 qeth_bridge_emit_host_event(card
, anev_reg_unreg
, code
,
1988 (struct net_if_token
*)&l2entry
->nit
,
1989 (struct mac_addr_lnid
*)&l2entry
->addr_lnid
);
1993 * qeth_bridgeport_an_set() - Enable or disable bridgeport address notification
1994 * @card: qeth_card structure pointer.
1995 * @enable: 0 - disable, non-zero - enable notifications
1997 * Returns negative errno-compatible error indication or 0 on success.
1999 * On enable, emits a series of address notifications udev events for all
2000 * currently registered hosts.
2002 int qeth_bridgeport_an_set(struct qeth_card
*card
, int enable
)
2006 struct ccw_device
*ddev
;
2007 struct subchannel_id schid
;
2011 if (!card
->options
.sbp
.supported_funcs
)
2013 ddev
= CARD_DDEV(card
);
2014 ccw_device_get_schid(ddev
, &schid
);
2017 qeth_bridge_emit_host_event(card
, anev_reset
, 0, NULL
, NULL
);
2018 rc
= qdio_pnso_brinfo(schid
, 1, &response
,
2019 qeth_bridgeport_an_set_cb
, card
);
2021 rc
= qdio_pnso_brinfo(schid
, 0, &response
, NULL
, NULL
);
2022 return qeth_anset_makerc(card
, rc
, response
);
2024 EXPORT_SYMBOL_GPL(qeth_bridgeport_an_set
);
2026 module_init(qeth_l2_init
);
2027 module_exit(qeth_l2_exit
);
2028 MODULE_AUTHOR("Frank Blaschka <frank.blaschka@de.ibm.com>");
2029 MODULE_DESCRIPTION("qeth layer 2 discipline");
2030 MODULE_LICENSE("GPL");