aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth_main.c
diff options
context:
space:
mode:
authorFrank Pavlic <fpavlic@de.ibm.com>2005-11-10 07:51:25 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-11 08:26:22 -0500
commit6c951b9051f2094dd98bafcb46e7e6b3e8813231 (patch)
tree6625f15a30e4efc90a5ff24e8a7140fbb67732c9 /drivers/s390/net/qeth_main.c
parente08d88cccbe0dfcfbaffb704d24e19803407935d (diff)
[PATCH] s390: introduce guestLan sniffer support in qeth
[patch 6/7] s390: introduce guestLan sniffer support in qeth From: Peter Tiedemann <ptiedem@de.ibm.com> - introduce guestLan sniffer support in qeth feature allows a linux in a virtual machine guest to become a network LAN sniffer, monitoring and recording the networking traffic within an entire guestLan. Signed-off-by: Frank Pavlic <fpavlic@de.ibm.com> diffstat: qeth.h | 2 + qeth_main.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ qeth_mpc.h | 11 ++++--- 3 files changed, 102 insertions(+), 4 deletions(-) Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/s390/net/qeth_main.c')
-rw-r--r--drivers/s390/net/qeth_main.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 0f7f5117f1cf..db07e465060b 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -160,6 +160,9 @@ static void
160qeth_set_multicast_list(struct net_device *); 160qeth_set_multicast_list(struct net_device *);
161 161
162static void 162static void
163qeth_setadp_promisc_mode(struct qeth_card *);
164
165static void
163qeth_notify_processes(void) 166qeth_notify_processes(void)
164{ 167{
165 /*notify all registered processes */ 168 /*notify all registered processes */
@@ -965,6 +968,24 @@ qeth_register_ip_addresses(void *ptr)
965 return 0; 968 return 0;
966} 969}
967 970
971/*
972 * Drive the SET_PROMISC_MODE thread
973 */
974static int
975qeth_set_promisc_mode(void *ptr)
976{
977 struct qeth_card *card = (struct qeth_card *) ptr;
978
979 daemonize("qeth_setprm");
980 QETH_DBF_TEXT(trace,4,"setprm1");
981 if (!qeth_do_run_thread(card, QETH_SET_PROMISC_MODE_THREAD))
982 return 0;
983 QETH_DBF_TEXT(trace,4,"setprm2");
984 qeth_setadp_promisc_mode(card);
985 qeth_clear_thread_running_bit(card, QETH_SET_PROMISC_MODE_THREAD);
986 return 0;
987}
988
968static int 989static int
969qeth_recover(void *ptr) 990qeth_recover(void *ptr)
970{ 991{
@@ -1031,6 +1052,8 @@ qeth_start_kernel_thread(struct qeth_card *card)
1031 1052
1032 if (qeth_do_start_thread(card, QETH_SET_IP_THREAD)) 1053 if (qeth_do_start_thread(card, QETH_SET_IP_THREAD))
1033 kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD); 1054 kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD);
1055 if (qeth_do_start_thread(card, QETH_SET_PROMISC_MODE_THREAD))
1056 kernel_thread(qeth_set_promisc_mode, (void *)card, SIGCHLD);
1034 if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) 1057 if (qeth_do_start_thread(card, QETH_RECOVER_THREAD))
1035 kernel_thread(qeth_recover, (void *) card, SIGCHLD); 1058 kernel_thread(qeth_recover, (void *) card, SIGCHLD);
1036} 1059}
@@ -5003,6 +5026,10 @@ qeth_default_setassparms_cb(struct qeth_card *, struct qeth_reply *,
5003 unsigned long); 5026 unsigned long);
5004 5027
5005static int 5028static int
5029qeth_default_setadapterparms_cb(struct qeth_card *card,
5030 struct qeth_reply *reply,
5031 unsigned long data);
5032static int
5006qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, 5033qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *,
5007 __u16, long, 5034 __u16, long,
5008 int (*reply_cb) 5035 int (*reply_cb)
@@ -5476,6 +5503,59 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
5476 qeth_set_multicast_list(card->dev); 5503 qeth_set_multicast_list(card->dev);
5477} 5504}
5478#endif 5505#endif
5506/**
5507 * Examine hardware response to SET_PROMISC_MODE
5508 */
5509static int
5510qeth_setadp_promisc_mode_cb(struct qeth_card *card,
5511 struct qeth_reply *reply,
5512 unsigned long data)
5513{
5514 struct qeth_ipa_cmd *cmd;
5515 struct qeth_ipacmd_setadpparms *setparms;
5516
5517 QETH_DBF_TEXT(trace,4,"prmadpcb");
5518
5519 cmd = (struct qeth_ipa_cmd *) data;
5520 setparms = &(cmd->data.setadapterparms);
5521
5522 qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd);
5523 if (cmd->hdr.return_code) {
5524 QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code);
5525 setparms->data.mode = SET_PROMISC_MODE_OFF;
5526 }
5527 card->info.promisc_mode = setparms->data.mode;
5528 return 0;
5529}
5530/*
5531 * Set promiscuous mode (on or off) (SET_PROMISC_MODE command)
5532 */
5533static void
5534qeth_setadp_promisc_mode(struct qeth_card *card)
5535{
5536 enum qeth_ipa_promisc_modes mode;
5537 struct net_device *dev = card->dev;
5538 struct qeth_cmd_buffer *iob;
5539 struct qeth_ipa_cmd *cmd;
5540
5541 QETH_DBF_TEXT(trace, 4, "setprom");
5542
5543 if (((dev->flags & IFF_PROMISC) &&
5544 (card->info.promisc_mode == SET_PROMISC_MODE_ON)) ||
5545 (!(dev->flags & IFF_PROMISC) &&
5546 (card->info.promisc_mode == SET_PROMISC_MODE_OFF)))
5547 return;
5548 mode = SET_PROMISC_MODE_OFF;
5549 if (dev->flags & IFF_PROMISC)
5550 mode = SET_PROMISC_MODE_ON;
5551 QETH_DBF_TEXT_(trace, 4, "mode:%x", mode);
5552
5553 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE,
5554 sizeof(struct qeth_ipacmd_setadpparms));
5555 cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE);
5556 cmd->data.setadapterparms.data.mode = mode;
5557 qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL);
5558}
5479 5559
5480/** 5560/**
5481 * set multicast address on card 5561 * set multicast address on card
@@ -5501,6 +5581,11 @@ qeth_set_multicast_list(struct net_device *dev)
5501out: 5581out:
5502 if (qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD) == 0) 5582 if (qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD) == 0)
5503 schedule_work(&card->kernel_thread_starter); 5583 schedule_work(&card->kernel_thread_starter);
5584 if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE))
5585 return;
5586 if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0)
5587 schedule_work(&card->kernel_thread_starter);
5588
5504} 5589}
5505 5590
5506static int 5591static int
@@ -6510,6 +6595,8 @@ qeth_default_setadapterparms_cb(struct qeth_card *card,
6510 return 0; 6595 return 0;
6511} 6596}
6512 6597
6598
6599
6513static int 6600static int
6514qeth_query_setadapterparms_cb(struct qeth_card *card, struct qeth_reply *reply, 6601qeth_query_setadapterparms_cb(struct qeth_card *card, struct qeth_reply *reply,
6515 unsigned long data) 6602 unsigned long data)
@@ -6676,6 +6763,12 @@ qeth_layer2_initialize(struct qeth_card *card)
6676 QETH_DBF_TEXT(setup, 2, "doL2init"); 6763 QETH_DBF_TEXT(setup, 2, "doL2init");
6677 QETH_DBF_TEXT_(setup, 2, "doL2%s", CARD_BUS_ID(card)); 6764 QETH_DBF_TEXT_(setup, 2, "doL2%s", CARD_BUS_ID(card));
6678 6765
6766 rc = qeth_query_setadapterparms(card);
6767 if (rc) {
6768 PRINT_WARN("could not query adapter parameters on device %s: "
6769 "x%x\n", CARD_BUS_ID(card), rc);
6770 }
6771
6679 rc = qeth_setadpparms_change_macaddr(card); 6772 rc = qeth_setadpparms_change_macaddr(card);
6680 if (rc) { 6773 if (rc) {
6681 PRINT_WARN("couldn't get MAC address on " 6774 PRINT_WARN("couldn't get MAC address on "