Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ucc_geth: Remove UGETH_FILTERING dead code

The code appears to be dead: nobody call these functions, plus build
breaks when UGETH_FILTERING is enabled:

ucc_geth.c:1848: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c:1848: warning: its scope is only this definition or declaration, which is probably not what you want
ucc_geth.c: In function 'ugeth_82xx_filtering_get_match_addr_in_hash':
ucc_geth.c:1856: error: dereferencing pointer to incomplete type
ucc_geth.c:1874: error: dereferencing pointer to incomplete type
ucc_geth.c:1877: warning: return from incompatible pointer type
ucc_geth.c: At top level:
ucc_geth.c:1885: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c: In function 'ugeth_82xx_filtering_add_addr_in_hash':
ucc_geth.c:1894: error: dereferencing pointer to incomplete type
ucc_geth.c:1909: warning: passing argument 2 of 'ugeth_82xx_filtering_get_match_addr_in_hash' from incompatible pointer type
ucc_geth.c:1909: warning: assignment from incompatible pointer type
ucc_geth.c:1918: error: dereferencing pointer to incomplete type
ucc_geth.c: At top level:
ucc_geth.c:1928: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c: In function 'ugeth_82xx_filtering_clear_addr_in_hash':
ucc_geth.c:1947: warning: passing argument 2 of 'ugeth_82xx_filtering_get_match_addr_in_hash' from incompatible pointer type
ucc_geth.c:1947: warning: assignment from incompatible pointer type
ucc_geth.c:1954: error: dereferencing pointer to incomplete type
ucc_geth.c: At top level:
ucc_geth.c:2060: warning: 'struct enet_addr' declared inside parameter list
ucc_geth.c: In function 'ugeth_82xx_filtering_add_addr_in_paddr':
ucc_geth.c:2064: error: dereferencing pointer to incomplete type
ucc_geth.c:2073: error: dereferencing pointer to incomplete type
ucc_geth.c:2075: warning: passing argument 2 of 'hw_add_addr_in_paddr' from incompatible pointer type
make[2]: *** [ucc_geth.o] Error 1

The code is there since the driver was merged, and nobody seem to be
interested in fixing or actually using it. If we ever want the
filtering support, we can always revert the patch and fix it, but so
far it just draws reader's attention.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Anton Vorontsov and committed by
David S. Miller
221b3d60 3e73fc9a

-266
-4
drivers/net/Kconfig
··· 2294 2294 bool "Magic Packet detection support" 2295 2295 depends on UCC_GETH 2296 2296 2297 - config UGETH_FILTERING 2298 - bool "Mac address filtering support" 2299 - depends on UCC_GETH 2300 - 2301 2297 config UGETH_TX_ON_DEMAND 2302 2298 bool "Transmit on Demand support" 2303 2299 depends on UCC_GETH
-262
drivers/net/ucc_geth.c
··· 188 188 } 189 189 #endif /* DEBUG */ 190 190 191 - #ifdef CONFIG_UGETH_FILTERING 192 - static void enqueue(struct list_head *node, struct list_head *lh) 193 - { 194 - unsigned long flags; 195 - 196 - spin_lock_irqsave(&ugeth_lock, flags); 197 - list_add_tail(node, lh); 198 - spin_unlock_irqrestore(&ugeth_lock, flags); 199 - } 200 - #endif /* CONFIG_UGETH_FILTERING */ 201 - 202 191 static struct list_head *dequeue(struct list_head *lh) 203 192 { 204 193 unsigned long flags; ··· 380 391 } 381 392 #endif 382 393 383 - #ifdef CONFIG_UGETH_FILTERING 384 - static struct enet_addr_container *get_enet_addr_container(void) 385 - { 386 - struct enet_addr_container *enet_addr_cont; 387 - 388 - /* allocate memory */ 389 - enet_addr_cont = kmalloc(sizeof(struct enet_addr_container), GFP_KERNEL); 390 - if (!enet_addr_cont) { 391 - ugeth_err("%s: No memory for enet_addr_container object.", 392 - __func__); 393 - return NULL; 394 - } 395 - 396 - return enet_addr_cont; 397 - } 398 - #endif /* CONFIG_UGETH_FILTERING */ 399 - 400 394 static void put_enet_addr_container(struct enet_addr_container *enet_addr_cont) 401 395 { 402 396 kfree(enet_addr_cont); ··· 391 419 out_be16(&reg[1], ((u16)mac[3] << 8) | mac[2]); 392 420 out_be16(&reg[2], ((u16)mac[1] << 8) | mac[0]); 393 421 } 394 - 395 - #ifdef CONFIG_UGETH_FILTERING 396 - static int hw_add_addr_in_paddr(struct ucc_geth_private *ugeth, 397 - u8 *p_enet_addr, u8 paddr_num) 398 - { 399 - struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; 400 - 401 - if (!(paddr_num < NUM_OF_PADDRS)) { 402 - ugeth_warn("%s: Illegal paddr_num.", __func__); 403 - return -EINVAL; 404 - } 405 - 406 - p_82xx_addr_filt = 407 - (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram-> 408 - addressfiltering; 409 - 410 - /* Ethernet frames are defined in Little Endian mode, */ 411 - /* therefore to insert the address we reverse the bytes. */ 412 - set_mac_addr(&p_82xx_addr_filt->paddr[paddr_num].h, p_enet_addr); 413 - return 0; 414 - } 415 - #endif /* CONFIG_UGETH_FILTERING */ 416 422 417 423 static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num) 418 424 { ··· 1752 1802 #endif 1753 1803 } 1754 1804 1755 - #ifdef CONFIG_UGETH_FILTERING 1756 - static int ugeth_ext_filtering_serialize_tad(struct ucc_geth_tad_params * 1757 - p_UccGethTadParams, 1758 - struct qe_fltr_tad *qe_fltr_tad) 1759 - { 1760 - u16 temp; 1761 - 1762 - /* Zero serialized TAD */ 1763 - memset(qe_fltr_tad, 0, QE_FLTR_TAD_SIZE); 1764 - 1765 - qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_V; /* Must have this */ 1766 - if (p_UccGethTadParams->rx_non_dynamic_extended_features_mode || 1767 - (p_UccGethTadParams->vtag_op != UCC_GETH_VLAN_OPERATION_TAGGED_NOP) 1768 - || (p_UccGethTadParams->vnontag_op != 1769 - UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP) 1770 - ) 1771 - qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_EF; 1772 - if (p_UccGethTadParams->reject_frame) 1773 - qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_REJ; 1774 - temp = 1775 - (u16) (((u16) p_UccGethTadParams-> 1776 - vtag_op) << UCC_GETH_TAD_VTAG_OP_SHIFT); 1777 - qe_fltr_tad->serialized[0] |= (u8) (temp >> 8); /* upper bits */ 1778 - 1779 - qe_fltr_tad->serialized[1] |= (u8) (temp & 0x00ff); /* lower bits */ 1780 - if (p_UccGethTadParams->vnontag_op == 1781 - UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT) 1782 - qe_fltr_tad->serialized[1] |= UCC_GETH_TAD_V_NON_VTAG_OP; 1783 - qe_fltr_tad->serialized[1] |= 1784 - p_UccGethTadParams->rqos << UCC_GETH_TAD_RQOS_SHIFT; 1785 - 1786 - qe_fltr_tad->serialized[2] |= 1787 - p_UccGethTadParams->vpri << UCC_GETH_TAD_V_PRIORITY_SHIFT; 1788 - /* upper bits */ 1789 - qe_fltr_tad->serialized[2] |= (u8) (p_UccGethTadParams->vid >> 8); 1790 - /* lower bits */ 1791 - qe_fltr_tad->serialized[3] |= (u8) (p_UccGethTadParams->vid & 0x00ff); 1792 - 1793 - return 0; 1794 - } 1795 - 1796 - static struct enet_addr_container_t 1797 - *ugeth_82xx_filtering_get_match_addr_in_hash(struct ucc_geth_private *ugeth, 1798 - struct enet_addr *p_enet_addr) 1799 - { 1800 - struct enet_addr_container *enet_addr_cont; 1801 - struct list_head *p_lh; 1802 - u16 i, num; 1803 - int32_t j; 1804 - u8 *p_counter; 1805 - 1806 - if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) { 1807 - p_lh = &ugeth->group_hash_q; 1808 - p_counter = &(ugeth->numGroupAddrInHash); 1809 - } else { 1810 - p_lh = &ugeth->ind_hash_q; 1811 - p_counter = &(ugeth->numIndAddrInHash); 1812 - } 1813 - 1814 - if (!p_lh) 1815 - return NULL; 1816 - 1817 - num = *p_counter; 1818 - 1819 - for (i = 0; i < num; i++) { 1820 - enet_addr_cont = 1821 - (struct enet_addr_container *) 1822 - ENET_ADDR_CONT_ENTRY(dequeue(p_lh)); 1823 - for (j = ENET_NUM_OCTETS_PER_ADDRESS - 1; j >= 0; j--) { 1824 - if ((*p_enet_addr)[j] != (enet_addr_cont->address)[j]) 1825 - break; 1826 - if (j == 0) 1827 - return enet_addr_cont; /* Found */ 1828 - } 1829 - enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ 1830 - } 1831 - return NULL; 1832 - } 1833 - 1834 - static int ugeth_82xx_filtering_add_addr_in_hash(struct ucc_geth_private *ugeth, 1835 - struct enet_addr *p_enet_addr) 1836 - { 1837 - enum ucc_geth_enet_address_recognition_location location; 1838 - struct enet_addr_container *enet_addr_cont; 1839 - struct list_head *p_lh; 1840 - u8 i; 1841 - u32 limit; 1842 - u8 *p_counter; 1843 - 1844 - if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) { 1845 - p_lh = &ugeth->group_hash_q; 1846 - limit = ugeth->ug_info->maxGroupAddrInHash; 1847 - location = 1848 - UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH; 1849 - p_counter = &(ugeth->numGroupAddrInHash); 1850 - } else { 1851 - p_lh = &ugeth->ind_hash_q; 1852 - limit = ugeth->ug_info->maxIndAddrInHash; 1853 - location = 1854 - UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH; 1855 - p_counter = &(ugeth->numIndAddrInHash); 1856 - } 1857 - 1858 - if ((enet_addr_cont = 1859 - ugeth_82xx_filtering_get_match_addr_in_hash(ugeth, p_enet_addr))) { 1860 - list_add(p_lh, &enet_addr_cont->node); /* Put it back */ 1861 - return 0; 1862 - } 1863 - if ((!p_lh) || (!(*p_counter < limit))) 1864 - return -EBUSY; 1865 - if (!(enet_addr_cont = get_enet_addr_container())) 1866 - return -ENOMEM; 1867 - for (i = 0; i < ENET_NUM_OCTETS_PER_ADDRESS; i++) 1868 - (enet_addr_cont->address)[i] = (*p_enet_addr)[i]; 1869 - enet_addr_cont->location = location; 1870 - enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ 1871 - ++(*p_counter); 1872 - 1873 - hw_add_addr_in_hash(ugeth, enet_addr_cont->address); 1874 - return 0; 1875 - } 1876 - 1877 - static int ugeth_82xx_filtering_clear_addr_in_hash(struct ucc_geth_private *ugeth, 1878 - struct enet_addr *p_enet_addr) 1879 - { 1880 - struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; 1881 - struct enet_addr_container *enet_addr_cont; 1882 - struct ucc_fast_private *uccf; 1883 - enum comm_dir comm_dir; 1884 - u16 i, num; 1885 - struct list_head *p_lh; 1886 - u32 *addr_h, *addr_l; 1887 - u8 *p_counter; 1888 - 1889 - uccf = ugeth->uccf; 1890 - 1891 - p_82xx_addr_filt = 1892 - (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram-> 1893 - addressfiltering; 1894 - 1895 - if (! 1896 - (enet_addr_cont = 1897 - ugeth_82xx_filtering_get_match_addr_in_hash(ugeth, p_enet_addr))) 1898 - return -ENOENT; 1899 - 1900 - /* It's been found and removed from the CQ. */ 1901 - /* Now destroy its container */ 1902 - put_enet_addr_container(enet_addr_cont); 1903 - 1904 - if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) { 1905 - addr_h = &(p_82xx_addr_filt->gaddr_h); 1906 - addr_l = &(p_82xx_addr_filt->gaddr_l); 1907 - p_lh = &ugeth->group_hash_q; 1908 - p_counter = &(ugeth->numGroupAddrInHash); 1909 - } else { 1910 - addr_h = &(p_82xx_addr_filt->iaddr_h); 1911 - addr_l = &(p_82xx_addr_filt->iaddr_l); 1912 - p_lh = &ugeth->ind_hash_q; 1913 - p_counter = &(ugeth->numIndAddrInHash); 1914 - } 1915 - 1916 - comm_dir = 0; 1917 - if (uccf->enabled_tx) 1918 - comm_dir |= COMM_DIR_TX; 1919 - if (uccf->enabled_rx) 1920 - comm_dir |= COMM_DIR_RX; 1921 - if (comm_dir) 1922 - ugeth_disable(ugeth, comm_dir); 1923 - 1924 - /* Clear the hash table. */ 1925 - out_be32(addr_h, 0x00000000); 1926 - out_be32(addr_l, 0x00000000); 1927 - 1928 - /* Add all remaining CQ elements back into hash */ 1929 - num = --(*p_counter); 1930 - for (i = 0; i < num; i++) { 1931 - enet_addr_cont = 1932 - (struct enet_addr_container *) 1933 - ENET_ADDR_CONT_ENTRY(dequeue(p_lh)); 1934 - hw_add_addr_in_hash(ugeth, enet_addr_cont->address); 1935 - enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ 1936 - } 1937 - 1938 - if (comm_dir) 1939 - ugeth_enable(ugeth, comm_dir); 1940 - 1941 - return 0; 1942 - } 1943 - #endif /* CONFIG_UGETH_FILTERING */ 1944 - 1945 1805 static int ugeth_82xx_filtering_clear_all_addr_in_hash(struct ucc_geth_private * 1946 1806 ugeth, 1947 1807 enum enet_addr_type ··· 1813 2053 1814 2054 return 0; 1815 2055 } 1816 - 1817 - #ifdef CONFIG_UGETH_FILTERING 1818 - static int ugeth_82xx_filtering_add_addr_in_paddr(struct ucc_geth_private *ugeth, 1819 - struct enet_addr *p_enet_addr, 1820 - u8 paddr_num) 1821 - { 1822 - int i; 1823 - 1824 - if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) 1825 - ugeth_warn 1826 - ("%s: multicast address added to paddr will have no " 1827 - "effect - is this what you wanted?", 1828 - __func__); 1829 - 1830 - ugeth->indAddrRegUsed[paddr_num] = 1; /* mark this paddr as used */ 1831 - /* store address in our database */ 1832 - for (i = 0; i < ENET_NUM_OCTETS_PER_ADDRESS; i++) 1833 - ugeth->paddr[paddr_num][i] = (*p_enet_addr)[i]; 1834 - /* put in hardware */ 1835 - return hw_add_addr_in_paddr(ugeth, p_enet_addr, paddr_num); 1836 - } 1837 - #endif /* CONFIG_UGETH_FILTERING */ 1838 2056 1839 2057 static int ugeth_82xx_filtering_clear_addr_in_paddr(struct ucc_geth_private *ugeth, 1840 2058 u8 paddr_num)