diff options
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/igc/igc_main.c | 447 |
1 files changed, 446 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 87a11879bf2d..a883b3f357e7 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c | |||
@@ -620,6 +620,55 @@ static void igc_configure_tx(struct igc_adapter *adapter) | |||
620 | */ | 620 | */ |
621 | static void igc_setup_mrqc(struct igc_adapter *adapter) | 621 | static void igc_setup_mrqc(struct igc_adapter *adapter) |
622 | { | 622 | { |
623 | struct igc_hw *hw = &adapter->hw; | ||
624 | u32 j, num_rx_queues; | ||
625 | u32 mrqc, rxcsum; | ||
626 | u32 rss_key[10]; | ||
627 | |||
628 | netdev_rss_key_fill(rss_key, sizeof(rss_key)); | ||
629 | for (j = 0; j < 10; j++) | ||
630 | wr32(IGC_RSSRK(j), rss_key[j]); | ||
631 | |||
632 | num_rx_queues = adapter->rss_queues; | ||
633 | |||
634 | if (adapter->rss_indir_tbl_init != num_rx_queues) { | ||
635 | for (j = 0; j < IGC_RETA_SIZE; j++) | ||
636 | adapter->rss_indir_tbl[j] = | ||
637 | (j * num_rx_queues) / IGC_RETA_SIZE; | ||
638 | adapter->rss_indir_tbl_init = num_rx_queues; | ||
639 | } | ||
640 | igc_write_rss_indir_tbl(adapter); | ||
641 | |||
642 | /* Disable raw packet checksumming so that RSS hash is placed in | ||
643 | * descriptor on writeback. No need to enable TCP/UDP/IP checksum | ||
644 | * offloads as they are enabled by default | ||
645 | */ | ||
646 | rxcsum = rd32(IGC_RXCSUM); | ||
647 | rxcsum |= IGC_RXCSUM_PCSD; | ||
648 | |||
649 | /* Enable Receive Checksum Offload for SCTP */ | ||
650 | rxcsum |= IGC_RXCSUM_CRCOFL; | ||
651 | |||
652 | /* Don't need to set TUOFL or IPOFL, they default to 1 */ | ||
653 | wr32(IGC_RXCSUM, rxcsum); | ||
654 | |||
655 | /* Generate RSS hash based on packet types, TCP/UDP | ||
656 | * port numbers and/or IPv4/v6 src and dst addresses | ||
657 | */ | ||
658 | mrqc = IGC_MRQC_RSS_FIELD_IPV4 | | ||
659 | IGC_MRQC_RSS_FIELD_IPV4_TCP | | ||
660 | IGC_MRQC_RSS_FIELD_IPV6 | | ||
661 | IGC_MRQC_RSS_FIELD_IPV6_TCP | | ||
662 | IGC_MRQC_RSS_FIELD_IPV6_TCP_EX; | ||
663 | |||
664 | if (adapter->flags & IGC_FLAG_RSS_FIELD_IPV4_UDP) | ||
665 | mrqc |= IGC_MRQC_RSS_FIELD_IPV4_UDP; | ||
666 | if (adapter->flags & IGC_FLAG_RSS_FIELD_IPV6_UDP) | ||
667 | mrqc |= IGC_MRQC_RSS_FIELD_IPV6_UDP; | ||
668 | |||
669 | mrqc |= IGC_MRQC_ENABLE_RSS_MQ; | ||
670 | |||
671 | wr32(IGC_MRQC, mrqc); | ||
623 | } | 672 | } |
624 | 673 | ||
625 | /** | 674 | /** |
@@ -1738,12 +1787,200 @@ void igc_up(struct igc_adapter *adapter) | |||
1738 | * igc_update_stats - Update the board statistics counters | 1787 | * igc_update_stats - Update the board statistics counters |
1739 | * @adapter: board private structure | 1788 | * @adapter: board private structure |
1740 | */ | 1789 | */ |
1741 | static void igc_update_stats(struct igc_adapter *adapter) | 1790 | void igc_update_stats(struct igc_adapter *adapter) |
1742 | { | 1791 | { |
1792 | struct rtnl_link_stats64 *net_stats = &adapter->stats64; | ||
1793 | struct pci_dev *pdev = adapter->pdev; | ||
1794 | struct igc_hw *hw = &adapter->hw; | ||
1795 | u64 _bytes, _packets; | ||
1796 | u64 bytes, packets; | ||
1797 | unsigned int start; | ||
1798 | u32 mpc; | ||
1799 | int i; | ||
1800 | |||
1801 | /* Prevent stats update while adapter is being reset, or if the pci | ||
1802 | * connection is down. | ||
1803 | */ | ||
1804 | if (adapter->link_speed == 0) | ||
1805 | return; | ||
1806 | if (pci_channel_offline(pdev)) | ||
1807 | return; | ||
1808 | |||
1809 | packets = 0; | ||
1810 | bytes = 0; | ||
1811 | |||
1812 | rcu_read_lock(); | ||
1813 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
1814 | struct igc_ring *ring = adapter->rx_ring[i]; | ||
1815 | u32 rqdpc = rd32(IGC_RQDPC(i)); | ||
1816 | |||
1817 | if (hw->mac.type >= igc_i225) | ||
1818 | wr32(IGC_RQDPC(i), 0); | ||
1819 | |||
1820 | if (rqdpc) { | ||
1821 | ring->rx_stats.drops += rqdpc; | ||
1822 | net_stats->rx_fifo_errors += rqdpc; | ||
1823 | } | ||
1824 | |||
1825 | do { | ||
1826 | start = u64_stats_fetch_begin_irq(&ring->rx_syncp); | ||
1827 | _bytes = ring->rx_stats.bytes; | ||
1828 | _packets = ring->rx_stats.packets; | ||
1829 | } while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start)); | ||
1830 | bytes += _bytes; | ||
1831 | packets += _packets; | ||
1832 | } | ||
1833 | |||
1834 | net_stats->rx_bytes = bytes; | ||
1835 | net_stats->rx_packets = packets; | ||
1836 | |||
1837 | packets = 0; | ||
1838 | bytes = 0; | ||
1839 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
1840 | struct igc_ring *ring = adapter->tx_ring[i]; | ||
1841 | |||
1842 | do { | ||
1843 | start = u64_stats_fetch_begin_irq(&ring->tx_syncp); | ||
1844 | _bytes = ring->tx_stats.bytes; | ||
1845 | _packets = ring->tx_stats.packets; | ||
1846 | } while (u64_stats_fetch_retry_irq(&ring->tx_syncp, start)); | ||
1847 | bytes += _bytes; | ||
1848 | packets += _packets; | ||
1849 | } | ||
1850 | net_stats->tx_bytes = bytes; | ||
1851 | net_stats->tx_packets = packets; | ||
1852 | rcu_read_unlock(); | ||
1853 | |||
1854 | /* read stats registers */ | ||
1855 | adapter->stats.crcerrs += rd32(IGC_CRCERRS); | ||
1856 | adapter->stats.gprc += rd32(IGC_GPRC); | ||
1857 | adapter->stats.gorc += rd32(IGC_GORCL); | ||
1858 | rd32(IGC_GORCH); /* clear GORCL */ | ||
1859 | adapter->stats.bprc += rd32(IGC_BPRC); | ||
1860 | adapter->stats.mprc += rd32(IGC_MPRC); | ||
1861 | adapter->stats.roc += rd32(IGC_ROC); | ||
1862 | |||
1863 | adapter->stats.prc64 += rd32(IGC_PRC64); | ||
1864 | adapter->stats.prc127 += rd32(IGC_PRC127); | ||
1865 | adapter->stats.prc255 += rd32(IGC_PRC255); | ||
1866 | adapter->stats.prc511 += rd32(IGC_PRC511); | ||
1867 | adapter->stats.prc1023 += rd32(IGC_PRC1023); | ||
1868 | adapter->stats.prc1522 += rd32(IGC_PRC1522); | ||
1869 | adapter->stats.symerrs += rd32(IGC_SYMERRS); | ||
1870 | adapter->stats.sec += rd32(IGC_SEC); | ||
1871 | |||
1872 | mpc = rd32(IGC_MPC); | ||
1873 | adapter->stats.mpc += mpc; | ||
1874 | net_stats->rx_fifo_errors += mpc; | ||
1875 | adapter->stats.scc += rd32(IGC_SCC); | ||
1876 | adapter->stats.ecol += rd32(IGC_ECOL); | ||
1877 | adapter->stats.mcc += rd32(IGC_MCC); | ||
1878 | adapter->stats.latecol += rd32(IGC_LATECOL); | ||
1879 | adapter->stats.dc += rd32(IGC_DC); | ||
1880 | adapter->stats.rlec += rd32(IGC_RLEC); | ||
1881 | adapter->stats.xonrxc += rd32(IGC_XONRXC); | ||
1882 | adapter->stats.xontxc += rd32(IGC_XONTXC); | ||
1883 | adapter->stats.xoffrxc += rd32(IGC_XOFFRXC); | ||
1884 | adapter->stats.xofftxc += rd32(IGC_XOFFTXC); | ||
1885 | adapter->stats.fcruc += rd32(IGC_FCRUC); | ||
1886 | adapter->stats.gptc += rd32(IGC_GPTC); | ||
1887 | adapter->stats.gotc += rd32(IGC_GOTCL); | ||
1888 | rd32(IGC_GOTCH); /* clear GOTCL */ | ||
1889 | adapter->stats.rnbc += rd32(IGC_RNBC); | ||
1890 | adapter->stats.ruc += rd32(IGC_RUC); | ||
1891 | adapter->stats.rfc += rd32(IGC_RFC); | ||
1892 | adapter->stats.rjc += rd32(IGC_RJC); | ||
1893 | adapter->stats.tor += rd32(IGC_TORH); | ||
1894 | adapter->stats.tot += rd32(IGC_TOTH); | ||
1895 | adapter->stats.tpr += rd32(IGC_TPR); | ||
1896 | |||
1897 | adapter->stats.ptc64 += rd32(IGC_PTC64); | ||
1898 | adapter->stats.ptc127 += rd32(IGC_PTC127); | ||
1899 | adapter->stats.ptc255 += rd32(IGC_PTC255); | ||
1900 | adapter->stats.ptc511 += rd32(IGC_PTC511); | ||
1901 | adapter->stats.ptc1023 += rd32(IGC_PTC1023); | ||
1902 | adapter->stats.ptc1522 += rd32(IGC_PTC1522); | ||
1903 | |||
1904 | adapter->stats.mptc += rd32(IGC_MPTC); | ||
1905 | adapter->stats.bptc += rd32(IGC_BPTC); | ||
1906 | |||
1907 | adapter->stats.tpt += rd32(IGC_TPT); | ||
1908 | adapter->stats.colc += rd32(IGC_COLC); | ||
1909 | |||
1910 | adapter->stats.algnerrc += rd32(IGC_ALGNERRC); | ||
1911 | |||
1912 | adapter->stats.tsctc += rd32(IGC_TSCTC); | ||
1913 | adapter->stats.tsctfc += rd32(IGC_TSCTFC); | ||
1914 | |||
1915 | adapter->stats.iac += rd32(IGC_IAC); | ||
1916 | adapter->stats.icrxoc += rd32(IGC_ICRXOC); | ||
1917 | adapter->stats.icrxptc += rd32(IGC_ICRXPTC); | ||
1918 | adapter->stats.icrxatc += rd32(IGC_ICRXATC); | ||
1919 | adapter->stats.ictxptc += rd32(IGC_ICTXPTC); | ||
1920 | adapter->stats.ictxatc += rd32(IGC_ICTXATC); | ||
1921 | adapter->stats.ictxqec += rd32(IGC_ICTXQEC); | ||
1922 | adapter->stats.ictxqmtc += rd32(IGC_ICTXQMTC); | ||
1923 | adapter->stats.icrxdmtc += rd32(IGC_ICRXDMTC); | ||
1924 | |||
1925 | /* Fill out the OS statistics structure */ | ||
1926 | net_stats->multicast = adapter->stats.mprc; | ||
1927 | net_stats->collisions = adapter->stats.colc; | ||
1928 | |||
1929 | /* Rx Errors */ | ||
1930 | |||
1931 | /* RLEC on some newer hardware can be incorrect so build | ||
1932 | * our own version based on RUC and ROC | ||
1933 | */ | ||
1934 | net_stats->rx_errors = adapter->stats.rxerrc + | ||
1935 | adapter->stats.crcerrs + adapter->stats.algnerrc + | ||
1936 | adapter->stats.ruc + adapter->stats.roc + | ||
1937 | adapter->stats.cexterr; | ||
1938 | net_stats->rx_length_errors = adapter->stats.ruc + | ||
1939 | adapter->stats.roc; | ||
1940 | net_stats->rx_crc_errors = adapter->stats.crcerrs; | ||
1941 | net_stats->rx_frame_errors = adapter->stats.algnerrc; | ||
1942 | net_stats->rx_missed_errors = adapter->stats.mpc; | ||
1943 | |||
1944 | /* Tx Errors */ | ||
1945 | net_stats->tx_errors = adapter->stats.ecol + | ||
1946 | adapter->stats.latecol; | ||
1947 | net_stats->tx_aborted_errors = adapter->stats.ecol; | ||
1948 | net_stats->tx_window_errors = adapter->stats.latecol; | ||
1949 | net_stats->tx_carrier_errors = adapter->stats.tncrs; | ||
1950 | |||
1951 | /* Tx Dropped needs to be maintained elsewhere */ | ||
1952 | |||
1953 | /* Management Stats */ | ||
1954 | adapter->stats.mgptc += rd32(IGC_MGTPTC); | ||
1955 | adapter->stats.mgprc += rd32(IGC_MGTPRC); | ||
1956 | adapter->stats.mgpdc += rd32(IGC_MGTPDC); | ||
1743 | } | 1957 | } |
1744 | 1958 | ||
1745 | static void igc_nfc_filter_exit(struct igc_adapter *adapter) | 1959 | static void igc_nfc_filter_exit(struct igc_adapter *adapter) |
1746 | { | 1960 | { |
1961 | struct igc_nfc_filter *rule; | ||
1962 | |||
1963 | spin_lock(&adapter->nfc_lock); | ||
1964 | |||
1965 | hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) | ||
1966 | igc_erase_filter(adapter, rule); | ||
1967 | |||
1968 | hlist_for_each_entry(rule, &adapter->cls_flower_list, nfc_node) | ||
1969 | igc_erase_filter(adapter, rule); | ||
1970 | |||
1971 | spin_unlock(&adapter->nfc_lock); | ||
1972 | } | ||
1973 | |||
1974 | static void igc_nfc_filter_restore(struct igc_adapter *adapter) | ||
1975 | { | ||
1976 | struct igc_nfc_filter *rule; | ||
1977 | |||
1978 | spin_lock(&adapter->nfc_lock); | ||
1979 | |||
1980 | hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) | ||
1981 | igc_add_filter(adapter, rule); | ||
1982 | |||
1983 | spin_unlock(&adapter->nfc_lock); | ||
1747 | } | 1984 | } |
1748 | 1985 | ||
1749 | /** | 1986 | /** |
@@ -1890,6 +2127,86 @@ static struct net_device_stats *igc_get_stats(struct net_device *netdev) | |||
1890 | return &netdev->stats; | 2127 | return &netdev->stats; |
1891 | } | 2128 | } |
1892 | 2129 | ||
2130 | static netdev_features_t igc_fix_features(struct net_device *netdev, | ||
2131 | netdev_features_t features) | ||
2132 | { | ||
2133 | /* Since there is no support for separate Rx/Tx vlan accel | ||
2134 | * enable/disable make sure Tx flag is always in same state as Rx. | ||
2135 | */ | ||
2136 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | ||
2137 | features |= NETIF_F_HW_VLAN_CTAG_TX; | ||
2138 | else | ||
2139 | features &= ~NETIF_F_HW_VLAN_CTAG_TX; | ||
2140 | |||
2141 | return features; | ||
2142 | } | ||
2143 | |||
2144 | static int igc_set_features(struct net_device *netdev, | ||
2145 | netdev_features_t features) | ||
2146 | { | ||
2147 | netdev_features_t changed = netdev->features ^ features; | ||
2148 | struct igc_adapter *adapter = netdev_priv(netdev); | ||
2149 | |||
2150 | /* Add VLAN support */ | ||
2151 | if (!(changed & (NETIF_F_RXALL | NETIF_F_NTUPLE))) | ||
2152 | return 0; | ||
2153 | |||
2154 | if (!(features & NETIF_F_NTUPLE)) { | ||
2155 | struct hlist_node *node2; | ||
2156 | struct igc_nfc_filter *rule; | ||
2157 | |||
2158 | spin_lock(&adapter->nfc_lock); | ||
2159 | hlist_for_each_entry_safe(rule, node2, | ||
2160 | &adapter->nfc_filter_list, nfc_node) { | ||
2161 | igc_erase_filter(adapter, rule); | ||
2162 | hlist_del(&rule->nfc_node); | ||
2163 | kfree(rule); | ||
2164 | } | ||
2165 | spin_unlock(&adapter->nfc_lock); | ||
2166 | adapter->nfc_filter_count = 0; | ||
2167 | } | ||
2168 | |||
2169 | netdev->features = features; | ||
2170 | |||
2171 | if (netif_running(netdev)) | ||
2172 | igc_reinit_locked(adapter); | ||
2173 | else | ||
2174 | igc_reset(adapter); | ||
2175 | |||
2176 | return 1; | ||
2177 | } | ||
2178 | |||
2179 | static netdev_features_t | ||
2180 | igc_features_check(struct sk_buff *skb, struct net_device *dev, | ||
2181 | netdev_features_t features) | ||
2182 | { | ||
2183 | unsigned int network_hdr_len, mac_hdr_len; | ||
2184 | |||
2185 | /* Make certain the headers can be described by a context descriptor */ | ||
2186 | mac_hdr_len = skb_network_header(skb) - skb->data; | ||
2187 | if (unlikely(mac_hdr_len > IGC_MAX_MAC_HDR_LEN)) | ||
2188 | return features & ~(NETIF_F_HW_CSUM | | ||
2189 | NETIF_F_SCTP_CRC | | ||
2190 | NETIF_F_HW_VLAN_CTAG_TX | | ||
2191 | NETIF_F_TSO | | ||
2192 | NETIF_F_TSO6); | ||
2193 | |||
2194 | network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); | ||
2195 | if (unlikely(network_hdr_len > IGC_MAX_NETWORK_HDR_LEN)) | ||
2196 | return features & ~(NETIF_F_HW_CSUM | | ||
2197 | NETIF_F_SCTP_CRC | | ||
2198 | NETIF_F_TSO | | ||
2199 | NETIF_F_TSO6); | ||
2200 | |||
2201 | /* We can only support IPv4 TSO in tunnels if we can mangle the | ||
2202 | * inner IP ID field, so strip TSO if MANGLEID is not supported. | ||
2203 | */ | ||
2204 | if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) | ||
2205 | features &= ~NETIF_F_TSO; | ||
2206 | |||
2207 | return features; | ||
2208 | } | ||
2209 | |||
1893 | /** | 2210 | /** |
1894 | * igc_configure - configure the hardware for RX and TX | 2211 | * igc_configure - configure the hardware for RX and TX |
1895 | * @adapter: private board structure | 2212 | * @adapter: private board structure |
@@ -1906,6 +2223,7 @@ static void igc_configure(struct igc_adapter *adapter) | |||
1906 | igc_setup_mrqc(adapter); | 2223 | igc_setup_mrqc(adapter); |
1907 | igc_setup_rctl(adapter); | 2224 | igc_setup_rctl(adapter); |
1908 | 2225 | ||
2226 | igc_nfc_filter_restore(adapter); | ||
1909 | igc_configure_tx(adapter); | 2227 | igc_configure_tx(adapter); |
1910 | igc_configure_rx(adapter); | 2228 | igc_configure_rx(adapter); |
1911 | 2229 | ||
@@ -1967,6 +2285,127 @@ static void igc_set_default_mac_filter(struct igc_adapter *adapter) | |||
1967 | igc_rar_set_index(adapter, 0); | 2285 | igc_rar_set_index(adapter, 0); |
1968 | } | 2286 | } |
1969 | 2287 | ||
2288 | /* If the filter to be added and an already existing filter express | ||
2289 | * the same address and address type, it should be possible to only | ||
2290 | * override the other configurations, for example the queue to steer | ||
2291 | * traffic. | ||
2292 | */ | ||
2293 | static bool igc_mac_entry_can_be_used(const struct igc_mac_addr *entry, | ||
2294 | const u8 *addr, const u8 flags) | ||
2295 | { | ||
2296 | if (!(entry->state & IGC_MAC_STATE_IN_USE)) | ||
2297 | return true; | ||
2298 | |||
2299 | if ((entry->state & IGC_MAC_STATE_SRC_ADDR) != | ||
2300 | (flags & IGC_MAC_STATE_SRC_ADDR)) | ||
2301 | return false; | ||
2302 | |||
2303 | if (!ether_addr_equal(addr, entry->addr)) | ||
2304 | return false; | ||
2305 | |||
2306 | return true; | ||
2307 | } | ||
2308 | |||
2309 | /* Add a MAC filter for 'addr' directing matching traffic to 'queue', | ||
2310 | * 'flags' is used to indicate what kind of match is made, match is by | ||
2311 | * default for the destination address, if matching by source address | ||
2312 | * is desired the flag IGC_MAC_STATE_SRC_ADDR can be used. | ||
2313 | */ | ||
2314 | static int igc_add_mac_filter_flags(struct igc_adapter *adapter, | ||
2315 | const u8 *addr, const u8 queue, | ||
2316 | const u8 flags) | ||
2317 | { | ||
2318 | struct igc_hw *hw = &adapter->hw; | ||
2319 | int rar_entries = hw->mac.rar_entry_count; | ||
2320 | int i; | ||
2321 | |||
2322 | if (is_zero_ether_addr(addr)) | ||
2323 | return -EINVAL; | ||
2324 | |||
2325 | /* Search for the first empty entry in the MAC table. | ||
2326 | * Do not touch entries at the end of the table reserved for the VF MAC | ||
2327 | * addresses. | ||
2328 | */ | ||
2329 | for (i = 0; i < rar_entries; i++) { | ||
2330 | if (!igc_mac_entry_can_be_used(&adapter->mac_table[i], | ||
2331 | addr, flags)) | ||
2332 | continue; | ||
2333 | |||
2334 | ether_addr_copy(adapter->mac_table[i].addr, addr); | ||
2335 | adapter->mac_table[i].queue = queue; | ||
2336 | adapter->mac_table[i].state |= IGC_MAC_STATE_IN_USE | flags; | ||
2337 | |||
2338 | igc_rar_set_index(adapter, i); | ||
2339 | return i; | ||
2340 | } | ||
2341 | |||
2342 | return -ENOSPC; | ||
2343 | } | ||
2344 | |||
2345 | int igc_add_mac_steering_filter(struct igc_adapter *adapter, | ||
2346 | const u8 *addr, u8 queue, u8 flags) | ||
2347 | { | ||
2348 | return igc_add_mac_filter_flags(adapter, addr, queue, | ||
2349 | IGC_MAC_STATE_QUEUE_STEERING | flags); | ||
2350 | } | ||
2351 | |||
2352 | /* Remove a MAC filter for 'addr' directing matching traffic to | ||
2353 | * 'queue', 'flags' is used to indicate what kind of match need to be | ||
2354 | * removed, match is by default for the destination address, if | ||
2355 | * matching by source address is to be removed the flag | ||
2356 | * IGC_MAC_STATE_SRC_ADDR can be used. | ||
2357 | */ | ||
2358 | static int igc_del_mac_filter_flags(struct igc_adapter *adapter, | ||
2359 | const u8 *addr, const u8 queue, | ||
2360 | const u8 flags) | ||
2361 | { | ||
2362 | struct igc_hw *hw = &adapter->hw; | ||
2363 | int rar_entries = hw->mac.rar_entry_count; | ||
2364 | int i; | ||
2365 | |||
2366 | if (is_zero_ether_addr(addr)) | ||
2367 | return -EINVAL; | ||
2368 | |||
2369 | /* Search for matching entry in the MAC table based on given address | ||
2370 | * and queue. Do not touch entries at the end of the table reserved | ||
2371 | * for the VF MAC addresses. | ||
2372 | */ | ||
2373 | for (i = 0; i < rar_entries; i++) { | ||
2374 | if (!(adapter->mac_table[i].state & IGC_MAC_STATE_IN_USE)) | ||
2375 | continue; | ||
2376 | if ((adapter->mac_table[i].state & flags) != flags) | ||
2377 | continue; | ||
2378 | if (adapter->mac_table[i].queue != queue) | ||
2379 | continue; | ||
2380 | if (!ether_addr_equal(adapter->mac_table[i].addr, addr)) | ||
2381 | continue; | ||
2382 | |||
2383 | /* When a filter for the default address is "deleted", | ||
2384 | * we return it to its initial configuration | ||
2385 | */ | ||
2386 | if (adapter->mac_table[i].state & IGC_MAC_STATE_DEFAULT) { | ||
2387 | adapter->mac_table[i].state = | ||
2388 | IGC_MAC_STATE_DEFAULT | IGC_MAC_STATE_IN_USE; | ||
2389 | } else { | ||
2390 | adapter->mac_table[i].state = 0; | ||
2391 | adapter->mac_table[i].queue = 0; | ||
2392 | memset(adapter->mac_table[i].addr, 0, ETH_ALEN); | ||
2393 | } | ||
2394 | |||
2395 | igc_rar_set_index(adapter, i); | ||
2396 | return 0; | ||
2397 | } | ||
2398 | |||
2399 | return -ENOENT; | ||
2400 | } | ||
2401 | |||
2402 | int igc_del_mac_steering_filter(struct igc_adapter *adapter, | ||
2403 | const u8 *addr, u8 queue, u8 flags) | ||
2404 | { | ||
2405 | return igc_del_mac_filter_flags(adapter, addr, queue, | ||
2406 | IGC_MAC_STATE_QUEUE_STEERING | flags); | ||
2407 | } | ||
2408 | |||
1970 | /** | 2409 | /** |
1971 | * igc_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set | 2410 | * igc_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set |
1972 | * @netdev: network interface device structure | 2411 | * @netdev: network interface device structure |
@@ -3434,6 +3873,9 @@ static const struct net_device_ops igc_netdev_ops = { | |||
3434 | .ndo_set_mac_address = igc_set_mac, | 3873 | .ndo_set_mac_address = igc_set_mac, |
3435 | .ndo_change_mtu = igc_change_mtu, | 3874 | .ndo_change_mtu = igc_change_mtu, |
3436 | .ndo_get_stats = igc_get_stats, | 3875 | .ndo_get_stats = igc_get_stats, |
3876 | .ndo_fix_features = igc_fix_features, | ||
3877 | .ndo_set_features = igc_set_features, | ||
3878 | .ndo_features_check = igc_features_check, | ||
3437 | }; | 3879 | }; |
3438 | 3880 | ||
3439 | /* PCIe configuration access */ | 3881 | /* PCIe configuration access */ |
@@ -3663,6 +4105,9 @@ static int igc_probe(struct pci_dev *pdev, | |||
3663 | if (err) | 4105 | if (err) |
3664 | goto err_sw_init; | 4106 | goto err_sw_init; |
3665 | 4107 | ||
4108 | /* copy netdev features into list of user selectable features */ | ||
4109 | netdev->hw_features |= NETIF_F_NTUPLE; | ||
4110 | |||
3666 | /* MTU range: 68 - 9216 */ | 4111 | /* MTU range: 68 - 9216 */ |
3667 | netdev->min_mtu = ETH_MIN_MTU; | 4112 | netdev->min_mtu = ETH_MIN_MTU; |
3668 | netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE; | 4113 | netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE; |