summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-08-17 20:42:05 +0000
committerErmal <eri@pfsense.org>2010-08-17 20:42:05 +0000
commit51d5aad75a0a88034b49db3d867e8a1e49fe2f12 (patch)
tree32437945ce6ac6c4e0753336958cc55f779ed201
parent6991dcb1b1ab5b9ab79d411b77f27bc388e50471 (diff)
downloadpfsense-51d5aad75a0a88034b49db3d867e8a1e49fe2f12.zip
pfsense-51d5aad75a0a88034b49db3d867e8a1e49fe2f12.tar.gz
Fixes #88. Actually fix all the mess that was caused by setup_microcode() which overwrote the whole decisions being made on boot from other code. Solve this by moving the setting of all interface capabilities to interface_configure() and just leaving microcode setup to setup_microcode. Also optimize and make more readble the polling setup if activated/deactivated. This also fixes the ticket issue because the settings are now kept after booting up and not overwritten by other code.
-rw-r--r--etc/inc/interfaces.inc64
-rw-r--r--etc/inc/pfsense-utils.inc80
2 files changed, 66 insertions, 78 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 3147f30..f576458 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -349,12 +349,8 @@ function interface_bridge_configure(&$bridge) {
$flags = 0;
if ($commonrx == false)
- $flags |= -IFCAP_RXCSUM;
- else
$flags |= IFCAP_RXCSUM;
if ($commontx == false)
- $flags |= -IFCAP_TXCSUM;
- else
$flags |= IFCAP_TXCSUM;
/* Add interfaces to bridge */
@@ -369,7 +365,7 @@ function interface_bridge_configure(&$bridge) {
}
/* make sure the parent interface is up */
pfSense_interface_mtu($realif1, $smallermtu);
- pfSense_interface_capabilities($realif1, $flags);
+ pfSense_interface_capabilities($realif1, -$flags);
interfaces_bring_up($realif1);
mwexec("/sbin/ifconfig {$bridgeif} addm {$realif}");
}
@@ -494,15 +490,14 @@ function interface_bridge_add_member($bridgeif, $interface) {
pfSense_interface_mtu($interface, $mtu);
$options = pfSense_get_interface_addresses($bridgeif);
- if (isset($options['encaps']['txcsum']))
- pfSense_interface_capabilities($interface, IFCAP_TXCSUM);
- else
- pfSense_interface_capabilities($interface, -IFCAP_TXCSUM);
+ $flags = 0;
+ if (!isset($options['encaps']['txcsum']))
+ $flags |= IFCAP_TXCSUM;
- if (isset($options['encaps']['rxcsum']))
- pfSense_interface_capabilities($interface, IFCAP_RXCSUM);
- else
- pfSense_interface_capabilities($interface, -IFCAP_RXCSUM);
+ if (!isset($options['encaps']['rxcsum']))
+ $flags |= IFCAP_RXCSUM;
+
+ pfSense_interface_capabilities($interface, -$flags);
interfaces_bring_up($interface);
mwexec("/sbin/ifconfig {$bridgeif} addm {$interface}");
@@ -2377,6 +2372,49 @@ function interface_configure($interface = "wan", $reloadall = false) {
if (!empty($wancfg['mtu']))
pfSense_interface_mtu($realif, $wancfg['mtu']);
+ /* skip vlans for checksumming and polling */
+ if (!stristr($realif, "vlan")) {
+ $options = pfSense_get_interface_addresses($realif);
+ $flags = 0;
+ if(isset($config['system']['disablechecksumoffloading'])) {
+ if (isset($options['encaps']['txcsum']))
+ $flags |= IFCAP_TXCSUM;
+ if (isset($options['encaps']['rxcsum']))
+ $flags |= IFCAP_RXCSUM;
+ } else {
+ if (!isset($options['caps']['txcsum']))
+ $flags |= IFCAP_TXCSUM;
+ if (!isset($options['caps']['rxcsum']))
+ $flags |= IFCAP_RXCSUM;
+ }
+
+ if(isset($config['system']['disablesegmentationoffloading'])) {
+ if (isset($options['encaps']['tso4']))
+ $flags |= IFCAP_TSO;
+ if (isset($options['encaps']['tso6']))
+ $flags |= IFCAP_TSO;
+ } else {
+ if (!isset($options['caps']['tso4']))
+ $flags |= IFCAP_TSO;
+ if (!isset($options['caps']['tso6']))
+ $flags |= IFCAP_TSO;
+ }
+
+ if(isset($config['system']['disablelargereceiveoffloading'])) {
+ if (isset($options['encaps']['lro']))
+ $flags |= IFCAP_LRO;
+ } else {
+ if (!isset($options['caps']['lro']))
+ $flags |= IFCAP_LRO;
+ }
+
+ /* if the NIC supports polling *AND* it is enabled in the GUI */
+ if (!isset($config['system']['polling']) || !isset($options['caps']['polling'])) {
+ $flags |= IFCAP_POLLING;
+ }
+ pfSense_interface_capabilities($realif, -$flags);
+ }
+
/* invalidate interface/ip/sn cache */
get_interface_arr(true);
unset($interface_ip_arr_cache[$realif]);
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index fa7da13..62e5e6f 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -180,69 +180,20 @@ function get_dns_servers() {
function enable_hardware_offloading($interface) {
global $g, $config;
- if(stristr($interface,"lnc"))
+ if(isset($config['system']['do_not_use_nic_microcode']))
return;
/* translate wan, lan, opt -> real interface if needed */
$int = get_real_interface($interface);
- if($int <> "")
- $interface = $int;
- $int_family = preg_split("/[0-9]+/", $interface);
- $options = pfSense_get_interface_addresses($interface);
- if (!is_array($options))
+ if(empty($int))
return;
+ $int_family = preg_split("/[0-9]+/", $int);
$supported_ints = array('fxp');
if (in_array($int_family, $supported_ints)) {
- if(isset($config['system']['do_not_use_nic_microcode']))
- continue;
- if(does_interface_exist($interface))
- pfSense_interface_flags($interface, IFF_LINK0);
+ if(does_interface_exist($int))
+ pfSense_interface_flags($int, IFF_LINK0);
}
- /* skip vlans for checksumming and polling */
- if(stristr($interface, "vlan"))
- return;
-
- if(isset($config['system']['disablechecksumoffloading'])) {
- if (isset($options['encaps']['txcsum']))
- pfSense_interface_capabilities($interface, -IFCAP_TXCSUM);
- if (isset($options['encaps']['rxcsum']))
- pfSense_interface_capabilities($interface, -IFCAP_RXCSUM);
- } else {
- if (isset($options['caps']['txcsum']))
- pfSense_interface_capabilities($interface, IFCAP_TXCSUM);
- if (isset($options['caps']['rxcsum']))
- pfSense_interface_capabilities($interface, IFCAP_RXCSUM);
- }
-
- if(isset($config['system']['disablesegmentationoffloading'])) {
- if (isset($options['encaps']['tso4']))
- pfSense_interface_capabilities($interface, -IFCAP_TSO);
- if (isset($options['encaps']['tso6']))
- pfSense_interface_capabilities($interface, -IFCAP_TSO);
- } else {
- if (isset($options['caps']['tso4']))
- pfSense_interface_capabilities($interface, IFCAP_TSO);
- if (isset($options['caps']['tso6']))
- pfSense_interface_capabilities($interface, IFCAP_TSO);
- }
-
- if(isset($config['system']['disablelargereceiveoffloading'])) {
- if (isset($options['encaps']['lro']))
- pfSense_interface_capabilities($interface, -IFCAP_LRO);
- } else {
- if (isset($options['caps']['lro']))
- pfSense_interface_capabilities($interface, IFCAP_LRO);
- }
-
-
- /* if the NIC supports polling *AND* it is enabled in the GUI */
- $polling = isset($config['system']['polling']);
- if($polling && isset($options['caps']['polling']))
- pfSense_interface_capabilities($interface, IFCAP_POLLING);
- else
- pfSense_interface_capabilities($interface, -IFCAP_POLLING);
-
return;
}
@@ -359,22 +310,21 @@ function setup_polling() {
setup_polling_defaults();
- $supported_ints = array('bge', 'dc', 'em', 'fwe', 'fwip', 'fxp', 'ixgb', 'ste', 'nge', 're', 'rl', 'sf', 'sis', 'ste', 'vge', 'vr', 'xl');
+ if (isset($config['system']['polling']))
+ mwexec("/sbin/sysctl kern.polling.idle_poll=1");
+ else
+ mwexec("/sbin/sysctl kern.polling.idle_poll=0");
/* if list */
$iflist = get_configured_interface_list();
foreach ($iflist as $ifent => $ifname) {
- $real_interface = convert_friendly_interface_to_real_interface_name($ifname);
- $ifdevice = substr($real_interface, 0, -1);
- if(!in_array($ifdevice, $supported_ints)) {
- continue;
- }
- if(isset($config['system']['polling'])) {
- mwexec("/sbin/ifconfig {$real_interface} polling");
- mwexec("/sbin/sysctl kern.polling.idle_poll=1");
- } else {
- mwexec("/sbin/ifconfig {$real_interface} -polling");
+ $real_interface = get_real_interface($ifname);
+ if (interface_supports_polling($real_interface)) {
+ if (isset($config['system']['polling']))
+ pfSense_interface_capabilities($real_interface, IFCAP_POLLING);
+ else
+ pfSense_interface_capabilities($real_interface, -IFCAP_POLLING);
}
}
}
OpenPOWER on IntegriCloud