mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
Interfaces / Hardware settings - Overwite global settings, closes https://github.com/opnsense/core/issues/5050
This commit is contained in:
parent
5457e046d8
commit
a98d776fa4
@ -385,11 +385,21 @@ function legacy_interface_details($intf)
|
||||
function configure_interface_hardware($ifs)
|
||||
{
|
||||
global $config;
|
||||
$hwsettings = $config['system'];
|
||||
if (stristr($ifs, "_vlan")) {
|
||||
/* skip vlans for checksumming */
|
||||
return;
|
||||
}
|
||||
$intf_details = legacy_interface_details($ifs);
|
||||
// interface overwrites
|
||||
foreach ($config['interfaces'] as $iface => $ifconf) {
|
||||
if (!empty($ifconf['if']) && $ifconf['if'] == $ifs) {
|
||||
if (!empty($ifconf['hw_settings_overwrite'])) {
|
||||
$hwsettings = $ifconf;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!empty($intf_details)) {
|
||||
// get current settings
|
||||
$csum_set = in_array('rxcsum', $intf_details['options']) || in_array('txcsum', $intf_details['options']);
|
||||
@ -398,33 +408,33 @@ function configure_interface_hardware($ifs)
|
||||
$lro_set = in_array('lro', $intf_details['options']);
|
||||
|
||||
// hardware checksum offloading offloading
|
||||
if (isset($config['system']['disablechecksumoffloading']) && $csum_set) {
|
||||
if (isset($hwsettings['disablechecksumoffloading']) && $csum_set) {
|
||||
legacy_interface_flags($ifs, '-txcsum -rxcsum', false);
|
||||
} elseif (!isset($config['system']['disablechecksumoffloading']) && !$csum_set) {
|
||||
} elseif (!isset($hwsettings['disablechecksumoffloading']) && !$csum_set) {
|
||||
legacy_interface_flags($ifs, 'txcsum rxcsum', false);
|
||||
}
|
||||
if (isset($config['system']['disablechecksumoffloading']) && $csumv6_set) {
|
||||
if (isset($hwsettings['disablechecksumoffloading']) && $csumv6_set) {
|
||||
legacy_interface_flags($ifs, '-txcsum6 -rxcsum6', false);
|
||||
} elseif (!isset($config['system']['disablechecksumoffloading']) && !$csumv6_set) {
|
||||
} elseif (!isset($hwsettings['disablechecksumoffloading']) && !$csumv6_set) {
|
||||
legacy_interface_flags($ifs, 'txcsum6 rxcsum6', false);
|
||||
}
|
||||
|
||||
// TCP segmentation offloading
|
||||
if (isset($config['system']['disablesegmentationoffloading']) && $tso_set) {
|
||||
if (isset($hwsettings['disablesegmentationoffloading']) && $tso_set) {
|
||||
legacy_interface_flags($ifs, '-tso', false);
|
||||
} elseif (!isset($config['system']['disablesegmentationoffloading']) && !$tso_set) {
|
||||
} elseif (!isset($hwsettings['disablesegmentationoffloading']) && !$tso_set) {
|
||||
legacy_interface_flags($ifs, 'tso', false);
|
||||
}
|
||||
|
||||
// large receive offload
|
||||
if (isset($config['system']['disablelargereceiveoffloading']) && $lro_set) {
|
||||
if (isset($hwsettings['disablelargereceiveoffloading']) && $lro_set) {
|
||||
legacy_interface_flags($ifs, '-lro', false);
|
||||
} elseif (!isset($config['system']['disablelargereceiveoffloading']) && !$lro_set) {
|
||||
} elseif (!isset($hwsettings['disablelargereceiveoffloading']) && !$lro_set) {
|
||||
legacy_interface_flags($ifs, 'lro', false);
|
||||
}
|
||||
|
||||
// disable/enable hardware vlan tags, will be skipped when "Leave default" (option 2) is selected
|
||||
if (!isset($config['system']['disablevlanhwfilter']) || $config['system']['disablevlanhwfilter'] == 1) {
|
||||
if (!isset($hwsettings['disablevlanhwfilter']) || $hwsettings['disablevlanhwfilter'] == 1) {
|
||||
// probe already selected options
|
||||
$selected_opts = array();
|
||||
if (!empty($intf_details['options'])) {
|
||||
@ -438,9 +448,9 @@ function configure_interface_hardware($ifs)
|
||||
}
|
||||
// set one tag at a time to avoid driver issues
|
||||
foreach (array('vlanhwtag', 'vlanhwfilter', 'vlanhwtso', 'vlanhwcsum') as $tag) {
|
||||
if (!isset($config['system']['disablevlanhwfilter']) && !in_array($tag, $selected_opts)) {
|
||||
if (!isset($hwsettings['disablevlanhwfilter']) && !in_array($tag, $selected_opts)) {
|
||||
legacy_interface_flags($ifs, $tag);
|
||||
} elseif (isset($config['system']['disablevlanhwfilter']) && in_array($tag, $selected_opts)) {
|
||||
} elseif (isset($hwsettings['disablevlanhwfilter']) && in_array($tag, $selected_opts)) {
|
||||
legacy_interface_flags($ifs, '-' . $tag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,6 +388,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
'subnetv6',
|
||||
'track6-interface',
|
||||
'track6-prefix-id',
|
||||
'hw_settings_overwrite',
|
||||
'disablechecksumoffloading',
|
||||
'disablesegmentationoffloading',
|
||||
'disablelargereceiveoffloading',
|
||||
'disablevlanhwfilter',
|
||||
);
|
||||
foreach ($std_copy_fieldnames as $fieldname) {
|
||||
$pconfig[$fieldname] = isset($a_interfaces[$if][$fieldname]) ? $a_interfaces[$if][$fieldname] : null;
|
||||
@ -1307,6 +1312,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// quite obscure this... copies parts of the config
|
||||
interface_sync_wireless_clones($new_config, true);
|
||||
}
|
||||
// hardware (offloading) Settings
|
||||
if (!empty($pconfig['hw_settings_overwrite'])) {
|
||||
$new_config['hw_settings_overwrite'] = true;
|
||||
if (!empty($pconfig['disablechecksumoffloading'])) {
|
||||
$new_config['disablechecksumoffloading'] = true;
|
||||
}
|
||||
if (!empty($pconfig['disablesegmentationoffloading'])) {
|
||||
$new_config['disablesegmentationoffloading'] = true;
|
||||
}
|
||||
if (!empty($pconfig['disablelargereceiveoffloading'])) {
|
||||
$new_config['disablelargereceiveoffloading'] = true;
|
||||
}
|
||||
if (!empty($pconfig['disablevlanhwfilter'])) {
|
||||
$new_config['disablevlanhwfilter'] = $pconfig['disablevlanhwfilter'];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($new_ppp_config) > 0) {
|
||||
// ppp details changed
|
||||
@ -1699,6 +1720,15 @@ include("head.inc");
|
||||
});
|
||||
$("#mtu").change();
|
||||
|
||||
// toggle hardware settings visibility
|
||||
$("#hw_settings_overwrite").change(function(){
|
||||
if ($("#hw_settings_overwrite").is(':checked')) {
|
||||
$(".hw_settings_overwrite").show();
|
||||
} else {
|
||||
$(".hw_settings_overwrite").hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
window_highlight_table_option();
|
||||
});
|
||||
</script>
|
||||
@ -1913,6 +1943,78 @@ include("head.inc");
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Hardware settings -->
|
||||
<div class="tab-content content-box col-xs-12 __mb">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped opnsense_standard_table_form">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?=gettext("Hardware settings"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:22%"><a id="help_for_hw_settings_overwrite" href="#" class="showhelp"> <i class="fa fa-info-circle"></i></a> <?=gettext("Overwite global settings"); ?></td>
|
||||
<td style="width:78%">
|
||||
<input id="hw_settings_overwrite" name="hw_settings_overwrite" type="checkbox" value="yes" <?=!empty($pconfig['hw_settings_overwrite']) ? 'checked="checked"' : '' ?>/>
|
||||
<div class="hidden" data-for="help_for_hw_settings_overwrite">
|
||||
<?=gettext("Overwrite custom interface hardware settings with settings specified below"); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="hw_settings_overwrite" style="display:none">
|
||||
<td><a id="help_for_disablechecksumoffloading" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Hardware CRC"); ?></td>
|
||||
<td>
|
||||
<input name="disablechecksumoffloading" type="checkbox" id="disablechecksumoffloading" value="yes" <?= !empty($pconfig['disablechecksumoffloading']) ? "checked=\"checked\"" :"";?> />
|
||||
<strong><?=gettext("Disable hardware checksum offload"); ?></strong>
|
||||
<div class="hidden" data-for="help_for_disablechecksumoffloading">
|
||||
<?=gettext("Checking this option will disable hardware checksum offloading. Checksum offloading is broken in some hardware, particularly some Realtek cards. Rarely, drivers may have problems with checksum offloading and some specific NICs."); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="hw_settings_overwrite" style="display:none">
|
||||
<td><a id="help_for_disablesegmentationoffloading" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Hardware TSO"); ?></td>
|
||||
<td>
|
||||
<input name="disablesegmentationoffloading" type="checkbox" id="disablesegmentationoffloading" value="yes" <?= !empty($pconfig['disablesegmentationoffloading']) ? "checked=\"checked\"" :"";?>/>
|
||||
<strong><?=gettext("Disable hardware TCP segmentation offload"); ?></strong><br />
|
||||
<div class="hidden" data-for="help_for_disablesegmentationoffloading">
|
||||
<?=gettext("Checking this option will disable hardware TCP segmentation offloading (TSO, TSO4, TSO6). This offloading is broken in some hardware drivers, and may impact performance with some specific NICs."); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="hw_settings_overwrite" style="display:none">
|
||||
<td><a id="help_for_disablelargereceiveoffloading" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Hardware LRO"); ?></td>
|
||||
<td>
|
||||
<input name="disablelargereceiveoffloading" type="checkbox" id="disablelargereceiveoffloading" value="yes" <?= !empty($pconfig['disablelargereceiveoffloading']) ? "checked=\"checked\"" :"";?>/>
|
||||
<strong><?=gettext("Disable hardware large receive offload"); ?></strong><br />
|
||||
<div class="hidden" data-for="help_for_disablelargereceiveoffloading">
|
||||
<?=gettext("Checking this option will disable hardware large receive offloading (LRO). This offloading is broken in some hardware drivers, and may impact performance with some specific NICs."); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="hw_settings_overwrite" style="display:none">
|
||||
<td><a id="help_for_disablevlanhwfilter" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("VLAN Hardware Filtering"); ?></td>
|
||||
<td>
|
||||
<select name="disablevlanhwfilter" class="selectpicker">
|
||||
<option value="0" <?=$pconfig['disablevlanhwfilter'] == "0" ? "selected=\"selected\"" : "";?> >
|
||||
<?=gettext("Enable VLAN Hardware Filtering");?>
|
||||
</option>
|
||||
<option value="1" <?=$pconfig['disablevlanhwfilter'] == "1" ? "selected=\"selected\"" : "";?> >
|
||||
<?=gettext("Disable VLAN Hardware Filtering"); ?>
|
||||
</option>
|
||||
<option value="2" <?=$pconfig['disablevlanhwfilter'] == "2" ? "selected=\"selected\"" : "";?> >
|
||||
<?=gettext("Leave default");?>
|
||||
</option>
|
||||
</select>
|
||||
<div class="hidden" data-for="help_for_disablevlanhwfilter">
|
||||
<?= gettext('Set usage of VLAN hardware filtering. This hardware acceleration may be broken in a particular device driver, or may impact performance.') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- static IPv4 -->
|
||||
<div class="tab-content content-box col-xs-12 __mb" id="staticv4" style="display:none">
|
||||
<div class="table-responsive">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user