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 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624
|
/*******************************************************************************
* Agere Systems Inc.
* 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
*
* Copyright 2005 Agere Systems Inc.
* All rights reserved.
* http://www.agere.com
*
*------------------------------------------------------------------------------
*
* et131x_netdev.c - Routines and data required by all Linux network devices.
*
*------------------------------------------------------------------------------
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* Copyright 2005 Agere Systems Inc.
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following Disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
******************************************************************************/
/******************************************************************************
* VERSION CONTROL INFORMATION
******************************************************************************
$RCSFile: $
$Date: 2007/01/22 23:13:56 $
$Revision: 1.21 $
$Name: T_20060131_v1-2-3 $
$Author: vjs $
*****************************************************************************/
/*******************************************************************************
Includes
******************************************************************************/
#include "et131x_version.h"
#include "et131x_debug.h"
#include "et131x_defs.h"
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#if ( LINUX_VERSION_CODE < KERNEL_VERSION( 2,6,0 ))
#include <linux/tqueue.h>
#endif
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/in.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <linux/mii.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/ioport.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#include <linux/if_vlan.h>
#endif
#include "ET1310_phy.h"
#include "ET1310_pm.h"
#include "ET1310_jagcore.h"
#include "ET1310_mac.h"
#include "ET1310_tx.h"
#include "et131x_supp.h"
#include "et131x_adapter.h"
#include "et131x_isr.h"
#include "et131x_initpci.h"
/******************************************************************************
Data for debugging facilities
*****************************************************************************/
#if ET131X_DBG
extern dbg_info_t *et131x_dbginfo;
#endif /* ET131X_DBG */
/******************************************************************************
Prototypes for functions with local scope
*****************************************************************************/
int et131x_init( struct net_device *netdev );
int et131x_config( struct net_device *netdev, struct ifmap *map );
struct net_device_stats *et131x_stats( struct net_device *netdev );
int et131x_open( struct net_device *netdev );
int et131x_close( struct net_device *netdev );
int et131x_ioctl( struct net_device *netdev, struct ifreq *reqbuf, int cmd );
void et131x_multicast( struct net_device *netdev );
int et131x_tx( struct sk_buff *skb, struct net_device *netdev );
void et131x_tx_timeout( struct net_device *netdev );
int et131x_change_mtu( struct net_device *netdev, int new_mtu );
int et131x_set_mac_addr( struct net_device *netdev, void *new_mac );
void et131x_vlan_rx_register( struct net_device *netdev, struct vlan_group *grp );
void et131x_vlan_rx_add_vid( struct net_device *netdev, UINT16 vid );
void et131x_vlan_rx_kill_vid( struct net_device *netdev, UINT16 vid );
/******************************************************************************
ROUTINE : et131x_device_alloc()
******************************************************************************
DESCRIPTION : Create instances of net_device and wl_private for the
new adapter and register the device's entry points in
the net_device structure.
PARAMETERS : N/A
RETURNS : pointer to the allocated and initialized net_device
struct for this device.
REUSE INFORMATION :
*****************************************************************************/
struct net_device * et131x_device_alloc( void )
{
struct net_device *netdev = NULL;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_device_alloc" );
DBG_ENTER( et131x_dbginfo );
/**************************************************************************
Alloc net_device and adapter structs
*************************************************************************/
netdev = alloc_etherdev( sizeof( ET131X_ADAPTER ));
if( netdev == NULL )
{
DBG_ERROR( et131x_dbginfo,
"Alloc of net_device struct failed\n" );
DBG_LEAVE( et131x_dbginfo );
return NULL;
}
/**************************************************************************
Setup the function registration table (and other data) for a net_device
*************************************************************************/
//netdev->init = &et131x_init;
netdev->set_config = &et131x_config;
netdev->get_stats = &et131x_stats;
netdev->open = &et131x_open;
netdev->stop = &et131x_close;
netdev->do_ioctl = &et131x_ioctl;
netdev->set_multicast_list = &et131x_multicast;
netdev->hard_start_xmit = &et131x_tx;
netdev->tx_timeout = &et131x_tx_timeout;
netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
netdev->change_mtu = &et131x_change_mtu;
netdev->set_mac_address = &et131x_set_mac_addr;
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
netdev->vlan_rx_register = &et131x_vlan_rx_register;
netdev->vlan_rx_add_vid = &et131x_vlan_rx_add_vid;
netdev->vlan_rx_kill_vid = &et131x_vlan_rx_kill_vid;
#endif
//netdev->ethtool_ops = &et131x_ethtool_ops;
// Poll?
//netdev->poll = &et131x_poll;
//netdev->poll_controller = &et131x_poll_controller;
DBG_LEAVE( et131x_dbginfo );
return netdev;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_device_free()
******************************************************************************
DESCRIPTION : Free the net_device and adapter private resources for
an adapter and perform basic cleanup.
PARAMETERS : netdev - a pointer to the net_device structure
representing the device whose resources should
be freed.
RETURNS : N/A
REUSE INFORMATION :
*****************************************************************************/
void et131x_device_free( struct net_device *netdev )
{
DBG_FUNC( "et131x_device_free" );
DBG_ENTER( et131x_dbginfo );
if( netdev == NULL )
{
DBG_WARNING( et131x_dbginfo, "Pointer to net_device == NULL\n" );
DBG_LEAVE( et131x_dbginfo );
return;
}
else
{
free_netdev( netdev );
}
DBG_LEAVE( et131x_dbginfo );
return;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_init
******************************************************************************
DESCRIPTION : This function is called by the kernel to initialize a
device
PARAMETERS : netdev - a pointer to a net_device struct representing
the device to be initialized.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION : At the moment, this routine does nothing, as most init
processing needs to be performed before this point.
*****************************************************************************/
int et131x_init( struct net_device *netdev )
{
DBG_FUNC( "et131x_init" );
DBG_ENTER( et131x_dbginfo );
DBG_LEAVE( et131x_dbginfo );
return 0;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_config
******************************************************************************
DESCRIPTION : Implement the SIOCSIFMAP interface.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device to be configured.
map - a pointer to an ifmap struct
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_config( struct net_device *netdev, struct ifmap *map )
{
DBG_FUNC( "et131x_config" );
DBG_ENTER( et131x_dbginfo );
DBG_LEAVE( et131x_dbginfo );
return 0;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_stats
******************************************************************************
DESCRIPTION : Return the current device statistics.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device whose stats are being queried.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
struct net_device_stats *et131x_stats( struct net_device *netdev )
{
ET131X_ADAPTER *adapter = netdev_priv(netdev);
struct net_device_stats *stats = &adapter->net_stats;
CE_STATS_t *devstat = &adapter->Stats;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_stats" );
DBG_ENTER( et131x_dbginfo );
stats->rx_packets = devstat->ipackets;
stats->tx_packets = devstat->opackets;
stats->rx_errors = devstat->length_err + devstat->alignment_err +
devstat->crc_err + devstat->code_violations +
devstat->other_errors;
stats->tx_errors = devstat->max_pkt_error;
stats->multicast = devstat->multircv;
stats->collisions = devstat->collisions;
stats->rx_length_errors = devstat->length_err;
stats->rx_over_errors = devstat->rx_ov_flow;
stats->rx_crc_errors = devstat->crc_err;
// NOTE: These stats don't have corresponding values in CE_STATS, so we're
// going to have to update these directly from within the TX/RX code
//stats->rx_bytes = 20; //devstat->;
//stats->tx_bytes = 20; //devstat->;
//stats->rx_dropped = devstat->;
//stats->tx_dropped = devstat->;
// NOTE: Not used, can't find analogous statistics
//stats->rx_frame_errors = devstat->;
//stats->rx_fifo_errors = devstat->;
//stats->rx_missed_errors = devstat->;
//stats->tx_aborted_errors = devstat->;
//stats->tx_carrier_errors = devstat->;
//stats->tx_fifo_errors = devstat->;
//stats->tx_heartbeat_errors = devstat->;
//stats->tx_window_errors = devstat->;
DBG_LEAVE( et131x_dbginfo );
return stats;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_open
******************************************************************************
DESCRIPTION : Open the device for use.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device to be opened.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_open( struct net_device *netdev )
{
int result = 0;
ET131X_ADAPTER *adapter = NULL;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_open" );
DBG_ENTER( et131x_dbginfo );
adapter = netdev_priv( netdev );
/**************************************************************************
Start the timer to track NIC errors
*************************************************************************/
add_timer( &adapter->ErrorTimer );
/**************************************************************************
Register our ISR
*************************************************************************/
DBG_TRACE( et131x_dbginfo, "Registering ISR...\n" );
result = request_irq( netdev->irq, et131x_isr, IRQF_SHARED, netdev->name, netdev );
if( result )
{
DBG_ERROR( et131x_dbginfo, "Could not register ISR\n" );
DBG_LEAVE( et131x_dbginfo );
return result;
}
/**************************************************************************
Enable the Tx and Rx DMA engines (if not already enabled)
*************************************************************************/
et131x_rx_dma_enable( adapter );
et131x_tx_dma_enable( adapter );
/**************************************************************************
Enable device interrupts
*************************************************************************/
et131x_enable_interrupts( adapter );
MP_SET_FLAG( adapter, fMP_ADAPTER_INTERRUPT_IN_USE );
/**************************************************************************
We're ready to move some data, so start the queue
*************************************************************************/
netif_start_queue( netdev );
DBG_LEAVE( et131x_dbginfo );
return result;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_close
******************************************************************************
DESCRIPTION : Close the device.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device to be opened.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_close( struct net_device *netdev )
{
ET131X_ADAPTER *adapter = NULL;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_close" );
DBG_ENTER( et131x_dbginfo );
adapter = netdev_priv( netdev );
/**************************************************************************
First thing is to stop the queue
*************************************************************************/
netif_stop_queue( netdev );
/**************************************************************************
Stop the Tx and Rx DMA engines
*************************************************************************/
et131x_rx_dma_disable( adapter );
et131x_tx_dma_disable( adapter );
/**************************************************************************
Disable device interrupts
*************************************************************************/
et131x_disable_interrupts( adapter );
/**************************************************************************
Deregistering ISR
*************************************************************************/
MP_CLEAR_FLAG( adapter, fMP_ADAPTER_INTERRUPT_IN_USE );
DBG_TRACE( et131x_dbginfo, "Deregistering ISR...\n" );
free_irq( netdev->irq, netdev );
/**************************************************************************
Stop the error timer
*************************************************************************/
del_timer_sync( &adapter->ErrorTimer );
DBG_LEAVE( et131x_dbginfo );
return 0;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_ioctl_mii
******************************************************************************
DESCRIPTION : The function which handles MII IOCTLs
PARAMETERS : netdev - the net_device struct corresponding to the
device on which the query is being made
reqbuf - the request-specific data buffer
cmd - the command request code
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_ioctl_mii( struct net_device *netdev, struct ifreq *reqbuf, int cmd )
{
int status = 0;
ET131X_ADAPTER *pAdapter = netdev_priv(netdev);
struct mii_ioctl_data *data = if_mii( reqbuf );
UINT16 mii_reg;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_ioctl_mii" );
DBG_ENTER( et131x_dbginfo );
switch( cmd )
{
case SIOCGMIIPHY:
DBG_VERBOSE( et131x_dbginfo, "SIOCGMIIPHY\n" );
data->phy_id = pAdapter->Stats.xcvr_addr;
break;
case SIOCGMIIREG:
DBG_VERBOSE( et131x_dbginfo, "SIOCGMIIREG\n" );
if( !capable( CAP_NET_ADMIN ))
{
status = -EPERM;
}
else
{
status = MiRead( pAdapter,
pAdapter->Stats.xcvr_addr,
data->reg_num,
&data->val_out );
}
break;
case SIOCSMIIREG:
DBG_VERBOSE( et131x_dbginfo, "SIOCSMIIREG\n" );
if( !capable( CAP_NET_ADMIN ))
{
status = -EPERM;
}
else
{
mii_reg = data->val_in;
status = MiWrite( pAdapter,
pAdapter->Stats.xcvr_addr,
data->reg_num,
mii_reg );
}
break;
default:
status = -EOPNOTSUPP;
}
DBG_LEAVE( et131x_dbginfo );
return status;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_ioctl
******************************************************************************
DESCRIPTION : The I/O Control handler for the driver.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device on which the control request is
being made.
reqbuf - a pointer to the IOCTL request buffer.
cmd - the IOCTL command code.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_ioctl( struct net_device *netdev, struct ifreq *reqbuf, int cmd )
{
int status = 0;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_ioctl" );
DBG_ENTER( et131x_dbginfo );
switch( cmd )
{
case SIOCGMIIPHY:
case SIOCGMIIREG:
case SIOCSMIIREG:
status = et131x_ioctl_mii( netdev, reqbuf, cmd );
break;
default:
/* DBG_WARNING( et131x_dbginfo, "Unhandled IOCTL Code: 0x%04x\n", cmd );*/
status = -EOPNOTSUPP;
}
DBG_LEAVE( et131x_dbginfo );
return status;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_set_packet_filter
******************************************************************************
DESCRIPTION : Configures the Rx Packet filtering on the device
PARAMETERS : adapter - pointer to our private adapter structure
RETURNS : 0 on success, errno on failure
REUSE INFORMATION :
*****************************************************************************/
int et131x_set_packet_filter( ET131X_ADAPTER *adapter )
{
int status = 0;
UINT32 filter = adapter->PacketFilter;
RXMAC_CTRL_t ctrl = adapter->CSRAddress->rxmac.ctrl;
RXMAC_PF_CTRL_t pf_ctrl = adapter->CSRAddress->rxmac.pf_ctrl;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_set_packet_filter" );
DBG_ENTER( et131x_dbginfo );
/**************************************************************************
Default to disabled packet filtering. Enable it in the individual case
statements that require the device to filter something
*************************************************************************/
ctrl.bits.pkt_filter_disable = 1;
/**************************************************************************
Set us to be in promiscuous mode so we receive everything,
this is also true when we get a packet filter of 0
*************************************************************************/
if(( filter & ET131X_PACKET_TYPE_PROMISCUOUS ) || filter == 0 )
{
pf_ctrl.bits.filter_broad_en = 0;
pf_ctrl.bits.filter_multi_en = 0;
pf_ctrl.bits.filter_uni_en = 0;
}
else
{
/**********************************************************************
Set us up with Multicast packet filtering. Three cases are
possible - (1) we have a multi-cast list, (2) we receive ALL
multicast entries or (3) we receive none.
*********************************************************************/
if( filter & ET131X_PACKET_TYPE_ALL_MULTICAST )
{
DBG_VERBOSE( et131x_dbginfo,
"Multicast filtering OFF (Rx ALL MULTICAST)\n" );
pf_ctrl.bits.filter_multi_en = 0;
}
else
{
DBG_VERBOSE( et131x_dbginfo, "Multicast filtering ON\n" );
SetupDeviceForMulticast( adapter );
pf_ctrl.bits.filter_multi_en = 1;
ctrl.bits.pkt_filter_disable = 0;
}
/**********************************************************************
Set us up with Unicast packet filtering
*********************************************************************/
if( filter & ET131X_PACKET_TYPE_DIRECTED )
{
DBG_VERBOSE( et131x_dbginfo, "Unicast Filtering ON\n" );
SetupDeviceForUnicast( adapter );
pf_ctrl.bits.filter_uni_en = 1;
ctrl.bits.pkt_filter_disable = 0;
}
/**********************************************************************
Set us up with Broadcast packet filtering
*********************************************************************/
if( filter & ET131X_PACKET_TYPE_BROADCAST )
{
DBG_VERBOSE( et131x_dbginfo, "Broadcast Filtering ON\n" );
pf_ctrl.bits.filter_broad_en = 1;
ctrl.bits.pkt_filter_disable = 0;
}
else
{
DBG_VERBOSE( et131x_dbginfo, "Broadcast Filtering OFF\n" );
pf_ctrl.bits.filter_broad_en = 0;
}
/**********************************************************************
Setup the receive mac configuration registers - Packet Filter
control + the enable / disable for packet filter in the control
reg.
*********************************************************************/
adapter->CSRAddress->rxmac.pf_ctrl.value = pf_ctrl.value;
adapter->CSRAddress->rxmac.ctrl = ctrl;
}
DBG_LEAVE( et131x_dbginfo );
return status;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_multicast
******************************************************************************
DESCRIPTION : The handler to configure multicasting on the interface.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device.
RETURNS : N/A
REUSE INFORMATION :
*****************************************************************************/
void et131x_multicast( struct net_device *netdev )
{
ET131X_ADAPTER *adapter = NULL;
UINT32 PacketFilter = 0;
UINT32 count;
unsigned long lockflags;
struct dev_mc_list *mclist = netdev->mc_list;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_multicast" );
DBG_ENTER( et131x_dbginfo );
adapter = netdev_priv( netdev );
spin_lock_irqsave( &adapter->Lock, lockflags );
/**************************************************************************
Before we modify the platform-independent filter flags, store them
locally. This allows us to determine if anything's changed and if we
even need to bother the hardware
*************************************************************************/
PacketFilter = adapter->PacketFilter;
/**************************************************************************
Clear the 'multicast' flag locally; becuase we only have a single flag
to check multicast, and multiple multicast addresses can be set, this is
the easiest way to determine if more than one multicast address is being
set.
*************************************************************************/
PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
/**************************************************************************
Check the net_device flags and set the device independent flags
accordingly
*************************************************************************/
DBG_VERBOSE( et131x_dbginfo,
"MULTICAST ADDR COUNT: %d\n",
netdev->mc_count );
if( netdev->flags & IFF_PROMISC )
{
DBG_VERBOSE( et131x_dbginfo, "Request: PROMISCUOUS MODE ON\n" );
adapter->PacketFilter |= ET131X_PACKET_TYPE_PROMISCUOUS;
}
else
{
DBG_VERBOSE( et131x_dbginfo, "Request: PROMISCUOUS MODE OFF\n" );
adapter->PacketFilter &= ~ET131X_PACKET_TYPE_PROMISCUOUS;
}
if( netdev->flags & IFF_ALLMULTI )
{
DBG_VERBOSE( et131x_dbginfo, "Request: ACCEPT ALL MULTICAST\n" );
adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
}
if( netdev->mc_count > NIC_MAX_MCAST_LIST )
{
DBG_WARNING( et131x_dbginfo,
"ACCEPT ALL MULTICAST for now, as there's more Multicast "
"addresses than the HW supports\n" );
adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
}
if( netdev->mc_count < 1 )
{
DBG_VERBOSE( et131x_dbginfo, "Request: REJECT ALL MULTICAST\n" );
adapter->PacketFilter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST;
adapter->PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
}
else
{
DBG_VERBOSE( et131x_dbginfo, "Request: SET MULTICAST FILTER(S)\n" );
adapter->PacketFilter |= ET131X_PACKET_TYPE_MULTICAST;
}
/**************************************************************************
Set values in the private adapter struct
*************************************************************************/
adapter->MCAddressCount = netdev->mc_count;
if( netdev->mc_count )
{
if( mclist->dmi_addrlen != ETH_ALEN )
{
DBG_WARNING( et131x_dbginfo, "Multicast addrs are not ETH_ALEN in size\n" );
}
else
{
count = netdev->mc_count - 1;
memcpy( adapter->MCList[count], mclist->dmi_addr, ETH_ALEN );
}
}
/**************************************************************************
Are the new flags different from the previous ones? If not, then no
action is required
NOTE - This block will always update the MCList with the hardware, even
if the addresses aren't the same.
*************************************************************************/
if( PacketFilter != adapter->PacketFilter )
{
/**********************************************************************
Call the device's filter function
*********************************************************************/
DBG_VERBOSE( et131x_dbginfo,
"UPDATE REQUIRED, FLAGS changed\n" );
et131x_set_packet_filter( adapter );
}
else
{
DBG_VERBOSE( et131x_dbginfo,
"NO UPDATE REQUIRED, FLAGS didn't change\n" );
}
spin_unlock_irqrestore( &adapter->Lock, lockflags );
DBG_LEAVE( et131x_dbginfo );
return;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_tx
******************************************************************************
DESCRIPTION : The handler called when the Linux network layer wants
to a Tx a packet on the device.
PARAMETERS : skb - a pointer to the sk_buff structure which
represents the data to be Tx'd.
netdev - a pointer to a net_device struct representing
the device on which data is to be Tx'd.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_tx( struct sk_buff *skb, struct net_device *netdev )
{
int status = 0;
ET131X_ADAPTER *adapter;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_tx" );
DBG_TX_ENTER( et131x_dbginfo );
adapter = netdev_priv( netdev );
/**************************************************************************
Save the timestamp for the TX timeout watchdog
*************************************************************************/
netdev->trans_start = jiffies;
/**************************************************************************
Call the device-specific data Tx routine
*************************************************************************/
status = et131x_send_packets( skb, netdev );
/**************************************************************************
Check status and manage the netif queue if necessary
*************************************************************************/
if( status != 0 )
{
if( status == -ENOMEM )
{
DBG_VERBOSE( et131x_dbginfo, "OUT OF TCBs; STOP NETIF QUEUE\n" );
/* Put the queue to sleep until resources are available */
netif_stop_queue( netdev );
status = 1;
}
else
{
DBG_WARNING( et131x_dbginfo, "Misc error; drop packet\n" );
status = 0;
}
}
DBG_TX_LEAVE( et131x_dbginfo );
return status;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_tx_timeout
******************************************************************************
DESCRIPTION : The handler called when a Tx request times out. The
timeout period is specified by the 'tx_timeo" element in
the net_device structure (see et131x_alloc_device() to
see how this value is set).
PARAMETERS : netdev - a pointer to a net_device struct representing
the device.
RETURNS : N/A
REUSE INFORMATION :
*****************************************************************************/
void et131x_tx_timeout( struct net_device *netdev )
{
ET131X_ADAPTER *pAdapter = netdev_priv( netdev );
PMP_TCB pMpTcb;
unsigned long lockflags;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_tx_timeout" );
DBG_WARNING( et131x_dbginfo, "TX TIMEOUT\n" );
/**************************************************************************
Just skip this part if the adapter is doing link detection
*************************************************************************/
if( MP_TEST_FLAG( pAdapter, fMP_ADAPTER_LINK_DETECTION ))
{
DBG_ERROR( et131x_dbginfo, "Still doing link detection\n" );
return;
}
/**************************************************************************
Any nonrecoverable hardware error?
Checks adapter->flags for any failure in phy reading
*************************************************************************/
if( MP_TEST_FLAG( pAdapter, fMP_ADAPTER_NON_RECOVER_ERROR ))
{
DBG_WARNING( et131x_dbginfo, "Non recoverable error - remove\n" );
return;
}
/**************************************************************************
Hardware failure?
*************************************************************************/
if( MP_TEST_FLAG( pAdapter, fMP_ADAPTER_HARDWARE_ERROR ))
{
DBG_WARNING( et131x_dbginfo, "hardware error - reset\n" );
return;
}
/**************************************************************************
Is send stuck?
*************************************************************************/
spin_lock_irqsave( &pAdapter->TCBSendQLock, lockflags );
pMpTcb = pAdapter->TxRing.CurrSendHead;
if( pMpTcb != NULL )
{
pMpTcb->Count++;
if( pMpTcb->Count > NIC_SEND_HANG_THRESHOLD )
{
#if ( ET131X_DBG == 1 )
TX_STATUS_BLOCK_t txDmaComplete = *( pAdapter->TxRing.pTxStatusVa );
PTX_DESC_ENTRY_t pDesc = pAdapter->TxRing.pTxDescRingVa +
pMpTcb->WrIndex.bits.serv_req;
#endif
TX_DESC_ENTRY_t StuckDescriptors[10];
if( pMpTcb->WrIndex.bits.serv_req > 7 )
{
memcpy( StuckDescriptors,
pAdapter->TxRing.pTxDescRingVa + pMpTcb->WrIndex.bits.serv_req - 6,
sizeof( TX_DESC_ENTRY_t ) * 10 );
}
spin_unlock_irqrestore( &pAdapter->TCBSendQLock, lockflags );
DBG_WARNING( et131x_dbginfo,
"Send stuck - reset. pMpTcb->WrIndex %x, Flags 0x%08x\n",
pMpTcb->WrIndex.bits.serv_req, pMpTcb->Flags );
DBG_WARNING( et131x_dbginfo,
"pDesc 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
pDesc->DataBufferPtrHigh, pDesc->DataBufferPtrLow,
pDesc->word2.value, pDesc->word3.value );
DBG_WARNING( et131x_dbginfo,
"WbStatus 0x%08x\n",
txDmaComplete.value );
#if ( ET131X_DBG == 1 )
DumpDeviceBlock( DBG_WARNING_ON, pAdapter, 0 );
DumpDeviceBlock( DBG_WARNING_ON, pAdapter, 1 );
DumpDeviceBlock( DBG_WARNING_ON, pAdapter, 3 );
DumpDeviceBlock( DBG_WARNING_ON, pAdapter, 5 );
#endif
et131x_close( netdev );
et131x_open( netdev );
return;
}
}
spin_unlock_irqrestore( &pAdapter->TCBSendQLock, lockflags );
return;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_change_mtu
******************************************************************************
DESCRIPTION : The handler called to change the MTU for the device.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device whose MTU is to be changed.
new_mtu - the desired MTU.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
*****************************************************************************/
int et131x_change_mtu( struct net_device *netdev, int new_mtu )
{
int result = 0;
ET131X_ADAPTER *adapter = NULL;
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_change_mtu" );
DBG_ENTER( et131x_dbginfo );
/**************************************************************************
Get the private adapter structure
*************************************************************************/
adapter = netdev_priv( netdev );
if( adapter == NULL )
{
DBG_LEAVE( et131x_dbginfo );
return -ENODEV;
}
/**************************************************************************
Make sure the requested MTU is valid
*************************************************************************/
if( new_mtu == 0 || new_mtu > 9216 )
{
DBG_LEAVE( et131x_dbginfo );
return -EINVAL;
}
/**************************************************************************
Stop the netif queue
*************************************************************************/
netif_stop_queue( netdev );
/**************************************************************************
Stop the Tx and Rx DMA engines
*************************************************************************/
et131x_rx_dma_disable( adapter );
et131x_tx_dma_disable( adapter );
/**************************************************************************
Disable device interrupts
*************************************************************************/
et131x_disable_interrupts( adapter );
et131x_handle_send_interrupt( adapter );
et131x_handle_recv_interrupt( adapter );
/**************************************************************************
Set the new MTU
*************************************************************************/
netdev->mtu = new_mtu;
/**************************************************************************
Free Rx DMA memory
*************************************************************************/
et131x_adapter_memory_free( adapter );
/**************************************************************************
Set the config parameter for Jumbo Packet support
*************************************************************************/
adapter->RegistryJumboPacket = new_mtu + 14;
et131x_soft_reset( adapter );
/**************************************************************************
Alloc and init Rx DMA memory
*************************************************************************/
result = et131x_adapter_memory_alloc( adapter );
if( result != 0 )
{
DBG_WARNING( et131x_dbginfo,
"Change MTU failed; couldn't re-alloc DMA memory\n" );
return result;
}
et131x_init_send( adapter );
et131x_setup_hardware_properties( adapter );
memcpy( netdev->dev_addr, adapter->CurrentAddress, ETH_ALEN );
et131x_init_enet_crc_calc( );
/**************************************************************************
Init the device with the new settings
*************************************************************************/
et131x_adapter_setup( adapter );
/**************************************************************************
Enable interrupts
*************************************************************************/
if( MP_TEST_FLAG( adapter, fMP_ADAPTER_INTERRUPT_IN_USE ))
{
et131x_enable_interrupts( adapter );
}
/**************************************************************************
Restart the Tx and Rx DMA engines
*************************************************************************/
et131x_rx_dma_enable( adapter );
et131x_tx_dma_enable( adapter );
/**************************************************************************
Restart the netif queue
*************************************************************************/
netif_wake_queue( netdev );
DBG_LEAVE( et131x_dbginfo );
return result;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_set_mac_addr
******************************************************************************
DESCRIPTION : The handler called to change the MAC address for the
device.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device whose MAC is to be changed.
new_mac - a buffer containing a sock_addr struct in which
the desired MAC address is stored.
RETURNS : 0 on success
errno on failure (as defined in errno.h)
REUSE INFORMATION :
IMPLEMENTED BY : blux http://berndlux.de 22.01.2007 21:14
*****************************************************************************/
int et131x_set_mac_addr( struct net_device *netdev, void *new_mac )
{
int result = 0;
ET131X_ADAPTER *adapter = NULL;
struct sockaddr *address = new_mac;
DBG_FUNC( "et131x_set_mac_addr" );
DBG_ENTER( et131x_dbginfo );
// begin blux
// DBG_VERBOSE( et131x_dbginfo, "Function not implemented!!\n" );
/*-----------------------------------------------------------------------*/
/**************************************************************************
Get the private adapter structure
*************************************************************************/
adapter = netdev_priv( netdev );
if( adapter == NULL )
{
DBG_LEAVE( et131x_dbginfo );
return -ENODEV;
}
/**************************************************************************
Make sure the requested MAC is valid
*************************************************************************/
if (!is_valid_ether_addr(address->sa_data))
{
DBG_LEAVE( et131x_dbginfo );
return -EINVAL;
}
/**************************************************************************
Stop the netif queue
*************************************************************************/
netif_stop_queue( netdev );
/**************************************************************************
Stop the Tx and Rx DMA engines
*************************************************************************/
et131x_rx_dma_disable( adapter );
et131x_tx_dma_disable( adapter );
/**************************************************************************
Disable device interrupts
*************************************************************************/
et131x_disable_interrupts( adapter );
et131x_handle_send_interrupt( adapter );
et131x_handle_recv_interrupt( adapter );
/**************************************************************************
Set the new MAC
*************************************************************************/
// netdev->set_mac_address = &new_mac;
// netdev->mtu = new_mtu;
memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len);
printk("%s: Setting MAC address to %02x:%02x:%02x:%02x:%02x:%02x\n", netdev->name,
netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2],
netdev->dev_addr[3], netdev->dev_addr[4], netdev->dev_addr[5]);
/**************************************************************************
Free Rx DMA memory
*************************************************************************/
et131x_adapter_memory_free( adapter );
/**************************************************************************
Set the config parameter for Jumbo Packet support
*************************************************************************/
//adapter->RegistryJumboPacket = new_mtu + 14;
// blux: not needet here, w'll change the MAC
et131x_soft_reset( adapter );
/**************************************************************************
Alloc and init Rx DMA memory
*************************************************************************/
result = et131x_adapter_memory_alloc( adapter );
if( result != 0 )
{
DBG_WARNING( et131x_dbginfo,
"Change MAC failed; couldn't re-alloc DMA memory\n" );
return result;
}
et131x_init_send( adapter );
et131x_setup_hardware_properties( adapter );
// memcpy( netdev->dev_addr, adapter->CurrentAddress, ETH_ALEN );
// blux: no, do not override our nice address
et131x_init_enet_crc_calc( );
/**************************************************************************
Init the device with the new settings
*************************************************************************/
et131x_adapter_setup( adapter );
/**************************************************************************
Enable interrupts
*************************************************************************/
if( MP_TEST_FLAG( adapter, fMP_ADAPTER_INTERRUPT_IN_USE ))
{
et131x_enable_interrupts( adapter );
}
/**************************************************************************
Restart the Tx and Rx DMA engines
*************************************************************************/
et131x_rx_dma_enable( adapter );
et131x_tx_dma_enable( adapter );
/**************************************************************************
Restart the netif queue
*************************************************************************/
netif_wake_queue( netdev );
DBG_LEAVE( et131x_dbginfo );
return result;
}
/*===========================================================================*/
/******************************************************************************
NOTE: The ET1310 doesn't support hardware VLAN tagging, so these functions
are currently not used; they are in place to eventually support the
feature if needed.
*****************************************************************************/
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
/******************************************************************************
ROUTINE : et131x_vlan_rx_register
******************************************************************************
DESCRIPTION : The handler called to enable or disable VLAN support on
the device.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device on which VLAN should be enabled or
disabled.
RETURNS : N/A
REUSE INFORMATION :
*****************************************************************************/
void et131x_vlan_rx_register( struct net_device *netdev, struct vlan_group *grp )
{
ET131X_ADAPTER *pAdapter = netdev_priv( netdev );
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_vlan_rx_register" );
DBG_ENTER( et131x_dbginfo );
/**************************************************************************
Track the vlan_group struct in the adapter private structure; if this
element is NULL, then VLAN is disabled; otherwise, it is enabled.
*************************************************************************/
if( grp )
{
DBG_VERBOSE( et131x_dbginfo, "VLAN: Enable, 0x%p\n", grp );
}
else
{
DBG_VERBOSE( et131x_dbginfo, "VLAN: Disable\n" );
}
pAdapter->vlgrp = grp;
/**************************************************************************
This is where any interfacing with the hardware to enable or disable
VLAN would be done. Since the ET1310 doesn't handle this in hardware,
nothing else needs to be done.
*************************************************************************/
DBG_LEAVE( et131x_dbginfo );
return;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_vlan_rx_add_vid
******************************************************************************
DESCRIPTION : The handler called to register a VLAN tag.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device on which a VLAN tag should be added.
RETURNS : N/A
REUSE INFORMATION :
*****************************************************************************/
void et131x_vlan_rx_add_vid( struct net_device *netdev, UINT16 vid )
{
DBG_FUNC( "et131x_vlan_rx_add_vid" );
DBG_ENTER( et131x_dbginfo );
DBG_VERBOSE( et131x_dbginfo, "VLAN, Add VID: %d\n", vid );
/**************************************************************************
This is where any interfacing with the hardware to register VLAN IDs
would take place. Since the ET1310 doesn't handle this in hardware,
nothing else needs to be done here; the vlan_group structure's
vlan_devices element can be used in the TX/RX routines to determine if
a VLAN tag has been 'registered' with the device.
*************************************************************************/
DBG_LEAVE( et131x_dbginfo );
return;
}
/*===========================================================================*/
/******************************************************************************
ROUTINE : et131x_vlan_rx_kill_vid
******************************************************************************
DESCRIPTION : The handler called to deregister a VLAN tag.
PARAMETERS : netdev - a pointer to a net_device struct representing
the device on which a VLAN tag should be
removed.
RETURNS : N/A
REUSE INFORMATION :
*****************************************************************************/
void et131x_vlan_rx_kill_vid( struct net_device *netdev, UINT16 vid )
{
ET131X_ADAPTER *pAdapter = netdev_priv( netdev );
/*-----------------------------------------------------------------------*/
DBG_FUNC( "et131x_vlan_rx_kill_vid" );
DBG_ENTER( et131x_dbginfo );
DBG_VERBOSE( et131x_dbginfo, "VLAN, Remove VID: %d\n", vid );
if( pAdapter->vlgrp )
{
pAdapter->vlgrp->vlan_devices_arrays[vid] = NULL;
}
/**************************************************************************
This is where any interfacing with the hardware to deregister VLAN IDs
would take place. Since the ET1310 doesn't handle this in hardware,
nothing else needs to be done here.
*************************************************************************/
DBG_LEAVE( et131x_dbginfo );
return;
}
/*===========================================================================*/
#endif
|