cxgb_main.c (9b4de886f9780a973727a4d46fbc21a9fa999398) cxgb_main.c (25292deb42c1c99213f6d603cf461b950691cc79)
1/**************************************************************************
2
3Copyright (c) 2007-2008, Chelsio Inc.
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8

--- 889 unchanged lines hidden (view full) ---

898
899 pi->port_cdev->si_drv1 = (void *)pi;
900
901 return (0);
902}
903
904
905#ifdef TSO_SUPPORTED
1/**************************************************************************
2
3Copyright (c) 2007-2008, Chelsio Inc.
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8

--- 889 unchanged lines hidden (view full) ---

898
899 pi->port_cdev->si_drv1 = (void *)pi;
900
901 return (0);
902}
903
904
905#ifdef TSO_SUPPORTED
906#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU)
906#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO)
907/* Don't enable TSO6 yet */
907/* Don't enable TSO6 yet */
908#define CXGB_CAP_ENABLE (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO4 | IFCAP_JUMBO_MTU)
908#define CXGB_CAP_ENABLE (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO4 | IFCAP_JUMBO_MTU | IFCAP_LRO)
909#else
910#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU)
911/* Don't enable TSO6 yet */
912#define CXGB_CAP_ENABLE (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU)
913#define IFCAP_TSO4 0x0
914#define IFCAP_TSO6 0x0
915#define CSUM_TSO 0x0
916#endif

--- 1024 unchanged lines hidden (view full) ---

1941 cxgb_stop_locked(p);
1942 cxgb_init_locked(p);
1943 }
1944 PORT_UNLOCK(p);
1945 }
1946 return (error);
1947}
1948
909#else
910#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU)
911/* Don't enable TSO6 yet */
912#define CXGB_CAP_ENABLE (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU)
913#define IFCAP_TSO4 0x0
914#define IFCAP_TSO6 0x0
915#define CSUM_TSO 0x0
916#endif

--- 1024 unchanged lines hidden (view full) ---

1941 cxgb_stop_locked(p);
1942 cxgb_init_locked(p);
1943 }
1944 PORT_UNLOCK(p);
1945 }
1946 return (error);
1947}
1948
1949/*
1950 * Mark lro enabled or disabled in all qsets for this port
1951 */
1949static int
1952static int
1953cxgb_set_lro(struct port_info *p, int enabled)
1954{
1955 int i;
1956 struct adapter *adp = p->adapter;
1957 struct sge_qset *q;
1958
1959 PORT_LOCK_ASSERT_OWNED(p);
1960 for (i = 0; i < p->nqsets; i++) {
1961 q = &adp->sge.qs[p->first_qset + i];
1962 q->lro.enabled = (enabled != 0);
1963 }
1964 return (0);
1965}
1966
1967static int
1950cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data)
1951{
1952 struct port_info *p = ifp->if_softc;
1953 struct ifaddr *ifa = (struct ifaddr *)data;
1954 struct ifreq *ifr = (struct ifreq *)data;
1955 int flags, error = 0, reinit = 0;
1956 uint32_t mask;
1957

--- 68 unchanged lines hidden (view full) ---

2026 ifp->if_hwassist |= CSUM_TSO;
2027 } else {
2028 if (cxgb_debug)
2029 printf("cxgb requires tx checksum offload"
2030 " be enabled to use TSO\n");
2031 error = EINVAL;
2032 }
2033 }
1968cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data)
1969{
1970 struct port_info *p = ifp->if_softc;
1971 struct ifaddr *ifa = (struct ifaddr *)data;
1972 struct ifreq *ifr = (struct ifreq *)data;
1973 int flags, error = 0, reinit = 0;
1974 uint32_t mask;
1975

--- 68 unchanged lines hidden (view full) ---

2044 ifp->if_hwassist |= CSUM_TSO;
2045 } else {
2046 if (cxgb_debug)
2047 printf("cxgb requires tx checksum offload"
2048 " be enabled to use TSO\n");
2049 error = EINVAL;
2050 }
2051 }
2052 if (mask & IFCAP_LRO) {
2053 ifp->if_capenable ^= IFCAP_LRO;
2054
2055 /* Safe to do this even if cxgb_up not called yet */
2056 cxgb_set_lro(p, ifp->if_capenable & IFCAP_LRO);
2057 }
2034 if (mask & IFCAP_VLAN_HWTAGGING) {
2035 ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
2036 reinit = ifp->if_drv_flags & IFF_DRV_RUNNING;
2037 }
2038 if (mask & IFCAP_VLAN_MTU) {
2039 ifp->if_capenable ^= IFCAP_VLAN_MTU;
2040 reinit = ifp->if_drv_flags & IFF_DRV_RUNNING;
2041 }

--- 727 unchanged lines hidden ---
2058 if (mask & IFCAP_VLAN_HWTAGGING) {
2059 ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
2060 reinit = ifp->if_drv_flags & IFF_DRV_RUNNING;
2061 }
2062 if (mask & IFCAP_VLAN_MTU) {
2063 ifp->if_capenable ^= IFCAP_VLAN_MTU;
2064 reinit = ifp->if_drv_flags & IFF_DRV_RUNNING;
2065 }

--- 727 unchanged lines hidden ---