diff options
Diffstat (limited to 'drivers')
179 files changed, 4154 insertions, 3366 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index dab4b41f1715..a082fd9e7ebe 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2294,7 +2294,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv) | |||
2294 | int low, high, remaining; | 2294 | int low, high, remaining; |
2295 | unsigned int rover; | 2295 | unsigned int rover; |
2296 | 2296 | ||
2297 | inet_get_local_port_range(&low, &high); | 2297 | inet_get_local_port_range(&init_net, &low, &high); |
2298 | remaining = (high - low) + 1; | 2298 | remaining = (high - low) + 1; |
2299 | rover = net_random() % remaining + low; | 2299 | rover = net_random() % remaining + low; |
2300 | retry: | 2300 | retry: |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 0d8f427ade93..c62606a67f6a 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -136,41 +136,6 @@ static inline struct bonding *__get_bond_by_port(struct port *port) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * __get_first_port - get the first port in the bond | ||
140 | * @bond: the bond we're looking at | ||
141 | * | ||
142 | * Return the port of the first slave in @bond, or %NULL if it can't be found. | ||
143 | */ | ||
144 | static inline struct port *__get_first_port(struct bonding *bond) | ||
145 | { | ||
146 | struct slave *first_slave = bond_first_slave(bond); | ||
147 | |||
148 | return first_slave ? &(SLAVE_AD_INFO(first_slave).port) : NULL; | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * __get_next_port - get the next port in the bond | ||
153 | * @port: the port we're looking at | ||
154 | * | ||
155 | * Return the port of the slave that is next in line of @port's slave in the | ||
156 | * bond, or %NULL if it can't be found. | ||
157 | */ | ||
158 | static inline struct port *__get_next_port(struct port *port) | ||
159 | { | ||
160 | struct bonding *bond = __get_bond_by_port(port); | ||
161 | struct slave *slave = port->slave, *slave_next; | ||
162 | |||
163 | // If there's no bond for this port, or this is the last slave | ||
164 | if (bond == NULL) | ||
165 | return NULL; | ||
166 | slave_next = bond_next_slave(bond, slave); | ||
167 | if (!slave_next || bond_is_first_slave(bond, slave_next)) | ||
168 | return NULL; | ||
169 | |||
170 | return &(SLAVE_AD_INFO(slave_next).port); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * __get_first_agg - get the first aggregator in the bond | 139 | * __get_first_agg - get the first aggregator in the bond |
175 | * @bond: the bond we're looking at | 140 | * @bond: the bond we're looking at |
176 | * | 141 | * |
@@ -190,28 +155,6 @@ static inline struct aggregator *__get_first_agg(struct port *port) | |||
190 | return first_slave ? &(SLAVE_AD_INFO(first_slave).aggregator) : NULL; | 155 | return first_slave ? &(SLAVE_AD_INFO(first_slave).aggregator) : NULL; |
191 | } | 156 | } |
192 | 157 | ||
193 | /** | ||
194 | * __get_next_agg - get the next aggregator in the bond | ||
195 | * @aggregator: the aggregator we're looking at | ||
196 | * | ||
197 | * Return the aggregator of the slave that is next in line of @aggregator's | ||
198 | * slave in the bond, or %NULL if it can't be found. | ||
199 | */ | ||
200 | static inline struct aggregator *__get_next_agg(struct aggregator *aggregator) | ||
201 | { | ||
202 | struct slave *slave = aggregator->slave, *slave_next; | ||
203 | struct bonding *bond = bond_get_bond_by_slave(slave); | ||
204 | |||
205 | // If there's no bond for this aggregator, or this is the last slave | ||
206 | if (bond == NULL) | ||
207 | return NULL; | ||
208 | slave_next = bond_next_slave(bond, slave); | ||
209 | if (!slave_next || bond_is_first_slave(bond, slave_next)) | ||
210 | return NULL; | ||
211 | |||
212 | return &(SLAVE_AD_INFO(slave_next).aggregator); | ||
213 | } | ||
214 | |||
215 | /* | 158 | /* |
216 | * __agg_has_partner | 159 | * __agg_has_partner |
217 | * | 160 | * |
@@ -755,16 +698,15 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) | |||
755 | */ | 698 | */ |
756 | static struct aggregator *__get_active_agg(struct aggregator *aggregator) | 699 | static struct aggregator *__get_active_agg(struct aggregator *aggregator) |
757 | { | 700 | { |
758 | struct aggregator *retval = NULL; | 701 | struct bonding *bond = aggregator->slave->bond; |
702 | struct list_head *iter; | ||
703 | struct slave *slave; | ||
759 | 704 | ||
760 | for (; aggregator; aggregator = __get_next_agg(aggregator)) { | 705 | bond_for_each_slave(bond, slave, iter) |
761 | if (aggregator->is_active) { | 706 | if (SLAVE_AD_INFO(slave).aggregator.is_active) |
762 | retval = aggregator; | 707 | return &(SLAVE_AD_INFO(slave).aggregator); |
763 | break; | ||
764 | } | ||
765 | } | ||
766 | 708 | ||
767 | return retval; | 709 | return NULL; |
768 | } | 710 | } |
769 | 711 | ||
770 | /** | 712 | /** |
@@ -1274,12 +1216,17 @@ static void ad_port_selection_logic(struct port *port) | |||
1274 | { | 1216 | { |
1275 | struct aggregator *aggregator, *free_aggregator = NULL, *temp_aggregator; | 1217 | struct aggregator *aggregator, *free_aggregator = NULL, *temp_aggregator; |
1276 | struct port *last_port = NULL, *curr_port; | 1218 | struct port *last_port = NULL, *curr_port; |
1219 | struct list_head *iter; | ||
1220 | struct bonding *bond; | ||
1221 | struct slave *slave; | ||
1277 | int found = 0; | 1222 | int found = 0; |
1278 | 1223 | ||
1279 | // if the port is already Selected, do nothing | 1224 | // if the port is already Selected, do nothing |
1280 | if (port->sm_vars & AD_PORT_SELECTED) | 1225 | if (port->sm_vars & AD_PORT_SELECTED) |
1281 | return; | 1226 | return; |
1282 | 1227 | ||
1228 | bond = __get_bond_by_port(port); | ||
1229 | |||
1283 | // if the port is connected to other aggregator, detach it | 1230 | // if the port is connected to other aggregator, detach it |
1284 | if (port->aggregator) { | 1231 | if (port->aggregator) { |
1285 | // detach the port from its former aggregator | 1232 | // detach the port from its former aggregator |
@@ -1320,8 +1267,8 @@ static void ad_port_selection_logic(struct port *port) | |||
1320 | } | 1267 | } |
1321 | } | 1268 | } |
1322 | // search on all aggregators for a suitable aggregator for this port | 1269 | // search on all aggregators for a suitable aggregator for this port |
1323 | for (aggregator = __get_first_agg(port); aggregator; | 1270 | bond_for_each_slave(bond, slave, iter) { |
1324 | aggregator = __get_next_agg(aggregator)) { | 1271 | aggregator = &(SLAVE_AD_INFO(slave).aggregator); |
1325 | 1272 | ||
1326 | // keep a free aggregator for later use(if needed) | 1273 | // keep a free aggregator for later use(if needed) |
1327 | if (!aggregator->lag_ports) { | 1274 | if (!aggregator->lag_ports) { |
@@ -1515,19 +1462,23 @@ static int agg_device_up(const struct aggregator *agg) | |||
1515 | static void ad_agg_selection_logic(struct aggregator *agg) | 1462 | static void ad_agg_selection_logic(struct aggregator *agg) |
1516 | { | 1463 | { |
1517 | struct aggregator *best, *active, *origin; | 1464 | struct aggregator *best, *active, *origin; |
1465 | struct bonding *bond = agg->slave->bond; | ||
1466 | struct list_head *iter; | ||
1467 | struct slave *slave; | ||
1518 | struct port *port; | 1468 | struct port *port; |
1519 | 1469 | ||
1520 | origin = agg; | 1470 | origin = agg; |
1521 | active = __get_active_agg(agg); | 1471 | active = __get_active_agg(agg); |
1522 | best = (active && agg_device_up(active)) ? active : NULL; | 1472 | best = (active && agg_device_up(active)) ? active : NULL; |
1523 | 1473 | ||
1524 | do { | 1474 | bond_for_each_slave(bond, slave, iter) { |
1475 | agg = &(SLAVE_AD_INFO(slave).aggregator); | ||
1476 | |||
1525 | agg->is_active = 0; | 1477 | agg->is_active = 0; |
1526 | 1478 | ||
1527 | if (agg->num_of_ports && agg_device_up(agg)) | 1479 | if (agg->num_of_ports && agg_device_up(agg)) |
1528 | best = ad_agg_selection_test(best, agg); | 1480 | best = ad_agg_selection_test(best, agg); |
1529 | 1481 | } | |
1530 | } while ((agg = __get_next_agg(agg))); | ||
1531 | 1482 | ||
1532 | if (best && | 1483 | if (best && |
1533 | __get_agg_selection_mode(best->lag_ports) == BOND_AD_STABLE) { | 1484 | __get_agg_selection_mode(best->lag_ports) == BOND_AD_STABLE) { |
@@ -1565,8 +1516,8 @@ static void ad_agg_selection_logic(struct aggregator *agg) | |||
1565 | best->lag_ports, best->slave, | 1516 | best->lag_ports, best->slave, |
1566 | best->slave ? best->slave->dev->name : "NULL"); | 1517 | best->slave ? best->slave->dev->name : "NULL"); |
1567 | 1518 | ||
1568 | for (agg = __get_first_agg(best->lag_ports); agg; | 1519 | bond_for_each_slave(bond, slave, iter) { |
1569 | agg = __get_next_agg(agg)) { | 1520 | agg = &(SLAVE_AD_INFO(slave).aggregator); |
1570 | 1521 | ||
1571 | pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", | 1522 | pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", |
1572 | agg->aggregator_identifier, agg->num_of_ports, | 1523 | agg->aggregator_identifier, agg->num_of_ports, |
@@ -1614,13 +1565,7 @@ static void ad_agg_selection_logic(struct aggregator *agg) | |||
1614 | } | 1565 | } |
1615 | } | 1566 | } |
1616 | 1567 | ||
1617 | if (origin->slave) { | 1568 | bond_3ad_set_carrier(bond); |
1618 | struct bonding *bond; | ||
1619 | |||
1620 | bond = bond_get_bond_by_slave(origin->slave); | ||
1621 | if (bond) | ||
1622 | bond_3ad_set_carrier(bond); | ||
1623 | } | ||
1624 | } | 1569 | } |
1625 | 1570 | ||
1626 | /** | 1571 | /** |
@@ -1969,6 +1914,9 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
1969 | struct port *port, *prev_port, *temp_port; | 1914 | struct port *port, *prev_port, *temp_port; |
1970 | struct aggregator *aggregator, *new_aggregator, *temp_aggregator; | 1915 | struct aggregator *aggregator, *new_aggregator, *temp_aggregator; |
1971 | int select_new_active_agg = 0; | 1916 | int select_new_active_agg = 0; |
1917 | struct bonding *bond = slave->bond; | ||
1918 | struct slave *slave_iter; | ||
1919 | struct list_head *iter; | ||
1972 | 1920 | ||
1973 | // find the aggregator related to this slave | 1921 | // find the aggregator related to this slave |
1974 | aggregator = &(SLAVE_AD_INFO(slave).aggregator); | 1922 | aggregator = &(SLAVE_AD_INFO(slave).aggregator); |
@@ -1998,14 +1946,16 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
1998 | // reason to search for new aggregator, and that we will find one | 1946 | // reason to search for new aggregator, and that we will find one |
1999 | if ((aggregator->lag_ports != port) || (aggregator->lag_ports->next_port_in_aggregator)) { | 1947 | if ((aggregator->lag_ports != port) || (aggregator->lag_ports->next_port_in_aggregator)) { |
2000 | // find new aggregator for the related port(s) | 1948 | // find new aggregator for the related port(s) |
2001 | new_aggregator = __get_first_agg(port); | 1949 | bond_for_each_slave(bond, slave_iter, iter) { |
2002 | for (; new_aggregator; new_aggregator = __get_next_agg(new_aggregator)) { | 1950 | new_aggregator = &(SLAVE_AD_INFO(slave_iter).aggregator); |
2003 | // if the new aggregator is empty, or it is connected to our port only | 1951 | // if the new aggregator is empty, or it is connected to our port only |
2004 | if (!new_aggregator->lag_ports | 1952 | if (!new_aggregator->lag_ports |
2005 | || ((new_aggregator->lag_ports == port) | 1953 | || ((new_aggregator->lag_ports == port) |
2006 | && !new_aggregator->lag_ports->next_port_in_aggregator)) | 1954 | && !new_aggregator->lag_ports->next_port_in_aggregator)) |
2007 | break; | 1955 | break; |
2008 | } | 1956 | } |
1957 | if (!slave_iter) | ||
1958 | new_aggregator = NULL; | ||
2009 | // if new aggregator found, copy the aggregator's parameters | 1959 | // if new aggregator found, copy the aggregator's parameters |
2010 | // and connect the related lag_ports to the new aggregator | 1960 | // and connect the related lag_ports to the new aggregator |
2011 | if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { | 1961 | if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { |
@@ -2056,15 +2006,17 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
2056 | pr_info("%s: Removing an active aggregator\n", | 2006 | pr_info("%s: Removing an active aggregator\n", |
2057 | slave->bond->dev->name); | 2007 | slave->bond->dev->name); |
2058 | // select new active aggregator | 2008 | // select new active aggregator |
2059 | ad_agg_selection_logic(__get_first_agg(port)); | 2009 | temp_aggregator = __get_first_agg(port); |
2010 | if (temp_aggregator) | ||
2011 | ad_agg_selection_logic(temp_aggregator); | ||
2060 | } | 2012 | } |
2061 | } | 2013 | } |
2062 | } | 2014 | } |
2063 | 2015 | ||
2064 | pr_debug("Unbinding port %d\n", port->actor_port_number); | 2016 | pr_debug("Unbinding port %d\n", port->actor_port_number); |
2065 | // find the aggregator that this port is connected to | 2017 | // find the aggregator that this port is connected to |
2066 | temp_aggregator = __get_first_agg(port); | 2018 | bond_for_each_slave(bond, slave_iter, iter) { |
2067 | for (; temp_aggregator; temp_aggregator = __get_next_agg(temp_aggregator)) { | 2019 | temp_aggregator = &(SLAVE_AD_INFO(slave_iter).aggregator); |
2068 | prev_port = NULL; | 2020 | prev_port = NULL; |
2069 | // search the port in the aggregator's related ports | 2021 | // search the port in the aggregator's related ports |
2070 | for (temp_port = temp_aggregator->lag_ports; temp_port; | 2022 | for (temp_port = temp_aggregator->lag_ports; temp_port; |
@@ -2111,19 +2063,24 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2111 | { | 2063 | { |
2112 | struct bonding *bond = container_of(work, struct bonding, | 2064 | struct bonding *bond = container_of(work, struct bonding, |
2113 | ad_work.work); | 2065 | ad_work.work); |
2114 | struct port *port; | ||
2115 | struct aggregator *aggregator; | 2066 | struct aggregator *aggregator; |
2067 | struct list_head *iter; | ||
2068 | struct slave *slave; | ||
2069 | struct port *port; | ||
2116 | 2070 | ||
2117 | read_lock(&bond->lock); | 2071 | read_lock(&bond->lock); |
2118 | 2072 | ||
2119 | //check if there are any slaves | 2073 | //check if there are any slaves |
2120 | if (list_empty(&bond->slave_list)) | 2074 | if (!bond_has_slaves(bond)) |
2121 | goto re_arm; | 2075 | goto re_arm; |
2122 | 2076 | ||
2123 | // check if agg_select_timer timer after initialize is timed out | 2077 | // check if agg_select_timer timer after initialize is timed out |
2124 | if (BOND_AD_INFO(bond).agg_select_timer && !(--BOND_AD_INFO(bond).agg_select_timer)) { | 2078 | if (BOND_AD_INFO(bond).agg_select_timer && !(--BOND_AD_INFO(bond).agg_select_timer)) { |
2079 | slave = bond_first_slave(bond); | ||
2080 | port = slave ? &(SLAVE_AD_INFO(slave).port) : NULL; | ||
2081 | |||
2125 | // select the active aggregator for the bond | 2082 | // select the active aggregator for the bond |
2126 | if ((port = __get_first_port(bond))) { | 2083 | if (port) { |
2127 | if (!port->slave) { | 2084 | if (!port->slave) { |
2128 | pr_warning("%s: Warning: bond's first port is uninitialized\n", | 2085 | pr_warning("%s: Warning: bond's first port is uninitialized\n", |
2129 | bond->dev->name); | 2086 | bond->dev->name); |
@@ -2137,7 +2094,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2137 | } | 2094 | } |
2138 | 2095 | ||
2139 | // for each port run the state machines | 2096 | // for each port run the state machines |
2140 | for (port = __get_first_port(bond); port; port = __get_next_port(port)) { | 2097 | bond_for_each_slave(bond, slave, iter) { |
2098 | port = &(SLAVE_AD_INFO(slave).port); | ||
2141 | if (!port->slave) { | 2099 | if (!port->slave) { |
2142 | pr_warning("%s: Warning: Found an uninitialized port\n", | 2100 | pr_warning("%s: Warning: Found an uninitialized port\n", |
2143 | bond->dev->name); | 2101 | bond->dev->name); |
@@ -2382,9 +2340,12 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond, | |||
2382 | struct ad_info *ad_info) | 2340 | struct ad_info *ad_info) |
2383 | { | 2341 | { |
2384 | struct aggregator *aggregator = NULL; | 2342 | struct aggregator *aggregator = NULL; |
2343 | struct list_head *iter; | ||
2344 | struct slave *slave; | ||
2385 | struct port *port; | 2345 | struct port *port; |
2386 | 2346 | ||
2387 | for (port = __get_first_port(bond); port; port = __get_next_port(port)) { | 2347 | bond_for_each_slave(bond, slave, iter) { |
2348 | port = &(SLAVE_AD_INFO(slave).port); | ||
2388 | if (port->aggregator && port->aggregator->is_active) { | 2349 | if (port->aggregator && port->aggregator->is_active) { |
2389 | aggregator = port->aggregator; | 2350 | aggregator = port->aggregator; |
2390 | break; | 2351 | break; |
@@ -2417,14 +2378,15 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | |||
2417 | 2378 | ||
2418 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | 2379 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) |
2419 | { | 2380 | { |
2420 | struct slave *slave, *start_at; | ||
2421 | struct bonding *bond = netdev_priv(dev); | 2381 | struct bonding *bond = netdev_priv(dev); |
2422 | int slave_agg_no; | 2382 | struct slave *slave, *first_ok_slave; |
2423 | int slaves_in_agg; | 2383 | struct aggregator *agg; |
2424 | int agg_id; | ||
2425 | int i; | ||
2426 | struct ad_info ad_info; | 2384 | struct ad_info ad_info; |
2385 | struct list_head *iter; | ||
2386 | int slaves_in_agg; | ||
2387 | int slave_agg_no; | ||
2427 | int res = 1; | 2388 | int res = 1; |
2389 | int agg_id; | ||
2428 | 2390 | ||
2429 | read_lock(&bond->lock); | 2391 | read_lock(&bond->lock); |
2430 | if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { | 2392 | if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { |
@@ -2437,20 +2399,28 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2437 | agg_id = ad_info.aggregator_id; | 2399 | agg_id = ad_info.aggregator_id; |
2438 | 2400 | ||
2439 | if (slaves_in_agg == 0) { | 2401 | if (slaves_in_agg == 0) { |
2440 | /*the aggregator is empty*/ | ||
2441 | pr_debug("%s: Error: active aggregator is empty\n", dev->name); | 2402 | pr_debug("%s: Error: active aggregator is empty\n", dev->name); |
2442 | goto out; | 2403 | goto out; |
2443 | } | 2404 | } |
2444 | 2405 | ||
2445 | slave_agg_no = bond->xmit_hash_policy(skb, slaves_in_agg); | 2406 | slave_agg_no = bond->xmit_hash_policy(skb, slaves_in_agg); |
2407 | first_ok_slave = NULL; | ||
2446 | 2408 | ||
2447 | bond_for_each_slave(bond, slave) { | 2409 | bond_for_each_slave(bond, slave, iter) { |
2448 | struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; | 2410 | agg = SLAVE_AD_INFO(slave).port.aggregator; |
2411 | if (!agg || agg->aggregator_identifier != agg_id) | ||
2412 | continue; | ||
2449 | 2413 | ||
2450 | if (agg && (agg->aggregator_identifier == agg_id)) { | 2414 | if (slave_agg_no >= 0) { |
2415 | if (!first_ok_slave && SLAVE_IS_OK(slave)) | ||
2416 | first_ok_slave = slave; | ||
2451 | slave_agg_no--; | 2417 | slave_agg_no--; |
2452 | if (slave_agg_no < 0) | 2418 | continue; |
2453 | break; | 2419 | } |
2420 | |||
2421 | if (SLAVE_IS_OK(slave)) { | ||
2422 | res = bond_dev_queue_xmit(bond, skb, slave->dev); | ||
2423 | goto out; | ||
2454 | } | 2424 | } |
2455 | } | 2425 | } |
2456 | 2426 | ||
@@ -2460,20 +2430,10 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2460 | goto out; | 2430 | goto out; |
2461 | } | 2431 | } |
2462 | 2432 | ||
2463 | start_at = slave; | 2433 | /* we couldn't find any suitable slave after the agg_no, so use the |
2464 | 2434 | * first suitable found, if found. */ | |
2465 | bond_for_each_slave_from(bond, slave, i, start_at) { | 2435 | if (first_ok_slave) |
2466 | int slave_agg_id = 0; | 2436 | res = bond_dev_queue_xmit(bond, skb, first_ok_slave->dev); |
2467 | struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator; | ||
2468 | |||
2469 | if (agg) | ||
2470 | slave_agg_id = agg->aggregator_identifier; | ||
2471 | |||
2472 | if (SLAVE_IS_OK(slave) && agg && (slave_agg_id == agg_id)) { | ||
2473 | res = bond_dev_queue_xmit(bond, skb, slave->dev); | ||
2474 | break; | ||
2475 | } | ||
2476 | } | ||
2477 | 2437 | ||
2478 | out: | 2438 | out: |
2479 | read_unlock(&bond->lock); | 2439 | read_unlock(&bond->lock); |
@@ -2515,11 +2475,12 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | |||
2515 | void bond_3ad_update_lacp_rate(struct bonding *bond) | 2475 | void bond_3ad_update_lacp_rate(struct bonding *bond) |
2516 | { | 2476 | { |
2517 | struct port *port = NULL; | 2477 | struct port *port = NULL; |
2478 | struct list_head *iter; | ||
2518 | struct slave *slave; | 2479 | struct slave *slave; |
2519 | int lacp_fast; | 2480 | int lacp_fast; |
2520 | 2481 | ||
2521 | lacp_fast = bond->params.lacp_fast; | 2482 | lacp_fast = bond->params.lacp_fast; |
2522 | bond_for_each_slave(bond, slave) { | 2483 | bond_for_each_slave(bond, slave, iter) { |
2523 | port = &(SLAVE_AD_INFO(slave).port); | 2484 | port = &(SLAVE_AD_INFO(slave).port); |
2524 | __get_state_machine_lock(port); | 2485 | __get_state_machine_lock(port); |
2525 | if (lacp_fast) | 2486 | if (lacp_fast) |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index f428ef574372..e96041816b5b 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -223,13 +223,14 @@ static long long compute_gap(struct slave *slave) | |||
223 | static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) | 223 | static struct slave *tlb_get_least_loaded_slave(struct bonding *bond) |
224 | { | 224 | { |
225 | struct slave *slave, *least_loaded; | 225 | struct slave *slave, *least_loaded; |
226 | struct list_head *iter; | ||
226 | long long max_gap; | 227 | long long max_gap; |
227 | 228 | ||
228 | least_loaded = NULL; | 229 | least_loaded = NULL; |
229 | max_gap = LLONG_MIN; | 230 | max_gap = LLONG_MIN; |
230 | 231 | ||
231 | /* Find the slave with the largest gap */ | 232 | /* Find the slave with the largest gap */ |
232 | bond_for_each_slave(bond, slave) { | 233 | bond_for_each_slave(bond, slave, iter) { |
233 | if (SLAVE_IS_OK(slave)) { | 234 | if (SLAVE_IS_OK(slave)) { |
234 | long long gap = compute_gap(slave); | 235 | long long gap = compute_gap(slave); |
235 | 236 | ||
@@ -382,30 +383,31 @@ out: | |||
382 | static struct slave *rlb_next_rx_slave(struct bonding *bond) | 383 | static struct slave *rlb_next_rx_slave(struct bonding *bond) |
383 | { | 384 | { |
384 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 385 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
385 | struct slave *rx_slave, *slave, *start_at; | 386 | struct slave *before = NULL, *rx_slave = NULL, *slave; |
386 | int i = 0; | 387 | struct list_head *iter; |
387 | 388 | bool found = false; | |
388 | if (bond_info->next_rx_slave) | ||
389 | start_at = bond_info->next_rx_slave; | ||
390 | else | ||
391 | start_at = bond_first_slave(bond); | ||
392 | |||
393 | rx_slave = NULL; | ||
394 | 389 | ||
395 | bond_for_each_slave_from(bond, slave, i, start_at) { | 390 | bond_for_each_slave(bond, slave, iter) { |
396 | if (SLAVE_IS_OK(slave)) { | 391 | if (!SLAVE_IS_OK(slave)) |
397 | if (!rx_slave) { | 392 | continue; |
398 | rx_slave = slave; | 393 | if (!found) { |
399 | } else if (slave->speed > rx_slave->speed) { | 394 | if (!before || before->speed < slave->speed) |
395 | before = slave; | ||
396 | } else { | ||
397 | if (!rx_slave || rx_slave->speed < slave->speed) | ||
400 | rx_slave = slave; | 398 | rx_slave = slave; |
401 | } | ||
402 | } | 399 | } |
400 | if (slave == bond_info->rx_slave) | ||
401 | found = true; | ||
403 | } | 402 | } |
403 | /* we didn't find anything after the current or we have something | ||
404 | * better before and up to the current slave | ||
405 | */ | ||
406 | if (!rx_slave || (before && rx_slave->speed < before->speed)) | ||
407 | rx_slave = before; | ||
404 | 408 | ||
405 | if (rx_slave) { | 409 | if (rx_slave) |
406 | slave = bond_next_slave(bond, rx_slave); | 410 | bond_info->rx_slave = rx_slave; |
407 | bond_info->next_rx_slave = slave; | ||
408 | } | ||
409 | 411 | ||
410 | return rx_slave; | 412 | return rx_slave; |
411 | } | 413 | } |
@@ -1019,7 +1021,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]) | |||
1019 | 1021 | ||
1020 | /* loop through vlans and send one packet for each */ | 1022 | /* loop through vlans and send one packet for each */ |
1021 | rcu_read_lock(); | 1023 | rcu_read_lock(); |
1022 | netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) { | 1024 | netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) { |
1023 | if (upper->priv_flags & IFF_802_1Q_VLAN) | 1025 | if (upper->priv_flags & IFF_802_1Q_VLAN) |
1024 | alb_send_lp_vid(slave, mac_addr, | 1026 | alb_send_lp_vid(slave, mac_addr, |
1025 | vlan_dev_vlan_id(upper)); | 1027 | vlan_dev_vlan_id(upper)); |
@@ -1172,10 +1174,11 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla | |||
1172 | */ | 1174 | */ |
1173 | static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) | 1175 | static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) |
1174 | { | 1176 | { |
1175 | struct slave *tmp_slave1, *free_mac_slave = NULL; | ||
1176 | struct slave *has_bond_addr = bond->curr_active_slave; | 1177 | struct slave *has_bond_addr = bond->curr_active_slave; |
1178 | struct slave *tmp_slave1, *free_mac_slave = NULL; | ||
1179 | struct list_head *iter; | ||
1177 | 1180 | ||
1178 | if (list_empty(&bond->slave_list)) { | 1181 | if (!bond_has_slaves(bond)) { |
1179 | /* this is the first slave */ | 1182 | /* this is the first slave */ |
1180 | return 0; | 1183 | return 0; |
1181 | } | 1184 | } |
@@ -1196,7 +1199,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav | |||
1196 | /* The slave's address is equal to the address of the bond. | 1199 | /* The slave's address is equal to the address of the bond. |
1197 | * Search for a spare address in the bond for this slave. | 1200 | * Search for a spare address in the bond for this slave. |
1198 | */ | 1201 | */ |
1199 | bond_for_each_slave(bond, tmp_slave1) { | 1202 | bond_for_each_slave(bond, tmp_slave1, iter) { |
1200 | if (!bond_slave_has_mac(bond, tmp_slave1->perm_hwaddr)) { | 1203 | if (!bond_slave_has_mac(bond, tmp_slave1->perm_hwaddr)) { |
1201 | /* no slave has tmp_slave1's perm addr | 1204 | /* no slave has tmp_slave1's perm addr |
1202 | * as its curr addr | 1205 | * as its curr addr |
@@ -1246,15 +1249,16 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav | |||
1246 | */ | 1249 | */ |
1247 | static int alb_set_mac_address(struct bonding *bond, void *addr) | 1250 | static int alb_set_mac_address(struct bonding *bond, void *addr) |
1248 | { | 1251 | { |
1249 | char tmp_addr[ETH_ALEN]; | 1252 | struct slave *slave, *rollback_slave; |
1250 | struct slave *slave; | 1253 | struct list_head *iter; |
1251 | struct sockaddr sa; | 1254 | struct sockaddr sa; |
1255 | char tmp_addr[ETH_ALEN]; | ||
1252 | int res; | 1256 | int res; |
1253 | 1257 | ||
1254 | if (bond->alb_info.rlb_enabled) | 1258 | if (bond->alb_info.rlb_enabled) |
1255 | return 0; | 1259 | return 0; |
1256 | 1260 | ||
1257 | bond_for_each_slave(bond, slave) { | 1261 | bond_for_each_slave(bond, slave, iter) { |
1258 | /* save net_device's current hw address */ | 1262 | /* save net_device's current hw address */ |
1259 | memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); | 1263 | memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); |
1260 | 1264 | ||
@@ -1274,10 +1278,12 @@ unwind: | |||
1274 | sa.sa_family = bond->dev->type; | 1278 | sa.sa_family = bond->dev->type; |
1275 | 1279 | ||
1276 | /* unwind from head to the slave that failed */ | 1280 | /* unwind from head to the slave that failed */ |
1277 | bond_for_each_slave_continue_reverse(bond, slave) { | 1281 | bond_for_each_slave(bond, rollback_slave, iter) { |
1278 | memcpy(tmp_addr, slave->dev->dev_addr, ETH_ALEN); | 1282 | if (rollback_slave == slave) |
1279 | dev_set_mac_address(slave->dev, &sa); | 1283 | break; |
1280 | memcpy(slave->dev->dev_addr, tmp_addr, ETH_ALEN); | 1284 | memcpy(tmp_addr, rollback_slave->dev->dev_addr, ETH_ALEN); |
1285 | dev_set_mac_address(rollback_slave->dev, &sa); | ||
1286 | memcpy(rollback_slave->dev->dev_addr, tmp_addr, ETH_ALEN); | ||
1281 | } | 1287 | } |
1282 | 1288 | ||
1283 | return res; | 1289 | return res; |
@@ -1458,11 +1464,12 @@ void bond_alb_monitor(struct work_struct *work) | |||
1458 | struct bonding *bond = container_of(work, struct bonding, | 1464 | struct bonding *bond = container_of(work, struct bonding, |
1459 | alb_work.work); | 1465 | alb_work.work); |
1460 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 1466 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
1467 | struct list_head *iter; | ||
1461 | struct slave *slave; | 1468 | struct slave *slave; |
1462 | 1469 | ||
1463 | read_lock(&bond->lock); | 1470 | read_lock(&bond->lock); |
1464 | 1471 | ||
1465 | if (list_empty(&bond->slave_list)) { | 1472 | if (!bond_has_slaves(bond)) { |
1466 | bond_info->tx_rebalance_counter = 0; | 1473 | bond_info->tx_rebalance_counter = 0; |
1467 | bond_info->lp_counter = 0; | 1474 | bond_info->lp_counter = 0; |
1468 | goto re_arm; | 1475 | goto re_arm; |
@@ -1480,7 +1487,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
1480 | */ | 1487 | */ |
1481 | read_lock(&bond->curr_slave_lock); | 1488 | read_lock(&bond->curr_slave_lock); |
1482 | 1489 | ||
1483 | bond_for_each_slave(bond, slave) | 1490 | bond_for_each_slave(bond, slave, iter) |
1484 | alb_send_learning_packets(slave, slave->dev->dev_addr); | 1491 | alb_send_learning_packets(slave, slave->dev->dev_addr); |
1485 | 1492 | ||
1486 | read_unlock(&bond->curr_slave_lock); | 1493 | read_unlock(&bond->curr_slave_lock); |
@@ -1493,7 +1500,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
1493 | 1500 | ||
1494 | read_lock(&bond->curr_slave_lock); | 1501 | read_lock(&bond->curr_slave_lock); |
1495 | 1502 | ||
1496 | bond_for_each_slave(bond, slave) { | 1503 | bond_for_each_slave(bond, slave, iter) { |
1497 | tlb_clear_slave(bond, slave, 1); | 1504 | tlb_clear_slave(bond, slave, 1); |
1498 | if (slave == bond->curr_active_slave) { | 1505 | if (slave == bond->curr_active_slave) { |
1499 | SLAVE_TLB_INFO(slave).load = | 1506 | SLAVE_TLB_INFO(slave).load = |
@@ -1599,13 +1606,13 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave) | |||
1599 | */ | 1606 | */ |
1600 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) | 1607 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) |
1601 | { | 1608 | { |
1602 | if (!list_empty(&bond->slave_list)) | 1609 | if (bond_has_slaves(bond)) |
1603 | alb_change_hw_addr_on_detach(bond, slave); | 1610 | alb_change_hw_addr_on_detach(bond, slave); |
1604 | 1611 | ||
1605 | tlb_clear_slave(bond, slave, 0); | 1612 | tlb_clear_slave(bond, slave, 0); |
1606 | 1613 | ||
1607 | if (bond->alb_info.rlb_enabled) { | 1614 | if (bond->alb_info.rlb_enabled) { |
1608 | bond->alb_info.next_rx_slave = NULL; | 1615 | bond->alb_info.rx_slave = NULL; |
1609 | rlb_clear_slave(bond, slave); | 1616 | rlb_clear_slave(bond, slave); |
1610 | } | 1617 | } |
1611 | } | 1618 | } |
@@ -1669,7 +1676,7 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1669 | swap_slave = bond->curr_active_slave; | 1676 | swap_slave = bond->curr_active_slave; |
1670 | rcu_assign_pointer(bond->curr_active_slave, new_slave); | 1677 | rcu_assign_pointer(bond->curr_active_slave, new_slave); |
1671 | 1678 | ||
1672 | if (!new_slave || list_empty(&bond->slave_list)) | 1679 | if (!new_slave || !bond_has_slaves(bond)) |
1673 | return; | 1680 | return; |
1674 | 1681 | ||
1675 | /* set the new curr_active_slave to the bonds mac address | 1682 | /* set the new curr_active_slave to the bonds mac address |
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h index c5eff5dafdfe..4226044efd08 100644 --- a/drivers/net/bonding/bond_alb.h +++ b/drivers/net/bonding/bond_alb.h | |||
@@ -154,9 +154,7 @@ struct alb_bond_info { | |||
154 | u8 rx_ntt; /* flag - need to transmit | 154 | u8 rx_ntt; /* flag - need to transmit |
155 | * to all rx clients | 155 | * to all rx clients |
156 | */ | 156 | */ |
157 | struct slave *next_rx_slave;/* next slave to be assigned | 157 | struct slave *rx_slave;/* last slave to xmit from */ |
158 | * to a new rx client for | ||
159 | */ | ||
160 | u8 primary_is_promisc; /* boolean */ | 158 | u8 primary_is_promisc; /* boolean */ |
161 | u32 rlb_promisc_timeout_counter;/* counts primary | 159 | u32 rlb_promisc_timeout_counter;/* counts primary |
162 | * promiscuity time | 160 | * promiscuity time |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index e883bfe2e727..fe8a94f9d7db 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -332,10 +332,11 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev, | |||
332 | __be16 proto, u16 vid) | 332 | __be16 proto, u16 vid) |
333 | { | 333 | { |
334 | struct bonding *bond = netdev_priv(bond_dev); | 334 | struct bonding *bond = netdev_priv(bond_dev); |
335 | struct slave *slave; | 335 | struct slave *slave, *rollback_slave; |
336 | struct list_head *iter; | ||
336 | int res; | 337 | int res; |
337 | 338 | ||
338 | bond_for_each_slave(bond, slave) { | 339 | bond_for_each_slave(bond, slave, iter) { |
339 | res = vlan_vid_add(slave->dev, proto, vid); | 340 | res = vlan_vid_add(slave->dev, proto, vid); |
340 | if (res) | 341 | if (res) |
341 | goto unwind; | 342 | goto unwind; |
@@ -344,9 +345,13 @@ static int bond_vlan_rx_add_vid(struct net_device *bond_dev, | |||
344 | return 0; | 345 | return 0; |
345 | 346 | ||
346 | unwind: | 347 | unwind: |
347 | /* unwind from the slave that failed */ | 348 | /* unwind to the slave that failed */ |
348 | bond_for_each_slave_continue_reverse(bond, slave) | 349 | bond_for_each_slave(bond, rollback_slave, iter) { |
349 | vlan_vid_del(slave->dev, proto, vid); | 350 | if (rollback_slave == slave) |
351 | break; | ||
352 | |||
353 | vlan_vid_del(rollback_slave->dev, proto, vid); | ||
354 | } | ||
350 | 355 | ||
351 | return res; | 356 | return res; |
352 | } | 357 | } |
@@ -360,9 +365,10 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, | |||
360 | __be16 proto, u16 vid) | 365 | __be16 proto, u16 vid) |
361 | { | 366 | { |
362 | struct bonding *bond = netdev_priv(bond_dev); | 367 | struct bonding *bond = netdev_priv(bond_dev); |
368 | struct list_head *iter; | ||
363 | struct slave *slave; | 369 | struct slave *slave; |
364 | 370 | ||
365 | bond_for_each_slave(bond, slave) | 371 | bond_for_each_slave(bond, slave, iter) |
366 | vlan_vid_del(slave->dev, proto, vid); | 372 | vlan_vid_del(slave->dev, proto, vid); |
367 | 373 | ||
368 | if (bond_is_lb(bond)) | 374 | if (bond_is_lb(bond)) |
@@ -382,15 +388,16 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, | |||
382 | */ | 388 | */ |
383 | static int bond_set_carrier(struct bonding *bond) | 389 | static int bond_set_carrier(struct bonding *bond) |
384 | { | 390 | { |
391 | struct list_head *iter; | ||
385 | struct slave *slave; | 392 | struct slave *slave; |
386 | 393 | ||
387 | if (list_empty(&bond->slave_list)) | 394 | if (!bond_has_slaves(bond)) |
388 | goto down; | 395 | goto down; |
389 | 396 | ||
390 | if (bond->params.mode == BOND_MODE_8023AD) | 397 | if (bond->params.mode == BOND_MODE_8023AD) |
391 | return bond_3ad_set_carrier(bond); | 398 | return bond_3ad_set_carrier(bond); |
392 | 399 | ||
393 | bond_for_each_slave(bond, slave) { | 400 | bond_for_each_slave(bond, slave, iter) { |
394 | if (slave->link == BOND_LINK_UP) { | 401 | if (slave->link == BOND_LINK_UP) { |
395 | if (!netif_carrier_ok(bond->dev)) { | 402 | if (!netif_carrier_ok(bond->dev)) { |
396 | netif_carrier_on(bond->dev); | 403 | netif_carrier_on(bond->dev); |
@@ -522,7 +529,9 @@ static int bond_check_dev_link(struct bonding *bond, | |||
522 | */ | 529 | */ |
523 | static int bond_set_promiscuity(struct bonding *bond, int inc) | 530 | static int bond_set_promiscuity(struct bonding *bond, int inc) |
524 | { | 531 | { |
532 | struct list_head *iter; | ||
525 | int err = 0; | 533 | int err = 0; |
534 | |||
526 | if (USES_PRIMARY(bond->params.mode)) { | 535 | if (USES_PRIMARY(bond->params.mode)) { |
527 | /* write lock already acquired */ | 536 | /* write lock already acquired */ |
528 | if (bond->curr_active_slave) { | 537 | if (bond->curr_active_slave) { |
@@ -532,7 +541,7 @@ static int bond_set_promiscuity(struct bonding *bond, int inc) | |||
532 | } else { | 541 | } else { |
533 | struct slave *slave; | 542 | struct slave *slave; |
534 | 543 | ||
535 | bond_for_each_slave(bond, slave) { | 544 | bond_for_each_slave(bond, slave, iter) { |
536 | err = dev_set_promiscuity(slave->dev, inc); | 545 | err = dev_set_promiscuity(slave->dev, inc); |
537 | if (err) | 546 | if (err) |
538 | return err; | 547 | return err; |
@@ -546,7 +555,9 @@ static int bond_set_promiscuity(struct bonding *bond, int inc) | |||
546 | */ | 555 | */ |
547 | static int bond_set_allmulti(struct bonding *bond, int inc) | 556 | static int bond_set_allmulti(struct bonding *bond, int inc) |
548 | { | 557 | { |
558 | struct list_head *iter; | ||
549 | int err = 0; | 559 | int err = 0; |
560 | |||
550 | if (USES_PRIMARY(bond->params.mode)) { | 561 | if (USES_PRIMARY(bond->params.mode)) { |
551 | /* write lock already acquired */ | 562 | /* write lock already acquired */ |
552 | if (bond->curr_active_slave) { | 563 | if (bond->curr_active_slave) { |
@@ -556,7 +567,7 @@ static int bond_set_allmulti(struct bonding *bond, int inc) | |||
556 | } else { | 567 | } else { |
557 | struct slave *slave; | 568 | struct slave *slave; |
558 | 569 | ||
559 | bond_for_each_slave(bond, slave) { | 570 | bond_for_each_slave(bond, slave, iter) { |
560 | err = dev_set_allmulti(slave->dev, inc); | 571 | err = dev_set_allmulti(slave->dev, inc); |
561 | if (err) | 572 | if (err) |
562 | return err; | 573 | return err; |
@@ -774,43 +785,24 @@ static bool bond_should_change_active(struct bonding *bond) | |||
774 | /** | 785 | /** |
775 | * find_best_interface - select the best available slave to be the active one | 786 | * find_best_interface - select the best available slave to be the active one |
776 | * @bond: our bonding struct | 787 | * @bond: our bonding struct |
777 | * | ||
778 | * Warning: Caller must hold curr_slave_lock for writing. | ||
779 | */ | 788 | */ |
780 | static struct slave *bond_find_best_slave(struct bonding *bond) | 789 | static struct slave *bond_find_best_slave(struct bonding *bond) |
781 | { | 790 | { |
782 | struct slave *new_active, *old_active; | 791 | struct slave *slave, *bestslave = NULL; |
783 | struct slave *bestslave = NULL; | 792 | struct list_head *iter; |
784 | int mintime = bond->params.updelay; | 793 | int mintime = bond->params.updelay; |
785 | int i; | ||
786 | |||
787 | new_active = bond->curr_active_slave; | ||
788 | |||
789 | if (!new_active) { /* there were no active slaves left */ | ||
790 | new_active = bond_first_slave(bond); | ||
791 | if (!new_active) | ||
792 | return NULL; /* still no slave, return NULL */ | ||
793 | } | ||
794 | |||
795 | if ((bond->primary_slave) && | ||
796 | bond->primary_slave->link == BOND_LINK_UP && | ||
797 | bond_should_change_active(bond)) { | ||
798 | new_active = bond->primary_slave; | ||
799 | } | ||
800 | 794 | ||
801 | /* remember where to stop iterating over the slaves */ | 795 | if (bond->primary_slave && bond->primary_slave->link == BOND_LINK_UP && |
802 | old_active = new_active; | 796 | bond_should_change_active(bond)) |
803 | 797 | return bond->primary_slave; | |
804 | bond_for_each_slave_from(bond, new_active, i, old_active) { | 798 | |
805 | if (new_active->link == BOND_LINK_UP) { | 799 | bond_for_each_slave(bond, slave, iter) { |
806 | return new_active; | 800 | if (slave->link == BOND_LINK_UP) |
807 | } else if (new_active->link == BOND_LINK_BACK && | 801 | return slave; |
808 | IS_UP(new_active->dev)) { | 802 | if (slave->link == BOND_LINK_BACK && IS_UP(slave->dev) && |
809 | /* link up, but waiting for stabilization */ | 803 | slave->delay < mintime) { |
810 | if (new_active->delay < mintime) { | 804 | mintime = slave->delay; |
811 | mintime = new_active->delay; | 805 | bestslave = slave; |
812 | bestslave = new_active; | ||
813 | } | ||
814 | } | 806 | } |
815 | } | 807 | } |
816 | 808 | ||
@@ -980,7 +972,6 @@ void bond_select_active_slave(struct bonding *bond) | |||
980 | */ | 972 | */ |
981 | static void bond_attach_slave(struct bonding *bond, struct slave *new_slave) | 973 | static void bond_attach_slave(struct bonding *bond, struct slave *new_slave) |
982 | { | 974 | { |
983 | list_add_tail_rcu(&new_slave->list, &bond->slave_list); | ||
984 | bond->slave_cnt++; | 975 | bond->slave_cnt++; |
985 | } | 976 | } |
986 | 977 | ||
@@ -996,7 +987,6 @@ static void bond_attach_slave(struct bonding *bond, struct slave *new_slave) | |||
996 | */ | 987 | */ |
997 | static void bond_detach_slave(struct bonding *bond, struct slave *slave) | 988 | static void bond_detach_slave(struct bonding *bond, struct slave *slave) |
998 | { | 989 | { |
999 | list_del_rcu(&slave->list); | ||
1000 | bond->slave_cnt--; | 990 | bond->slave_cnt--; |
1001 | } | 991 | } |
1002 | 992 | ||
@@ -1046,9 +1036,10 @@ static void bond_poll_controller(struct net_device *bond_dev) | |||
1046 | static void bond_netpoll_cleanup(struct net_device *bond_dev) | 1036 | static void bond_netpoll_cleanup(struct net_device *bond_dev) |
1047 | { | 1037 | { |
1048 | struct bonding *bond = netdev_priv(bond_dev); | 1038 | struct bonding *bond = netdev_priv(bond_dev); |
1039 | struct list_head *iter; | ||
1049 | struct slave *slave; | 1040 | struct slave *slave; |
1050 | 1041 | ||
1051 | bond_for_each_slave(bond, slave) | 1042 | bond_for_each_slave(bond, slave, iter) |
1052 | if (IS_UP(slave->dev)) | 1043 | if (IS_UP(slave->dev)) |
1053 | slave_disable_netpoll(slave); | 1044 | slave_disable_netpoll(slave); |
1054 | } | 1045 | } |
@@ -1056,10 +1047,11 @@ static void bond_netpoll_cleanup(struct net_device *bond_dev) | |||
1056 | static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gfp_t gfp) | 1047 | static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gfp_t gfp) |
1057 | { | 1048 | { |
1058 | struct bonding *bond = netdev_priv(dev); | 1049 | struct bonding *bond = netdev_priv(dev); |
1050 | struct list_head *iter; | ||
1059 | struct slave *slave; | 1051 | struct slave *slave; |
1060 | int err = 0; | 1052 | int err = 0; |
1061 | 1053 | ||
1062 | bond_for_each_slave(bond, slave) { | 1054 | bond_for_each_slave(bond, slave, iter) { |
1063 | err = slave_enable_netpoll(slave); | 1055 | err = slave_enable_netpoll(slave); |
1064 | if (err) { | 1056 | if (err) { |
1065 | bond_netpoll_cleanup(dev); | 1057 | bond_netpoll_cleanup(dev); |
@@ -1087,10 +1079,11 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1087 | netdev_features_t features) | 1079 | netdev_features_t features) |
1088 | { | 1080 | { |
1089 | struct bonding *bond = netdev_priv(dev); | 1081 | struct bonding *bond = netdev_priv(dev); |
1082 | struct list_head *iter; | ||
1090 | netdev_features_t mask; | 1083 | netdev_features_t mask; |
1091 | struct slave *slave; | 1084 | struct slave *slave; |
1092 | 1085 | ||
1093 | if (list_empty(&bond->slave_list)) { | 1086 | if (!bond_has_slaves(bond)) { |
1094 | /* Disable adding VLANs to empty bond. But why? --mq */ | 1087 | /* Disable adding VLANs to empty bond. But why? --mq */ |
1095 | features |= NETIF_F_VLAN_CHALLENGED; | 1088 | features |= NETIF_F_VLAN_CHALLENGED; |
1096 | return features; | 1089 | return features; |
@@ -1100,7 +1093,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1100 | features &= ~NETIF_F_ONE_FOR_ALL; | 1093 | features &= ~NETIF_F_ONE_FOR_ALL; |
1101 | features |= NETIF_F_ALL_FOR_ALL; | 1094 | features |= NETIF_F_ALL_FOR_ALL; |
1102 | 1095 | ||
1103 | bond_for_each_slave(bond, slave) { | 1096 | bond_for_each_slave(bond, slave, iter) { |
1104 | features = netdev_increment_features(features, | 1097 | features = netdev_increment_features(features, |
1105 | slave->dev->features, | 1098 | slave->dev->features, |
1106 | mask); | 1099 | mask); |
@@ -1118,16 +1111,17 @@ static void bond_compute_features(struct bonding *bond) | |||
1118 | { | 1111 | { |
1119 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; | 1112 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; |
1120 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; | 1113 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; |
1114 | struct net_device *bond_dev = bond->dev; | ||
1115 | struct list_head *iter; | ||
1116 | struct slave *slave; | ||
1121 | unsigned short max_hard_header_len = ETH_HLEN; | 1117 | unsigned short max_hard_header_len = ETH_HLEN; |
1122 | unsigned int gso_max_size = GSO_MAX_SIZE; | 1118 | unsigned int gso_max_size = GSO_MAX_SIZE; |
1123 | struct net_device *bond_dev = bond->dev; | ||
1124 | u16 gso_max_segs = GSO_MAX_SEGS; | 1119 | u16 gso_max_segs = GSO_MAX_SEGS; |
1125 | struct slave *slave; | ||
1126 | 1120 | ||
1127 | if (list_empty(&bond->slave_list)) | 1121 | if (!bond_has_slaves(bond)) |
1128 | goto done; | 1122 | goto done; |
1129 | 1123 | ||
1130 | bond_for_each_slave(bond, slave) { | 1124 | bond_for_each_slave(bond, slave, iter) { |
1131 | vlan_features = netdev_increment_features(vlan_features, | 1125 | vlan_features = netdev_increment_features(vlan_features, |
1132 | slave->dev->vlan_features, BOND_VLAN_FEATURES); | 1126 | slave->dev->vlan_features, BOND_VLAN_FEATURES); |
1133 | 1127 | ||
@@ -1233,11 +1227,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
1233 | } | 1227 | } |
1234 | 1228 | ||
1235 | static int bond_master_upper_dev_link(struct net_device *bond_dev, | 1229 | static int bond_master_upper_dev_link(struct net_device *bond_dev, |
1236 | struct net_device *slave_dev) | 1230 | struct net_device *slave_dev, |
1231 | struct slave *slave) | ||
1237 | { | 1232 | { |
1238 | int err; | 1233 | int err; |
1239 | 1234 | ||
1240 | err = netdev_master_upper_dev_link(slave_dev, bond_dev); | 1235 | err = netdev_master_upper_dev_link_private(slave_dev, bond_dev, slave); |
1241 | if (err) | 1236 | if (err) |
1242 | return err; | 1237 | return err; |
1243 | slave_dev->flags |= IFF_SLAVE; | 1238 | slave_dev->flags |= IFF_SLAVE; |
@@ -1258,7 +1253,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1258 | { | 1253 | { |
1259 | struct bonding *bond = netdev_priv(bond_dev); | 1254 | struct bonding *bond = netdev_priv(bond_dev); |
1260 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | 1255 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; |
1261 | struct slave *new_slave = NULL; | 1256 | struct slave *new_slave = NULL, *prev_slave; |
1262 | struct sockaddr addr; | 1257 | struct sockaddr addr; |
1263 | int link_reporting; | 1258 | int link_reporting; |
1264 | int res = 0, i; | 1259 | int res = 0, i; |
@@ -1313,7 +1308,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1313 | * bond ether type mutual exclusion - don't allow slaves of dissimilar | 1308 | * bond ether type mutual exclusion - don't allow slaves of dissimilar |
1314 | * ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same bond | 1309 | * ether type (eg ARPHRD_ETHER and ARPHRD_INFINIBAND) share the same bond |
1315 | */ | 1310 | */ |
1316 | if (list_empty(&bond->slave_list)) { | 1311 | if (!bond_has_slaves(bond)) { |
1317 | if (bond_dev->type != slave_dev->type) { | 1312 | if (bond_dev->type != slave_dev->type) { |
1318 | pr_debug("%s: change device type from %d to %d\n", | 1313 | pr_debug("%s: change device type from %d to %d\n", |
1319 | bond_dev->name, | 1314 | bond_dev->name, |
@@ -1352,7 +1347,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1352 | } | 1347 | } |
1353 | 1348 | ||
1354 | if (slave_ops->ndo_set_mac_address == NULL) { | 1349 | if (slave_ops->ndo_set_mac_address == NULL) { |
1355 | if (list_empty(&bond->slave_list)) { | 1350 | if (!bond_has_slaves(bond)) { |
1356 | pr_warning("%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.", | 1351 | pr_warning("%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.", |
1357 | bond_dev->name); | 1352 | bond_dev->name); |
1358 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; | 1353 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; |
@@ -1368,7 +1363,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1368 | 1363 | ||
1369 | /* If this is the first slave, then we need to set the master's hardware | 1364 | /* If this is the first slave, then we need to set the master's hardware |
1370 | * address to be the same as the slave's. */ | 1365 | * address to be the same as the slave's. */ |
1371 | if (list_empty(&bond->slave_list) && | 1366 | if (!bond_has_slaves(bond) && |
1372 | bond->dev->addr_assign_type == NET_ADDR_RANDOM) | 1367 | bond->dev->addr_assign_type == NET_ADDR_RANDOM) |
1373 | bond_set_dev_addr(bond->dev, slave_dev); | 1368 | bond_set_dev_addr(bond->dev, slave_dev); |
1374 | 1369 | ||
@@ -1377,7 +1372,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1377 | res = -ENOMEM; | 1372 | res = -ENOMEM; |
1378 | goto err_undo_flags; | 1373 | goto err_undo_flags; |
1379 | } | 1374 | } |
1380 | INIT_LIST_HEAD(&new_slave->list); | ||
1381 | /* | 1375 | /* |
1382 | * Set the new_slave's queue_id to be zero. Queue ID mapping | 1376 | * Set the new_slave's queue_id to be zero. Queue ID mapping |
1383 | * is set via sysfs or module option if desired. | 1377 | * is set via sysfs or module option if desired. |
@@ -1413,17 +1407,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1413 | } | 1407 | } |
1414 | } | 1408 | } |
1415 | 1409 | ||
1416 | res = bond_master_upper_dev_link(bond_dev, slave_dev); | ||
1417 | if (res) { | ||
1418 | pr_debug("Error %d calling bond_master_upper_dev_link\n", res); | ||
1419 | goto err_restore_mac; | ||
1420 | } | ||
1421 | |||
1422 | /* open the slave since the application closed it */ | 1410 | /* open the slave since the application closed it */ |
1423 | res = dev_open(slave_dev); | 1411 | res = dev_open(slave_dev); |
1424 | if (res) { | 1412 | if (res) { |
1425 | pr_debug("Opening slave %s failed\n", slave_dev->name); | 1413 | pr_debug("Opening slave %s failed\n", slave_dev->name); |
1426 | goto err_unset_master; | 1414 | goto err_restore_mac; |
1427 | } | 1415 | } |
1428 | 1416 | ||
1429 | new_slave->bond = bond; | 1417 | new_slave->bond = bond; |
@@ -1481,6 +1469,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1481 | 1469 | ||
1482 | write_lock_bh(&bond->lock); | 1470 | write_lock_bh(&bond->lock); |
1483 | 1471 | ||
1472 | prev_slave = bond_last_slave(bond); | ||
1484 | bond_attach_slave(bond, new_slave); | 1473 | bond_attach_slave(bond, new_slave); |
1485 | 1474 | ||
1486 | new_slave->delay = 0; | 1475 | new_slave->delay = 0; |
@@ -1568,16 +1557,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1568 | */ | 1557 | */ |
1569 | bond_set_slave_inactive_flags(new_slave); | 1558 | bond_set_slave_inactive_flags(new_slave); |
1570 | /* if this is the first slave */ | 1559 | /* if this is the first slave */ |
1571 | if (bond_first_slave(bond) == new_slave) { | 1560 | if (!prev_slave) { |
1572 | SLAVE_AD_INFO(new_slave).id = 1; | 1561 | SLAVE_AD_INFO(new_slave).id = 1; |
1573 | /* Initialize AD with the number of times that the AD timer is called in 1 second | 1562 | /* Initialize AD with the number of times that the AD timer is called in 1 second |
1574 | * can be called only after the mac address of the bond is set | 1563 | * can be called only after the mac address of the bond is set |
1575 | */ | 1564 | */ |
1576 | bond_3ad_initialize(bond, 1000/AD_TIMER_INTERVAL); | 1565 | bond_3ad_initialize(bond, 1000/AD_TIMER_INTERVAL); |
1577 | } else { | 1566 | } else { |
1578 | struct slave *prev_slave; | ||
1579 | |||
1580 | prev_slave = bond_prev_slave(bond, new_slave); | ||
1581 | SLAVE_AD_INFO(new_slave).id = | 1567 | SLAVE_AD_INFO(new_slave).id = |
1582 | SLAVE_AD_INFO(prev_slave).id + 1; | 1568 | SLAVE_AD_INFO(prev_slave).id + 1; |
1583 | } | 1569 | } |
@@ -1626,17 +1612,20 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1626 | 1612 | ||
1627 | read_unlock(&bond->lock); | 1613 | read_unlock(&bond->lock); |
1628 | 1614 | ||
1629 | res = bond_create_slave_symlinks(bond_dev, slave_dev); | ||
1630 | if (res) | ||
1631 | goto err_detach; | ||
1632 | |||
1633 | res = netdev_rx_handler_register(slave_dev, bond_handle_frame, | 1615 | res = netdev_rx_handler_register(slave_dev, bond_handle_frame, |
1634 | new_slave); | 1616 | new_slave); |
1635 | if (res) { | 1617 | if (res) { |
1636 | pr_debug("Error %d calling netdev_rx_handler_register\n", res); | 1618 | pr_debug("Error %d calling netdev_rx_handler_register\n", res); |
1637 | goto err_dest_symlinks; | 1619 | goto err_detach; |
1638 | } | 1620 | } |
1639 | 1621 | ||
1622 | res = bond_master_upper_dev_link(bond_dev, slave_dev, new_slave); | ||
1623 | if (res) { | ||
1624 | pr_debug("Error %d calling bond_master_upper_dev_link\n", res); | ||
1625 | goto err_unregister; | ||
1626 | } | ||
1627 | |||
1628 | |||
1640 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", | 1629 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", |
1641 | bond_dev->name, slave_dev->name, | 1630 | bond_dev->name, slave_dev->name, |
1642 | bond_is_active_slave(new_slave) ? "n active" : " backup", | 1631 | bond_is_active_slave(new_slave) ? "n active" : " backup", |
@@ -1646,8 +1635,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1646 | return 0; | 1635 | return 0; |
1647 | 1636 | ||
1648 | /* Undo stages on error */ | 1637 | /* Undo stages on error */ |
1649 | err_dest_symlinks: | 1638 | err_unregister: |
1650 | bond_destroy_slave_symlinks(bond_dev, slave_dev); | 1639 | netdev_rx_handler_unregister(slave_dev); |
1651 | 1640 | ||
1652 | err_detach: | 1641 | err_detach: |
1653 | if (!USES_PRIMARY(bond->params.mode)) | 1642 | if (!USES_PRIMARY(bond->params.mode)) |
@@ -1675,9 +1664,6 @@ err_close: | |||
1675 | slave_dev->priv_flags &= ~IFF_BONDING; | 1664 | slave_dev->priv_flags &= ~IFF_BONDING; |
1676 | dev_close(slave_dev); | 1665 | dev_close(slave_dev); |
1677 | 1666 | ||
1678 | err_unset_master: | ||
1679 | bond_upper_dev_unlink(bond_dev, slave_dev); | ||
1680 | |||
1681 | err_restore_mac: | 1667 | err_restore_mac: |
1682 | if (!bond->params.fail_over_mac) { | 1668 | if (!bond->params.fail_over_mac) { |
1683 | /* XXX TODO - fom follow mode needs to change master's | 1669 | /* XXX TODO - fom follow mode needs to change master's |
@@ -1698,7 +1684,7 @@ err_free: | |||
1698 | err_undo_flags: | 1684 | err_undo_flags: |
1699 | bond_compute_features(bond); | 1685 | bond_compute_features(bond); |
1700 | /* Enslave of first slave has failed and we need to fix master's mac */ | 1686 | /* Enslave of first slave has failed and we need to fix master's mac */ |
1701 | if (list_empty(&bond->slave_list) && | 1687 | if (!bond_has_slaves(bond) && |
1702 | ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr)) | 1688 | ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr)) |
1703 | eth_hw_addr_random(bond_dev); | 1689 | eth_hw_addr_random(bond_dev); |
1704 | 1690 | ||
@@ -1749,6 +1735,8 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1749 | } | 1735 | } |
1750 | 1736 | ||
1751 | write_unlock_bh(&bond->lock); | 1737 | write_unlock_bh(&bond->lock); |
1738 | |||
1739 | bond_upper_dev_unlink(bond_dev, slave_dev); | ||
1752 | /* unregister rx_handler early so bond_handle_frame wouldn't be called | 1740 | /* unregister rx_handler early so bond_handle_frame wouldn't be called |
1753 | * for this slave anymore. | 1741 | * for this slave anymore. |
1754 | */ | 1742 | */ |
@@ -1777,7 +1765,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1777 | 1765 | ||
1778 | if (!all && !bond->params.fail_over_mac) { | 1766 | if (!all && !bond->params.fail_over_mac) { |
1779 | if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) && | 1767 | if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) && |
1780 | !list_empty(&bond->slave_list)) | 1768 | bond_has_slaves(bond)) |
1781 | pr_warn("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", | 1769 | pr_warn("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", |
1782 | bond_dev->name, slave_dev->name, | 1770 | bond_dev->name, slave_dev->name, |
1783 | slave->perm_hwaddr, | 1771 | slave->perm_hwaddr, |
@@ -1820,7 +1808,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1820 | write_lock_bh(&bond->lock); | 1808 | write_lock_bh(&bond->lock); |
1821 | } | 1809 | } |
1822 | 1810 | ||
1823 | if (list_empty(&bond->slave_list)) { | 1811 | if (!bond_has_slaves(bond)) { |
1824 | bond_set_carrier(bond); | 1812 | bond_set_carrier(bond); |
1825 | eth_hw_addr_random(bond_dev); | 1813 | eth_hw_addr_random(bond_dev); |
1826 | 1814 | ||
@@ -1836,7 +1824,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1836 | unblock_netpoll_tx(); | 1824 | unblock_netpoll_tx(); |
1837 | synchronize_rcu(); | 1825 | synchronize_rcu(); |
1838 | 1826 | ||
1839 | if (list_empty(&bond->slave_list)) { | 1827 | if (!bond_has_slaves(bond)) { |
1840 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | 1828 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); |
1841 | call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); | 1829 | call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); |
1842 | } | 1830 | } |
@@ -1848,8 +1836,6 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1848 | bond_dev->name, slave_dev->name, bond_dev->name); | 1836 | bond_dev->name, slave_dev->name, bond_dev->name); |
1849 | 1837 | ||
1850 | /* must do this from outside any spinlocks */ | 1838 | /* must do this from outside any spinlocks */ |
1851 | bond_destroy_slave_symlinks(bond_dev, slave_dev); | ||
1852 | |||
1853 | vlan_vids_del_by_dev(slave_dev, bond_dev); | 1839 | vlan_vids_del_by_dev(slave_dev, bond_dev); |
1854 | 1840 | ||
1855 | /* If the mode USES_PRIMARY, then this cases was handled above by | 1841 | /* If the mode USES_PRIMARY, then this cases was handled above by |
@@ -1873,8 +1859,6 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1873 | bond_hw_addr_flush(bond_dev, slave_dev); | 1859 | bond_hw_addr_flush(bond_dev, slave_dev); |
1874 | } | 1860 | } |
1875 | 1861 | ||
1876 | bond_upper_dev_unlink(bond_dev, slave_dev); | ||
1877 | |||
1878 | slave_disable_netpoll(slave); | 1862 | slave_disable_netpoll(slave); |
1879 | 1863 | ||
1880 | /* close slave before restoring its mac address */ | 1864 | /* close slave before restoring its mac address */ |
@@ -1913,7 +1897,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, | |||
1913 | int ret; | 1897 | int ret; |
1914 | 1898 | ||
1915 | ret = bond_release(bond_dev, slave_dev); | 1899 | ret = bond_release(bond_dev, slave_dev); |
1916 | if (ret == 0 && list_empty(&bond->slave_list)) { | 1900 | if (ret == 0 && !bond_has_slaves(bond)) { |
1917 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; | 1901 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; |
1918 | pr_info("%s: destroying bond %s.\n", | 1902 | pr_info("%s: destroying bond %s.\n", |
1919 | bond_dev->name, bond_dev->name); | 1903 | bond_dev->name, bond_dev->name); |
@@ -1994,11 +1978,12 @@ static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) | |||
1994 | static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info) | 1978 | static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info) |
1995 | { | 1979 | { |
1996 | struct bonding *bond = netdev_priv(bond_dev); | 1980 | struct bonding *bond = netdev_priv(bond_dev); |
1981 | struct list_head *iter; | ||
1997 | int i = 0, res = -ENODEV; | 1982 | int i = 0, res = -ENODEV; |
1998 | struct slave *slave; | 1983 | struct slave *slave; |
1999 | 1984 | ||
2000 | read_lock(&bond->lock); | 1985 | read_lock(&bond->lock); |
2001 | bond_for_each_slave(bond, slave) { | 1986 | bond_for_each_slave(bond, slave, iter) { |
2002 | if (i++ == (int)info->slave_id) { | 1987 | if (i++ == (int)info->slave_id) { |
2003 | res = 0; | 1988 | res = 0; |
2004 | strcpy(info->slave_name, slave->dev->name); | 1989 | strcpy(info->slave_name, slave->dev->name); |
@@ -2019,12 +2004,13 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in | |||
2019 | static int bond_miimon_inspect(struct bonding *bond) | 2004 | static int bond_miimon_inspect(struct bonding *bond) |
2020 | { | 2005 | { |
2021 | int link_state, commit = 0; | 2006 | int link_state, commit = 0; |
2007 | struct list_head *iter; | ||
2022 | struct slave *slave; | 2008 | struct slave *slave; |
2023 | bool ignore_updelay; | 2009 | bool ignore_updelay; |
2024 | 2010 | ||
2025 | ignore_updelay = !bond->curr_active_slave ? true : false; | 2011 | ignore_updelay = !bond->curr_active_slave ? true : false; |
2026 | 2012 | ||
2027 | bond_for_each_slave(bond, slave) { | 2013 | bond_for_each_slave(bond, slave, iter) { |
2028 | slave->new_link = BOND_LINK_NOCHANGE; | 2014 | slave->new_link = BOND_LINK_NOCHANGE; |
2029 | 2015 | ||
2030 | link_state = bond_check_dev_link(bond, slave->dev, 0); | 2016 | link_state = bond_check_dev_link(bond, slave->dev, 0); |
@@ -2118,9 +2104,10 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2118 | 2104 | ||
2119 | static void bond_miimon_commit(struct bonding *bond) | 2105 | static void bond_miimon_commit(struct bonding *bond) |
2120 | { | 2106 | { |
2107 | struct list_head *iter; | ||
2121 | struct slave *slave; | 2108 | struct slave *slave; |
2122 | 2109 | ||
2123 | bond_for_each_slave(bond, slave) { | 2110 | bond_for_each_slave(bond, slave, iter) { |
2124 | switch (slave->new_link) { | 2111 | switch (slave->new_link) { |
2125 | case BOND_LINK_NOCHANGE: | 2112 | case BOND_LINK_NOCHANGE: |
2126 | continue; | 2113 | continue; |
@@ -2225,7 +2212,7 @@ void bond_mii_monitor(struct work_struct *work) | |||
2225 | 2212 | ||
2226 | delay = msecs_to_jiffies(bond->params.miimon); | 2213 | delay = msecs_to_jiffies(bond->params.miimon); |
2227 | 2214 | ||
2228 | if (list_empty(&bond->slave_list)) | 2215 | if (!bond_has_slaves(bond)) |
2229 | goto re_arm; | 2216 | goto re_arm; |
2230 | 2217 | ||
2231 | should_notify_peers = bond_should_notify_peers(bond); | 2218 | should_notify_peers = bond_should_notify_peers(bond); |
@@ -2274,7 +2261,7 @@ static bool bond_has_this_ip(struct bonding *bond, __be32 ip) | |||
2274 | return true; | 2261 | return true; |
2275 | 2262 | ||
2276 | rcu_read_lock(); | 2263 | rcu_read_lock(); |
2277 | netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) { | 2264 | netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) { |
2278 | if (ip == bond_confirm_addr(upper, 0, ip)) { | 2265 | if (ip == bond_confirm_addr(upper, 0, ip)) { |
2279 | ret = true; | 2266 | ret = true; |
2280 | break; | 2267 | break; |
@@ -2349,10 +2336,12 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2349 | * | 2336 | * |
2350 | * TODO: QinQ? | 2337 | * TODO: QinQ? |
2351 | */ | 2338 | */ |
2352 | netdev_for_each_upper_dev_rcu(bond->dev, vlan_upper, vlan_iter) { | 2339 | netdev_for_each_all_upper_dev_rcu(bond->dev, vlan_upper, |
2340 | vlan_iter) { | ||
2353 | if (!is_vlan_dev(vlan_upper)) | 2341 | if (!is_vlan_dev(vlan_upper)) |
2354 | continue; | 2342 | continue; |
2355 | netdev_for_each_upper_dev_rcu(vlan_upper, upper, iter) { | 2343 | netdev_for_each_all_upper_dev_rcu(vlan_upper, upper, |
2344 | iter) { | ||
2356 | if (upper == rt->dst.dev) { | 2345 | if (upper == rt->dst.dev) { |
2357 | vlan_id = vlan_dev_vlan_id(vlan_upper); | 2346 | vlan_id = vlan_dev_vlan_id(vlan_upper); |
2358 | rcu_read_unlock(); | 2347 | rcu_read_unlock(); |
@@ -2365,7 +2354,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2365 | * our upper vlans, then just search for any dev that | 2354 | * our upper vlans, then just search for any dev that |
2366 | * matches, and in case it's a vlan - save the id | 2355 | * matches, and in case it's a vlan - save the id |
2367 | */ | 2356 | */ |
2368 | netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) { | 2357 | netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) { |
2369 | if (upper == rt->dst.dev) { | 2358 | if (upper == rt->dst.dev) { |
2370 | /* if it's a vlan - get its VID */ | 2359 | /* if it's a vlan - get its VID */ |
2371 | if (is_vlan_dev(upper)) | 2360 | if (is_vlan_dev(upper)) |
@@ -2512,11 +2501,12 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2512 | struct bonding *bond = container_of(work, struct bonding, | 2501 | struct bonding *bond = container_of(work, struct bonding, |
2513 | arp_work.work); | 2502 | arp_work.work); |
2514 | struct slave *slave, *oldcurrent; | 2503 | struct slave *slave, *oldcurrent; |
2504 | struct list_head *iter; | ||
2515 | int do_failover = 0; | 2505 | int do_failover = 0; |
2516 | 2506 | ||
2517 | read_lock(&bond->lock); | 2507 | read_lock(&bond->lock); |
2518 | 2508 | ||
2519 | if (list_empty(&bond->slave_list)) | 2509 | if (!bond_has_slaves(bond)) |
2520 | goto re_arm; | 2510 | goto re_arm; |
2521 | 2511 | ||
2522 | oldcurrent = bond->curr_active_slave; | 2512 | oldcurrent = bond->curr_active_slave; |
@@ -2528,7 +2518,7 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2528 | * TODO: what about up/down delay in arp mode? it wasn't here before | 2518 | * TODO: what about up/down delay in arp mode? it wasn't here before |
2529 | * so it can wait | 2519 | * so it can wait |
2530 | */ | 2520 | */ |
2531 | bond_for_each_slave(bond, slave) { | 2521 | bond_for_each_slave(bond, slave, iter) { |
2532 | unsigned long trans_start = dev_trans_start(slave->dev); | 2522 | unsigned long trans_start = dev_trans_start(slave->dev); |
2533 | 2523 | ||
2534 | if (slave->link != BOND_LINK_UP) { | 2524 | if (slave->link != BOND_LINK_UP) { |
@@ -2619,10 +2609,11 @@ re_arm: | |||
2619 | static int bond_ab_arp_inspect(struct bonding *bond) | 2609 | static int bond_ab_arp_inspect(struct bonding *bond) |
2620 | { | 2610 | { |
2621 | unsigned long trans_start, last_rx; | 2611 | unsigned long trans_start, last_rx; |
2612 | struct list_head *iter; | ||
2622 | struct slave *slave; | 2613 | struct slave *slave; |
2623 | int commit = 0; | 2614 | int commit = 0; |
2624 | 2615 | ||
2625 | bond_for_each_slave(bond, slave) { | 2616 | bond_for_each_slave(bond, slave, iter) { |
2626 | slave->new_link = BOND_LINK_NOCHANGE; | 2617 | slave->new_link = BOND_LINK_NOCHANGE; |
2627 | last_rx = slave_last_rx(bond, slave); | 2618 | last_rx = slave_last_rx(bond, slave); |
2628 | 2619 | ||
@@ -2689,9 +2680,10 @@ static int bond_ab_arp_inspect(struct bonding *bond) | |||
2689 | static void bond_ab_arp_commit(struct bonding *bond) | 2680 | static void bond_ab_arp_commit(struct bonding *bond) |
2690 | { | 2681 | { |
2691 | unsigned long trans_start; | 2682 | unsigned long trans_start; |
2683 | struct list_head *iter; | ||
2692 | struct slave *slave; | 2684 | struct slave *slave; |
2693 | 2685 | ||
2694 | bond_for_each_slave(bond, slave) { | 2686 | bond_for_each_slave(bond, slave, iter) { |
2695 | switch (slave->new_link) { | 2687 | switch (slave->new_link) { |
2696 | case BOND_LINK_NOCHANGE: | 2688 | case BOND_LINK_NOCHANGE: |
2697 | continue; | 2689 | continue; |
@@ -2762,8 +2754,9 @@ do_failover: | |||
2762 | */ | 2754 | */ |
2763 | static void bond_ab_arp_probe(struct bonding *bond) | 2755 | static void bond_ab_arp_probe(struct bonding *bond) |
2764 | { | 2756 | { |
2765 | struct slave *slave, *next_slave; | 2757 | struct slave *slave, *before = NULL, *new_slave = NULL; |
2766 | int i; | 2758 | struct list_head *iter; |
2759 | bool found = false; | ||
2767 | 2760 | ||
2768 | read_lock(&bond->curr_slave_lock); | 2761 | read_lock(&bond->curr_slave_lock); |
2769 | 2762 | ||
@@ -2793,18 +2786,12 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
2793 | 2786 | ||
2794 | bond_set_slave_inactive_flags(bond->current_arp_slave); | 2787 | bond_set_slave_inactive_flags(bond->current_arp_slave); |
2795 | 2788 | ||
2796 | /* search for next candidate */ | 2789 | bond_for_each_slave(bond, slave, iter) { |
2797 | next_slave = bond_next_slave(bond, bond->current_arp_slave); | 2790 | if (!found && !before && IS_UP(slave->dev)) |
2798 | bond_for_each_slave_from(bond, slave, i, next_slave) { | 2791 | before = slave; |
2799 | if (IS_UP(slave->dev)) { | ||
2800 | slave->link = BOND_LINK_BACK; | ||
2801 | bond_set_slave_active_flags(slave); | ||
2802 | bond_arp_send_all(bond, slave); | ||
2803 | slave->jiffies = jiffies; | ||
2804 | bond->current_arp_slave = slave; | ||
2805 | break; | ||
2806 | } | ||
2807 | 2792 | ||
2793 | if (found && !new_slave && IS_UP(slave->dev)) | ||
2794 | new_slave = slave; | ||
2808 | /* if the link state is up at this point, we | 2795 | /* if the link state is up at this point, we |
2809 | * mark it down - this can happen if we have | 2796 | * mark it down - this can happen if we have |
2810 | * simultaneous link failures and | 2797 | * simultaneous link failures and |
@@ -2812,7 +2799,7 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
2812 | * one the current slave so it is still marked | 2799 | * one the current slave so it is still marked |
2813 | * up when it is actually down | 2800 | * up when it is actually down |
2814 | */ | 2801 | */ |
2815 | if (slave->link == BOND_LINK_UP) { | 2802 | if (!IS_UP(slave->dev) && slave->link == BOND_LINK_UP) { |
2816 | slave->link = BOND_LINK_DOWN; | 2803 | slave->link = BOND_LINK_DOWN; |
2817 | if (slave->link_failure_count < UINT_MAX) | 2804 | if (slave->link_failure_count < UINT_MAX) |
2818 | slave->link_failure_count++; | 2805 | slave->link_failure_count++; |
@@ -2822,7 +2809,22 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
2822 | pr_info("%s: backup interface %s is now down.\n", | 2809 | pr_info("%s: backup interface %s is now down.\n", |
2823 | bond->dev->name, slave->dev->name); | 2810 | bond->dev->name, slave->dev->name); |
2824 | } | 2811 | } |
2812 | if (slave == bond->current_arp_slave) | ||
2813 | found = true; | ||
2825 | } | 2814 | } |
2815 | |||
2816 | if (!new_slave && before) | ||
2817 | new_slave = before; | ||
2818 | |||
2819 | if (!new_slave) | ||
2820 | return; | ||
2821 | |||
2822 | new_slave->link = BOND_LINK_BACK; | ||
2823 | bond_set_slave_active_flags(new_slave); | ||
2824 | bond_arp_send_all(bond, new_slave); | ||
2825 | new_slave->jiffies = jiffies; | ||
2826 | bond->current_arp_slave = new_slave; | ||
2827 | |||
2826 | } | 2828 | } |
2827 | 2829 | ||
2828 | void bond_activebackup_arp_mon(struct work_struct *work) | 2830 | void bond_activebackup_arp_mon(struct work_struct *work) |
@@ -2836,7 +2838,7 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2836 | 2838 | ||
2837 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); | 2839 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); |
2838 | 2840 | ||
2839 | if (list_empty(&bond->slave_list)) | 2841 | if (!bond_has_slaves(bond)) |
2840 | goto re_arm; | 2842 | goto re_arm; |
2841 | 2843 | ||
2842 | should_notify_peers = bond_should_notify_peers(bond); | 2844 | should_notify_peers = bond_should_notify_peers(bond); |
@@ -3155,13 +3157,14 @@ static void bond_work_cancel_all(struct bonding *bond) | |||
3155 | static int bond_open(struct net_device *bond_dev) | 3157 | static int bond_open(struct net_device *bond_dev) |
3156 | { | 3158 | { |
3157 | struct bonding *bond = netdev_priv(bond_dev); | 3159 | struct bonding *bond = netdev_priv(bond_dev); |
3160 | struct list_head *iter; | ||
3158 | struct slave *slave; | 3161 | struct slave *slave; |
3159 | 3162 | ||
3160 | /* reset slave->backup and slave->inactive */ | 3163 | /* reset slave->backup and slave->inactive */ |
3161 | read_lock(&bond->lock); | 3164 | read_lock(&bond->lock); |
3162 | if (!list_empty(&bond->slave_list)) { | 3165 | if (bond_has_slaves(bond)) { |
3163 | read_lock(&bond->curr_slave_lock); | 3166 | read_lock(&bond->curr_slave_lock); |
3164 | bond_for_each_slave(bond, slave) { | 3167 | bond_for_each_slave(bond, slave, iter) { |
3165 | if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) | 3168 | if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) |
3166 | && (slave != bond->curr_active_slave)) { | 3169 | && (slave != bond->curr_active_slave)) { |
3167 | bond_set_slave_inactive_flags(slave); | 3170 | bond_set_slave_inactive_flags(slave); |
@@ -3221,12 +3224,13 @@ static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, | |||
3221 | { | 3224 | { |
3222 | struct bonding *bond = netdev_priv(bond_dev); | 3225 | struct bonding *bond = netdev_priv(bond_dev); |
3223 | struct rtnl_link_stats64 temp; | 3226 | struct rtnl_link_stats64 temp; |
3227 | struct list_head *iter; | ||
3224 | struct slave *slave; | 3228 | struct slave *slave; |
3225 | 3229 | ||
3226 | memset(stats, 0, sizeof(*stats)); | 3230 | memset(stats, 0, sizeof(*stats)); |
3227 | 3231 | ||
3228 | read_lock_bh(&bond->lock); | 3232 | read_lock_bh(&bond->lock); |
3229 | bond_for_each_slave(bond, slave) { | 3233 | bond_for_each_slave(bond, slave, iter) { |
3230 | const struct rtnl_link_stats64 *sstats = | 3234 | const struct rtnl_link_stats64 *sstats = |
3231 | dev_get_stats(slave->dev, &temp); | 3235 | dev_get_stats(slave->dev, &temp); |
3232 | 3236 | ||
@@ -3393,22 +3397,24 @@ static void bond_change_rx_flags(struct net_device *bond_dev, int change) | |||
3393 | static void bond_set_rx_mode(struct net_device *bond_dev) | 3397 | static void bond_set_rx_mode(struct net_device *bond_dev) |
3394 | { | 3398 | { |
3395 | struct bonding *bond = netdev_priv(bond_dev); | 3399 | struct bonding *bond = netdev_priv(bond_dev); |
3400 | struct list_head *iter; | ||
3396 | struct slave *slave; | 3401 | struct slave *slave; |
3397 | 3402 | ||
3398 | ASSERT_RTNL(); | ||
3399 | 3403 | ||
3404 | rcu_read_lock(); | ||
3400 | if (USES_PRIMARY(bond->params.mode)) { | 3405 | if (USES_PRIMARY(bond->params.mode)) { |
3401 | slave = rtnl_dereference(bond->curr_active_slave); | 3406 | slave = rcu_dereference(bond->curr_active_slave); |
3402 | if (slave) { | 3407 | if (slave) { |
3403 | dev_uc_sync(slave->dev, bond_dev); | 3408 | dev_uc_sync(slave->dev, bond_dev); |
3404 | dev_mc_sync(slave->dev, bond_dev); | 3409 | dev_mc_sync(slave->dev, bond_dev); |
3405 | } | 3410 | } |
3406 | } else { | 3411 | } else { |
3407 | bond_for_each_slave(bond, slave) { | 3412 | bond_for_each_slave_rcu(bond, slave, iter) { |
3408 | dev_uc_sync_multiple(slave->dev, bond_dev); | 3413 | dev_uc_sync_multiple(slave->dev, bond_dev); |
3409 | dev_mc_sync_multiple(slave->dev, bond_dev); | 3414 | dev_mc_sync_multiple(slave->dev, bond_dev); |
3410 | } | 3415 | } |
3411 | } | 3416 | } |
3417 | rcu_read_unlock(); | ||
3412 | } | 3418 | } |
3413 | 3419 | ||
3414 | static int bond_neigh_init(struct neighbour *n) | 3420 | static int bond_neigh_init(struct neighbour *n) |
@@ -3471,7 +3477,8 @@ static int bond_neigh_setup(struct net_device *dev, | |||
3471 | static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | 3477 | static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) |
3472 | { | 3478 | { |
3473 | struct bonding *bond = netdev_priv(bond_dev); | 3479 | struct bonding *bond = netdev_priv(bond_dev); |
3474 | struct slave *slave; | 3480 | struct slave *slave, *rollback_slave; |
3481 | struct list_head *iter; | ||
3475 | int res = 0; | 3482 | int res = 0; |
3476 | 3483 | ||
3477 | pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond, | 3484 | pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond, |
@@ -3492,10 +3499,9 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | |||
3492 | * call to the base driver. | 3499 | * call to the base driver. |
3493 | */ | 3500 | */ |
3494 | 3501 | ||
3495 | bond_for_each_slave(bond, slave) { | 3502 | bond_for_each_slave(bond, slave, iter) { |
3496 | pr_debug("s %p s->p %p c_m %p\n", | 3503 | pr_debug("s %p c_m %p\n", |
3497 | slave, | 3504 | slave, |
3498 | bond_prev_slave(bond, slave), | ||
3499 | slave->dev->netdev_ops->ndo_change_mtu); | 3505 | slave->dev->netdev_ops->ndo_change_mtu); |
3500 | 3506 | ||
3501 | res = dev_set_mtu(slave->dev, new_mtu); | 3507 | res = dev_set_mtu(slave->dev, new_mtu); |
@@ -3520,13 +3526,16 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | |||
3520 | 3526 | ||
3521 | unwind: | 3527 | unwind: |
3522 | /* unwind from head to the slave that failed */ | 3528 | /* unwind from head to the slave that failed */ |
3523 | bond_for_each_slave_continue_reverse(bond, slave) { | 3529 | bond_for_each_slave(bond, rollback_slave, iter) { |
3524 | int tmp_res; | 3530 | int tmp_res; |
3525 | 3531 | ||
3526 | tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu); | 3532 | if (rollback_slave == slave) |
3533 | break; | ||
3534 | |||
3535 | tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu); | ||
3527 | if (tmp_res) { | 3536 | if (tmp_res) { |
3528 | pr_debug("unwind err %d dev %s\n", | 3537 | pr_debug("unwind err %d dev %s\n", |
3529 | tmp_res, slave->dev->name); | 3538 | tmp_res, rollback_slave->dev->name); |
3530 | } | 3539 | } |
3531 | } | 3540 | } |
3532 | 3541 | ||
@@ -3543,8 +3552,9 @@ unwind: | |||
3543 | static int bond_set_mac_address(struct net_device *bond_dev, void *addr) | 3552 | static int bond_set_mac_address(struct net_device *bond_dev, void *addr) |
3544 | { | 3553 | { |
3545 | struct bonding *bond = netdev_priv(bond_dev); | 3554 | struct bonding *bond = netdev_priv(bond_dev); |
3555 | struct slave *slave, *rollback_slave; | ||
3546 | struct sockaddr *sa = addr, tmp_sa; | 3556 | struct sockaddr *sa = addr, tmp_sa; |
3547 | struct slave *slave; | 3557 | struct list_head *iter; |
3548 | int res = 0; | 3558 | int res = 0; |
3549 | 3559 | ||
3550 | if (bond->params.mode == BOND_MODE_ALB) | 3560 | if (bond->params.mode == BOND_MODE_ALB) |
@@ -3578,7 +3588,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) | |||
3578 | * call to the base driver. | 3588 | * call to the base driver. |
3579 | */ | 3589 | */ |
3580 | 3590 | ||
3581 | bond_for_each_slave(bond, slave) { | 3591 | bond_for_each_slave(bond, slave, iter) { |
3582 | const struct net_device_ops *slave_ops = slave->dev->netdev_ops; | 3592 | const struct net_device_ops *slave_ops = slave->dev->netdev_ops; |
3583 | pr_debug("slave %p %s\n", slave, slave->dev->name); | 3593 | pr_debug("slave %p %s\n", slave, slave->dev->name); |
3584 | 3594 | ||
@@ -3610,13 +3620,16 @@ unwind: | |||
3610 | tmp_sa.sa_family = bond_dev->type; | 3620 | tmp_sa.sa_family = bond_dev->type; |
3611 | 3621 | ||
3612 | /* unwind from head to the slave that failed */ | 3622 | /* unwind from head to the slave that failed */ |
3613 | bond_for_each_slave_continue_reverse(bond, slave) { | 3623 | bond_for_each_slave(bond, rollback_slave, iter) { |
3614 | int tmp_res; | 3624 | int tmp_res; |
3615 | 3625 | ||
3616 | tmp_res = dev_set_mac_address(slave->dev, &tmp_sa); | 3626 | if (rollback_slave == slave) |
3627 | break; | ||
3628 | |||
3629 | tmp_res = dev_set_mac_address(rollback_slave->dev, &tmp_sa); | ||
3617 | if (tmp_res) { | 3630 | if (tmp_res) { |
3618 | pr_debug("unwind err %d dev %s\n", | 3631 | pr_debug("unwind err %d dev %s\n", |
3619 | tmp_res, slave->dev->name); | 3632 | tmp_res, rollback_slave->dev->name); |
3620 | } | 3633 | } |
3621 | } | 3634 | } |
3622 | 3635 | ||
@@ -3635,11 +3648,12 @@ unwind: | |||
3635 | */ | 3648 | */ |
3636 | void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id) | 3649 | void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id) |
3637 | { | 3650 | { |
3651 | struct list_head *iter; | ||
3638 | struct slave *slave; | 3652 | struct slave *slave; |
3639 | int i = slave_id; | 3653 | int i = slave_id; |
3640 | 3654 | ||
3641 | /* Here we start from the slave with slave_id */ | 3655 | /* Here we start from the slave with slave_id */ |
3642 | bond_for_each_slave_rcu(bond, slave) { | 3656 | bond_for_each_slave_rcu(bond, slave, iter) { |
3643 | if (--i < 0) { | 3657 | if (--i < 0) { |
3644 | if (slave_can_tx(slave)) { | 3658 | if (slave_can_tx(slave)) { |
3645 | bond_dev_queue_xmit(bond, skb, slave->dev); | 3659 | bond_dev_queue_xmit(bond, skb, slave->dev); |
@@ -3650,7 +3664,7 @@ void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id) | |||
3650 | 3664 | ||
3651 | /* Here we start from the first slave up to slave_id */ | 3665 | /* Here we start from the first slave up to slave_id */ |
3652 | i = slave_id; | 3666 | i = slave_id; |
3653 | bond_for_each_slave_rcu(bond, slave) { | 3667 | bond_for_each_slave_rcu(bond, slave, iter) { |
3654 | if (--i < 0) | 3668 | if (--i < 0) |
3655 | break; | 3669 | break; |
3656 | if (slave_can_tx(slave)) { | 3670 | if (slave_can_tx(slave)) { |
@@ -3727,8 +3741,9 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
3727 | { | 3741 | { |
3728 | struct bonding *bond = netdev_priv(bond_dev); | 3742 | struct bonding *bond = netdev_priv(bond_dev); |
3729 | struct slave *slave = NULL; | 3743 | struct slave *slave = NULL; |
3744 | struct list_head *iter; | ||
3730 | 3745 | ||
3731 | bond_for_each_slave_rcu(bond, slave) { | 3746 | bond_for_each_slave_rcu(bond, slave, iter) { |
3732 | if (bond_is_last_slave(bond, slave)) | 3747 | if (bond_is_last_slave(bond, slave)) |
3733 | break; | 3748 | break; |
3734 | if (IS_UP(slave->dev) && slave->link == BOND_LINK_UP) { | 3749 | if (IS_UP(slave->dev) && slave->link == BOND_LINK_UP) { |
@@ -3777,13 +3792,14 @@ static inline int bond_slave_override(struct bonding *bond, | |||
3777 | { | 3792 | { |
3778 | struct slave *slave = NULL; | 3793 | struct slave *slave = NULL; |
3779 | struct slave *check_slave; | 3794 | struct slave *check_slave; |
3795 | struct list_head *iter; | ||
3780 | int res = 1; | 3796 | int res = 1; |
3781 | 3797 | ||
3782 | if (!skb->queue_mapping) | 3798 | if (!skb->queue_mapping) |
3783 | return 1; | 3799 | return 1; |
3784 | 3800 | ||
3785 | /* Find out if any slaves have the same mapping as this skb. */ | 3801 | /* Find out if any slaves have the same mapping as this skb. */ |
3786 | bond_for_each_slave_rcu(bond, check_slave) { | 3802 | bond_for_each_slave_rcu(bond, check_slave, iter) { |
3787 | if (check_slave->queue_id == skb->queue_mapping) { | 3803 | if (check_slave->queue_id == skb->queue_mapping) { |
3788 | slave = check_slave; | 3804 | slave = check_slave; |
3789 | break; | 3805 | break; |
@@ -3869,7 +3885,7 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3869 | return NETDEV_TX_BUSY; | 3885 | return NETDEV_TX_BUSY; |
3870 | 3886 | ||
3871 | rcu_read_lock(); | 3887 | rcu_read_lock(); |
3872 | if (!list_empty(&bond->slave_list)) | 3888 | if (bond_has_slaves(bond)) |
3873 | ret = __bond_start_xmit(skb, dev); | 3889 | ret = __bond_start_xmit(skb, dev); |
3874 | else | 3890 | else |
3875 | kfree_skb(skb); | 3891 | kfree_skb(skb); |
@@ -3915,6 +3931,7 @@ static int bond_ethtool_get_settings(struct net_device *bond_dev, | |||
3915 | { | 3931 | { |
3916 | struct bonding *bond = netdev_priv(bond_dev); | 3932 | struct bonding *bond = netdev_priv(bond_dev); |
3917 | unsigned long speed = 0; | 3933 | unsigned long speed = 0; |
3934 | struct list_head *iter; | ||
3918 | struct slave *slave; | 3935 | struct slave *slave; |
3919 | 3936 | ||
3920 | ecmd->duplex = DUPLEX_UNKNOWN; | 3937 | ecmd->duplex = DUPLEX_UNKNOWN; |
@@ -3926,7 +3943,7 @@ static int bond_ethtool_get_settings(struct net_device *bond_dev, | |||
3926 | * this is an accurate maximum. | 3943 | * this is an accurate maximum. |
3927 | */ | 3944 | */ |
3928 | read_lock(&bond->lock); | 3945 | read_lock(&bond->lock); |
3929 | bond_for_each_slave(bond, slave) { | 3946 | bond_for_each_slave(bond, slave, iter) { |
3930 | if (SLAVE_IS_OK(slave)) { | 3947 | if (SLAVE_IS_OK(slave)) { |
3931 | if (slave->speed != SPEED_UNKNOWN) | 3948 | if (slave->speed != SPEED_UNKNOWN) |
3932 | speed += slave->speed; | 3949 | speed += slave->speed; |
@@ -4001,7 +4018,6 @@ static void bond_setup(struct net_device *bond_dev) | |||
4001 | /* initialize rwlocks */ | 4018 | /* initialize rwlocks */ |
4002 | rwlock_init(&bond->lock); | 4019 | rwlock_init(&bond->lock); |
4003 | rwlock_init(&bond->curr_slave_lock); | 4020 | rwlock_init(&bond->curr_slave_lock); |
4004 | INIT_LIST_HEAD(&bond->slave_list); | ||
4005 | bond->params = bonding_defaults; | 4021 | bond->params = bonding_defaults; |
4006 | 4022 | ||
4007 | /* Initialize pointers */ | 4023 | /* Initialize pointers */ |
@@ -4057,12 +4073,13 @@ static void bond_setup(struct net_device *bond_dev) | |||
4057 | static void bond_uninit(struct net_device *bond_dev) | 4073 | static void bond_uninit(struct net_device *bond_dev) |
4058 | { | 4074 | { |
4059 | struct bonding *bond = netdev_priv(bond_dev); | 4075 | struct bonding *bond = netdev_priv(bond_dev); |
4060 | struct slave *slave, *tmp_slave; | 4076 | struct list_head *iter; |
4077 | struct slave *slave; | ||
4061 | 4078 | ||
4062 | bond_netpoll_cleanup(bond_dev); | 4079 | bond_netpoll_cleanup(bond_dev); |
4063 | 4080 | ||
4064 | /* Release the bonded slaves */ | 4081 | /* Release the bonded slaves */ |
4065 | list_for_each_entry_safe(slave, tmp_slave, &bond->slave_list, list) | 4082 | bond_for_each_slave(bond, slave, iter) |
4066 | __bond_release_one(bond_dev, slave->dev, true); | 4083 | __bond_release_one(bond_dev, slave->dev, true); |
4067 | pr_info("%s: released all slaves\n", bond_dev->name); | 4084 | pr_info("%s: released all slaves\n", bond_dev->name); |
4068 | 4085 | ||
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 20a6ee25bb63..fb868d6c22da 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -10,8 +10,9 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | |||
10 | __acquires(&bond->lock) | 10 | __acquires(&bond->lock) |
11 | { | 11 | { |
12 | struct bonding *bond = seq->private; | 12 | struct bonding *bond = seq->private; |
13 | loff_t off = 0; | 13 | struct list_head *iter; |
14 | struct slave *slave; | 14 | struct slave *slave; |
15 | loff_t off = 0; | ||
15 | 16 | ||
16 | /* make sure the bond won't be taken away */ | 17 | /* make sure the bond won't be taken away */ |
17 | rcu_read_lock(); | 18 | rcu_read_lock(); |
@@ -20,7 +21,7 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | |||
20 | if (*pos == 0) | 21 | if (*pos == 0) |
21 | return SEQ_START_TOKEN; | 22 | return SEQ_START_TOKEN; |
22 | 23 | ||
23 | bond_for_each_slave(bond, slave) | 24 | bond_for_each_slave(bond, slave, iter) |
24 | if (++off == *pos) | 25 | if (++off == *pos) |
25 | return slave; | 26 | return slave; |
26 | 27 | ||
@@ -30,17 +31,25 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | |||
30 | static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 31 | static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
31 | { | 32 | { |
32 | struct bonding *bond = seq->private; | 33 | struct bonding *bond = seq->private; |
33 | struct slave *slave = v; | 34 | struct list_head *iter; |
35 | struct slave *slave; | ||
36 | bool found = false; | ||
34 | 37 | ||
35 | ++*pos; | 38 | ++*pos; |
36 | if (v == SEQ_START_TOKEN) | 39 | if (v == SEQ_START_TOKEN) |
37 | return bond_first_slave(bond); | 40 | return bond_first_slave(bond); |
38 | 41 | ||
39 | if (bond_is_last_slave(bond, slave)) | 42 | if (bond_is_last_slave(bond, v)) |
40 | return NULL; | 43 | return NULL; |
41 | slave = bond_next_slave(bond, slave); | ||
42 | 44 | ||
43 | return slave; | 45 | bond_for_each_slave(bond, slave, iter) { |
46 | if (found) | ||
47 | return slave; | ||
48 | if (slave == v) | ||
49 | found = true; | ||
50 | } | ||
51 | |||
52 | return NULL; | ||
44 | } | 53 | } |
45 | 54 | ||
46 | static void bond_info_seq_stop(struct seq_file *seq, void *v) | 55 | static void bond_info_seq_stop(struct seq_file *seq, void *v) |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index c29b836749b6..e06c644470b1 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -168,41 +168,6 @@ static const struct class_attribute class_attr_bonding_masters = { | |||
168 | .namespace = bonding_namespace, | 168 | .namespace = bonding_namespace, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | int bond_create_slave_symlinks(struct net_device *master, | ||
172 | struct net_device *slave) | ||
173 | { | ||
174 | char linkname[IFNAMSIZ+7]; | ||
175 | int ret = 0; | ||
176 | |||
177 | /* first, create a link from the slave back to the master */ | ||
178 | ret = sysfs_create_link(&(slave->dev.kobj), &(master->dev.kobj), | ||
179 | "master"); | ||
180 | if (ret) | ||
181 | return ret; | ||
182 | /* next, create a link from the master to the slave */ | ||
183 | sprintf(linkname, "slave_%s", slave->name); | ||
184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), | ||
185 | linkname); | ||
186 | |||
187 | /* free the master link created earlier in case of error */ | ||
188 | if (ret) | ||
189 | sysfs_remove_link(&(slave->dev.kobj), "master"); | ||
190 | |||
191 | return ret; | ||
192 | |||
193 | } | ||
194 | |||
195 | void bond_destroy_slave_symlinks(struct net_device *master, | ||
196 | struct net_device *slave) | ||
197 | { | ||
198 | char linkname[IFNAMSIZ+7]; | ||
199 | |||
200 | sysfs_remove_link(&(slave->dev.kobj), "master"); | ||
201 | sprintf(linkname, "slave_%s", slave->name); | ||
202 | sysfs_remove_link(&(master->dev.kobj), linkname); | ||
203 | } | ||
204 | |||
205 | |||
206 | /* | 171 | /* |
207 | * Show the slaves in the current bond. | 172 | * Show the slaves in the current bond. |
208 | */ | 173 | */ |
@@ -210,11 +175,12 @@ static ssize_t bonding_show_slaves(struct device *d, | |||
210 | struct device_attribute *attr, char *buf) | 175 | struct device_attribute *attr, char *buf) |
211 | { | 176 | { |
212 | struct bonding *bond = to_bond(d); | 177 | struct bonding *bond = to_bond(d); |
178 | struct list_head *iter; | ||
213 | struct slave *slave; | 179 | struct slave *slave; |
214 | int res = 0; | 180 | int res = 0; |
215 | 181 | ||
216 | read_lock(&bond->lock); | 182 | read_lock(&bond->lock); |
217 | bond_for_each_slave(bond, slave) { | 183 | bond_for_each_slave(bond, slave, iter) { |
218 | if (res > (PAGE_SIZE - IFNAMSIZ)) { | 184 | if (res > (PAGE_SIZE - IFNAMSIZ)) { |
219 | /* not enough space for another interface name */ | 185 | /* not enough space for another interface name */ |
220 | if ((PAGE_SIZE - res) > 10) | 186 | if ((PAGE_SIZE - res) > 10) |
@@ -326,7 +292,7 @@ static ssize_t bonding_store_mode(struct device *d, | |||
326 | goto out; | 292 | goto out; |
327 | } | 293 | } |
328 | 294 | ||
329 | if (!list_empty(&bond->slave_list)) { | 295 | if (bond_has_slaves(bond)) { |
330 | pr_err("unable to update mode of %s because it has slaves.\n", | 296 | pr_err("unable to update mode of %s because it has slaves.\n", |
331 | bond->dev->name); | 297 | bond->dev->name); |
332 | ret = -EPERM; | 298 | ret = -EPERM; |
@@ -522,7 +488,7 @@ static ssize_t bonding_store_fail_over_mac(struct device *d, | |||
522 | if (!rtnl_trylock()) | 488 | if (!rtnl_trylock()) |
523 | return restart_syscall(); | 489 | return restart_syscall(); |
524 | 490 | ||
525 | if (!list_empty(&bond->slave_list)) { | 491 | if (bond_has_slaves(bond)) { |
526 | pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n", | 492 | pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n", |
527 | bond->dev->name); | 493 | bond->dev->name); |
528 | ret = -EPERM; | 494 | ret = -EPERM; |
@@ -656,6 +622,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
656 | const char *buf, size_t count) | 622 | const char *buf, size_t count) |
657 | { | 623 | { |
658 | struct bonding *bond = to_bond(d); | 624 | struct bonding *bond = to_bond(d); |
625 | struct list_head *iter; | ||
659 | struct slave *slave; | 626 | struct slave *slave; |
660 | __be32 newtarget, *targets; | 627 | __be32 newtarget, *targets; |
661 | unsigned long *targets_rx; | 628 | unsigned long *targets_rx; |
@@ -688,7 +655,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
688 | &newtarget); | 655 | &newtarget); |
689 | /* not to race with bond_arp_rcv */ | 656 | /* not to race with bond_arp_rcv */ |
690 | write_lock_bh(&bond->lock); | 657 | write_lock_bh(&bond->lock); |
691 | bond_for_each_slave(bond, slave) | 658 | bond_for_each_slave(bond, slave, iter) |
692 | slave->target_last_arp_rx[ind] = jiffies; | 659 | slave->target_last_arp_rx[ind] = jiffies; |
693 | targets[ind] = newtarget; | 660 | targets[ind] = newtarget; |
694 | write_unlock_bh(&bond->lock); | 661 | write_unlock_bh(&bond->lock); |
@@ -714,7 +681,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
714 | &newtarget); | 681 | &newtarget); |
715 | 682 | ||
716 | write_lock_bh(&bond->lock); | 683 | write_lock_bh(&bond->lock); |
717 | bond_for_each_slave(bond, slave) { | 684 | bond_for_each_slave(bond, slave, iter) { |
718 | targets_rx = slave->target_last_arp_rx; | 685 | targets_rx = slave->target_last_arp_rx; |
719 | j = ind; | 686 | j = ind; |
720 | for (; (j < BOND_MAX_ARP_TARGETS-1) && targets[j+1]; j++) | 687 | for (; (j < BOND_MAX_ARP_TARGETS-1) && targets[j+1]; j++) |
@@ -1111,6 +1078,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1111 | const char *buf, size_t count) | 1078 | const char *buf, size_t count) |
1112 | { | 1079 | { |
1113 | struct bonding *bond = to_bond(d); | 1080 | struct bonding *bond = to_bond(d); |
1081 | struct list_head *iter; | ||
1114 | char ifname[IFNAMSIZ]; | 1082 | char ifname[IFNAMSIZ]; |
1115 | struct slave *slave; | 1083 | struct slave *slave; |
1116 | 1084 | ||
@@ -1138,7 +1106,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1138 | goto out; | 1106 | goto out; |
1139 | } | 1107 | } |
1140 | 1108 | ||
1141 | bond_for_each_slave(bond, slave) { | 1109 | bond_for_each_slave(bond, slave, iter) { |
1142 | if (strncmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { | 1110 | if (strncmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { |
1143 | pr_info("%s: Setting %s as primary slave.\n", | 1111 | pr_info("%s: Setting %s as primary slave.\n", |
1144 | bond->dev->name, slave->dev->name); | 1112 | bond->dev->name, slave->dev->name); |
@@ -1286,6 +1254,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1286 | { | 1254 | { |
1287 | struct slave *slave, *old_active, *new_active; | 1255 | struct slave *slave, *old_active, *new_active; |
1288 | struct bonding *bond = to_bond(d); | 1256 | struct bonding *bond = to_bond(d); |
1257 | struct list_head *iter; | ||
1289 | char ifname[IFNAMSIZ]; | 1258 | char ifname[IFNAMSIZ]; |
1290 | 1259 | ||
1291 | if (!rtnl_trylock()) | 1260 | if (!rtnl_trylock()) |
@@ -1313,7 +1282,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1313 | goto out; | 1282 | goto out; |
1314 | } | 1283 | } |
1315 | 1284 | ||
1316 | bond_for_each_slave(bond, slave) { | 1285 | bond_for_each_slave(bond, slave, iter) { |
1317 | if (strncmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { | 1286 | if (strncmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { |
1318 | old_active = bond->curr_active_slave; | 1287 | old_active = bond->curr_active_slave; |
1319 | new_active = slave; | 1288 | new_active = slave; |
@@ -1493,6 +1462,7 @@ static ssize_t bonding_show_queue_id(struct device *d, | |||
1493 | char *buf) | 1462 | char *buf) |
1494 | { | 1463 | { |
1495 | struct bonding *bond = to_bond(d); | 1464 | struct bonding *bond = to_bond(d); |
1465 | struct list_head *iter; | ||
1496 | struct slave *slave; | 1466 | struct slave *slave; |
1497 | int res = 0; | 1467 | int res = 0; |
1498 | 1468 | ||
@@ -1500,7 +1470,7 @@ static ssize_t bonding_show_queue_id(struct device *d, | |||
1500 | return restart_syscall(); | 1470 | return restart_syscall(); |
1501 | 1471 | ||
1502 | read_lock(&bond->lock); | 1472 | read_lock(&bond->lock); |
1503 | bond_for_each_slave(bond, slave) { | 1473 | bond_for_each_slave(bond, slave, iter) { |
1504 | if (res > (PAGE_SIZE - IFNAMSIZ - 6)) { | 1474 | if (res > (PAGE_SIZE - IFNAMSIZ - 6)) { |
1505 | /* not enough space for another interface_name:queue_id pair */ | 1475 | /* not enough space for another interface_name:queue_id pair */ |
1506 | if ((PAGE_SIZE - res) > 10) | 1476 | if ((PAGE_SIZE - res) > 10) |
@@ -1529,6 +1499,7 @@ static ssize_t bonding_store_queue_id(struct device *d, | |||
1529 | { | 1499 | { |
1530 | struct slave *slave, *update_slave; | 1500 | struct slave *slave, *update_slave; |
1531 | struct bonding *bond = to_bond(d); | 1501 | struct bonding *bond = to_bond(d); |
1502 | struct list_head *iter; | ||
1532 | u16 qid; | 1503 | u16 qid; |
1533 | int ret = count; | 1504 | int ret = count; |
1534 | char *delim; | 1505 | char *delim; |
@@ -1565,7 +1536,7 @@ static ssize_t bonding_store_queue_id(struct device *d, | |||
1565 | 1536 | ||
1566 | /* Search for thes slave and check for duplicate qids */ | 1537 | /* Search for thes slave and check for duplicate qids */ |
1567 | update_slave = NULL; | 1538 | update_slave = NULL; |
1568 | bond_for_each_slave(bond, slave) { | 1539 | bond_for_each_slave(bond, slave, iter) { |
1569 | if (sdev == slave->dev) | 1540 | if (sdev == slave->dev) |
1570 | /* | 1541 | /* |
1571 | * We don't need to check the matching | 1542 | * We don't need to check the matching |
@@ -1619,6 +1590,7 @@ static ssize_t bonding_store_slaves_active(struct device *d, | |||
1619 | { | 1590 | { |
1620 | struct bonding *bond = to_bond(d); | 1591 | struct bonding *bond = to_bond(d); |
1621 | int new_value, ret = count; | 1592 | int new_value, ret = count; |
1593 | struct list_head *iter; | ||
1622 | struct slave *slave; | 1594 | struct slave *slave; |
1623 | 1595 | ||
1624 | if (sscanf(buf, "%d", &new_value) != 1) { | 1596 | if (sscanf(buf, "%d", &new_value) != 1) { |
@@ -1641,7 +1613,7 @@ static ssize_t bonding_store_slaves_active(struct device *d, | |||
1641 | } | 1613 | } |
1642 | 1614 | ||
1643 | read_lock(&bond->lock); | 1615 | read_lock(&bond->lock); |
1644 | bond_for_each_slave(bond, slave) { | 1616 | bond_for_each_slave(bond, slave, iter) { |
1645 | if (!bond_is_active_slave(slave)) { | 1617 | if (!bond_is_active_slave(slave)) { |
1646 | if (new_value) | 1618 | if (new_value) |
1647 | slave->inactive = 0; | 1619 | slave->inactive = 0; |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 03cf3fd14490..9a26fbd82645 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -72,63 +72,37 @@ | |||
72 | res; }) | 72 | res; }) |
73 | 73 | ||
74 | /* slave list primitives */ | 74 | /* slave list primitives */ |
75 | #define bond_to_slave(ptr) list_entry(ptr, struct slave, list) | 75 | #define bond_slave_list(bond) (&(bond)->dev->adj_list.lower) |
76 | |||
77 | #define bond_has_slaves(bond) !list_empty(bond_slave_list(bond)) | ||
76 | 78 | ||
77 | /* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */ | 79 | /* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */ |
78 | #define bond_first_slave(bond) \ | 80 | #define bond_first_slave(bond) \ |
79 | list_first_entry_or_null(&(bond)->slave_list, struct slave, list) | 81 | (bond_has_slaves(bond) ? \ |
82 | netdev_adjacent_get_private(bond_slave_list(bond)->next) : \ | ||
83 | NULL) | ||
80 | #define bond_last_slave(bond) \ | 84 | #define bond_last_slave(bond) \ |
81 | (list_empty(&(bond)->slave_list) ? NULL : \ | 85 | (bond_has_slaves(bond) ? \ |
82 | bond_to_slave((bond)->slave_list.prev)) | 86 | netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \ |
83 | 87 | NULL) | |
84 | #define bond_is_first_slave(bond, pos) ((pos)->list.prev == &(bond)->slave_list) | ||
85 | #define bond_is_last_slave(bond, pos) ((pos)->list.next == &(bond)->slave_list) | ||
86 | |||
87 | /* Since bond_first/last_slave can return NULL, these can return NULL too */ | ||
88 | #define bond_next_slave(bond, pos) \ | ||
89 | (bond_is_last_slave(bond, pos) ? bond_first_slave(bond) : \ | ||
90 | bond_to_slave((pos)->list.next)) | ||
91 | 88 | ||
92 | #define bond_prev_slave(bond, pos) \ | 89 | #define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond)) |
93 | (bond_is_first_slave(bond, pos) ? bond_last_slave(bond) : \ | 90 | #define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond)) |
94 | bond_to_slave((pos)->list.prev)) | ||
95 | |||
96 | /** | ||
97 | * bond_for_each_slave_from - iterate the slaves list from a starting point | ||
98 | * @bond: the bond holding this list. | ||
99 | * @pos: current slave. | ||
100 | * @cnt: counter for max number of moves | ||
101 | * @start: starting point. | ||
102 | * | ||
103 | * Caller must hold bond->lock | ||
104 | */ | ||
105 | #define bond_for_each_slave_from(bond, pos, cnt, start) \ | ||
106 | for (cnt = 0, pos = start; pos && cnt < (bond)->slave_cnt; \ | ||
107 | cnt++, pos = bond_next_slave(bond, pos)) | ||
108 | 91 | ||
109 | /** | 92 | /** |
110 | * bond_for_each_slave - iterate over all slaves | 93 | * bond_for_each_slave - iterate over all slaves |
111 | * @bond: the bond holding this list | 94 | * @bond: the bond holding this list |
112 | * @pos: current slave | 95 | * @pos: current slave |
96 | * @iter: list_head * iterator | ||
113 | * | 97 | * |
114 | * Caller must hold bond->lock | 98 | * Caller must hold bond->lock |
115 | */ | 99 | */ |
116 | #define bond_for_each_slave(bond, pos) \ | 100 | #define bond_for_each_slave(bond, pos, iter) \ |
117 | list_for_each_entry(pos, &(bond)->slave_list, list) | 101 | netdev_for_each_lower_private((bond)->dev, pos, iter) |
118 | 102 | ||
119 | /* Caller must have rcu_read_lock */ | 103 | /* Caller must have rcu_read_lock */ |
120 | #define bond_for_each_slave_rcu(bond, pos) \ | 104 | #define bond_for_each_slave_rcu(bond, pos, iter) \ |
121 | list_for_each_entry_rcu(pos, &(bond)->slave_list, list) | 105 | netdev_for_each_lower_private_rcu((bond)->dev, pos, iter) |
122 | |||
123 | /** | ||
124 | * bond_for_each_slave_reverse - iterate in reverse from a given position | ||
125 | * @bond: the bond holding this list | ||
126 | * @pos: slave to continue from | ||
127 | * | ||
128 | * Caller must hold bond->lock | ||
129 | */ | ||
130 | #define bond_for_each_slave_continue_reverse(bond, pos) \ | ||
131 | list_for_each_entry_continue_reverse(pos, &(bond)->slave_list, list) | ||
132 | 106 | ||
133 | #ifdef CONFIG_NET_POLL_CONTROLLER | 107 | #ifdef CONFIG_NET_POLL_CONTROLLER |
134 | extern atomic_t netpoll_block_tx; | 108 | extern atomic_t netpoll_block_tx; |
@@ -188,7 +162,6 @@ struct bond_parm_tbl { | |||
188 | 162 | ||
189 | struct slave { | 163 | struct slave { |
190 | struct net_device *dev; /* first - useful for panic debug */ | 164 | struct net_device *dev; /* first - useful for panic debug */ |
191 | struct list_head list; | ||
192 | struct bonding *bond; /* our master */ | 165 | struct bonding *bond; /* our master */ |
193 | int delay; | 166 | int delay; |
194 | unsigned long jiffies; | 167 | unsigned long jiffies; |
@@ -228,7 +201,6 @@ struct slave { | |||
228 | */ | 201 | */ |
229 | struct bonding { | 202 | struct bonding { |
230 | struct net_device *dev; /* first - useful for panic debug */ | 203 | struct net_device *dev; /* first - useful for panic debug */ |
231 | struct list_head slave_list; | ||
232 | struct slave *curr_active_slave; | 204 | struct slave *curr_active_slave; |
233 | struct slave *current_arp_slave; | 205 | struct slave *current_arp_slave; |
234 | struct slave *primary_slave; | 206 | struct slave *primary_slave; |
@@ -276,13 +248,7 @@ struct bonding { | |||
276 | static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, | 248 | static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, |
277 | struct net_device *slave_dev) | 249 | struct net_device *slave_dev) |
278 | { | 250 | { |
279 | struct slave *slave = NULL; | 251 | return netdev_lower_dev_get_private(bond->dev, slave_dev); |
280 | |||
281 | bond_for_each_slave(bond, slave) | ||
282 | if (slave->dev == slave_dev) | ||
283 | return slave; | ||
284 | |||
285 | return NULL; | ||
286 | } | 252 | } |
287 | 253 | ||
288 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | 254 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) |
@@ -432,15 +398,12 @@ static inline bool slave_can_tx(struct slave *slave) | |||
432 | struct bond_net; | 398 | struct bond_net; |
433 | 399 | ||
434 | int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); | 400 | int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); |
435 | struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); | ||
436 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); | 401 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); |
437 | void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id); | 402 | void bond_xmit_slave_id(struct bonding *bond, struct sk_buff *skb, int slave_id); |
438 | int bond_create(struct net *net, const char *name); | 403 | int bond_create(struct net *net, const char *name); |
439 | int bond_create_sysfs(struct bond_net *net); | 404 | int bond_create_sysfs(struct bond_net *net); |
440 | void bond_destroy_sysfs(struct bond_net *net); | 405 | void bond_destroy_sysfs(struct bond_net *net); |
441 | void bond_prepare_sysfs_group(struct bonding *bond); | 406 | void bond_prepare_sysfs_group(struct bonding *bond); |
442 | int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave); | ||
443 | void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave); | ||
444 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); | 407 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); |
445 | int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); | 408 | int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); |
446 | void bond_mii_monitor(struct work_struct *); | 409 | void bond_mii_monitor(struct work_struct *); |
@@ -492,9 +455,10 @@ static inline void bond_destroy_proc_dir(struct bond_net *bn) | |||
492 | static inline struct slave *bond_slave_has_mac(struct bonding *bond, | 455 | static inline struct slave *bond_slave_has_mac(struct bonding *bond, |
493 | const u8 *mac) | 456 | const u8 *mac) |
494 | { | 457 | { |
458 | struct list_head *iter; | ||
495 | struct slave *tmp; | 459 | struct slave *tmp; |
496 | 460 | ||
497 | bond_for_each_slave(bond, tmp) | 461 | bond_for_each_slave(bond, tmp, iter) |
498 | if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) | 462 | if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) |
499 | return tmp; | 463 | return tmp; |
500 | 464 | ||
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 3b1ff6148702..64f2efaf7638 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -1347,7 +1347,7 @@ static int at91_can_probe(struct platform_device *pdev) | |||
1347 | priv->reg_base = addr; | 1347 | priv->reg_base = addr; |
1348 | priv->devtype_data = *devtype_data; | 1348 | priv->devtype_data = *devtype_data; |
1349 | priv->clk = clk; | 1349 | priv->clk = clk; |
1350 | priv->pdata = pdev->dev.platform_data; | 1350 | priv->pdata = dev_get_platdata(&pdev->dev); |
1351 | priv->mb0_id = 0x7ff; | 1351 | priv->mb0_id = 0x7ff; |
1352 | 1352 | ||
1353 | netif_napi_add(dev, &priv->napi, at91_poll, get_mb_rx_num(priv)); | 1353 | netif_napi_add(dev, &priv->napi, at91_poll, get_mb_rx_num(priv)); |
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c index a2700d25ff0e..8a0b515b33ea 100644 --- a/drivers/net/can/bfin_can.c +++ b/drivers/net/can/bfin_can.c | |||
@@ -539,7 +539,7 @@ static int bfin_can_probe(struct platform_device *pdev) | |||
539 | struct resource *res_mem, *rx_irq, *tx_irq, *err_irq; | 539 | struct resource *res_mem, *rx_irq, *tx_irq, *err_irq; |
540 | unsigned short *pdata; | 540 | unsigned short *pdata; |
541 | 541 | ||
542 | pdata = pdev->dev.platform_data; | 542 | pdata = dev_get_platdata(&pdev->dev); |
543 | if (!pdata) { | 543 | if (!pdata) { |
544 | dev_err(&pdev->dev, "No platform data provided!\n"); | 544 | dev_err(&pdev->dev, "No platform data provided!\n"); |
545 | err = -EINVAL; | 545 | err = -EINVAL; |
diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c index b374be7891a2..bce0be54c2f5 100644 --- a/drivers/net/can/c_can/c_can_pci.c +++ b/drivers/net/can/c_can/c_can_pci.c | |||
@@ -160,7 +160,6 @@ static int c_can_pci_probe(struct pci_dev *pdev, | |||
160 | return 0; | 160 | return 0; |
161 | 161 | ||
162 | out_free_c_can: | 162 | out_free_c_can: |
163 | pci_set_drvdata(pdev, NULL); | ||
164 | free_c_can_dev(dev); | 163 | free_c_can_dev(dev); |
165 | out_iounmap: | 164 | out_iounmap: |
166 | pci_iounmap(pdev, addr); | 165 | pci_iounmap(pdev, addr); |
@@ -181,7 +180,6 @@ static void c_can_pci_remove(struct pci_dev *pdev) | |||
181 | 180 | ||
182 | unregister_c_can_dev(dev); | 181 | unregister_c_can_dev(dev); |
183 | 182 | ||
184 | pci_set_drvdata(pdev, NULL); | ||
185 | free_c_can_dev(dev); | 183 | free_c_can_dev(dev); |
186 | 184 | ||
187 | pci_iounmap(pdev, priv->base); | 185 | pci_iounmap(pdev, priv->base); |
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index 294ced3cc227..d66ac265269c 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
@@ -322,7 +322,7 @@ static struct platform_driver c_can_plat_driver = { | |||
322 | .driver = { | 322 | .driver = { |
323 | .name = KBUILD_MODNAME, | 323 | .name = KBUILD_MODNAME, |
324 | .owner = THIS_MODULE, | 324 | .owner = THIS_MODULE, |
325 | .of_match_table = of_match_ptr(c_can_of_table), | 325 | .of_match_table = c_can_of_table, |
326 | }, | 326 | }, |
327 | .probe = c_can_plat_probe, | 327 | .probe = c_can_plat_probe, |
328 | .remove = c_can_plat_remove, | 328 | .remove = c_can_plat_remove, |
diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c index 034bdd816a60..ad76734b3ecc 100644 --- a/drivers/net/can/cc770/cc770_platform.c +++ b/drivers/net/can/cc770/cc770_platform.c | |||
@@ -152,7 +152,7 @@ static int cc770_get_platform_data(struct platform_device *pdev, | |||
152 | struct cc770_priv *priv) | 152 | struct cc770_priv *priv) |
153 | { | 153 | { |
154 | 154 | ||
155 | struct cc770_platform_data *pdata = pdev->dev.platform_data; | 155 | struct cc770_platform_data *pdata = dev_get_platdata(&pdev->dev); |
156 | 156 | ||
157 | priv->can.clock.freq = pdata->osc_freq; | 157 | priv->can.clock.freq = pdata->osc_freq; |
158 | if (priv->cpu_interface & CPUIF_DSC) | 158 | if (priv->cpu_interface & CPUIF_DSC) |
@@ -203,7 +203,7 @@ static int cc770_platform_probe(struct platform_device *pdev) | |||
203 | 203 | ||
204 | if (pdev->dev.of_node) | 204 | if (pdev->dev.of_node) |
205 | err = cc770_get_of_node_data(pdev, priv); | 205 | err = cc770_get_of_node_data(pdev, priv); |
206 | else if (pdev->dev.platform_data) | 206 | else if (dev_get_platdata(&pdev->dev)) |
207 | err = cc770_get_platform_data(pdev, priv); | 207 | err = cc770_get_platform_data(pdev, priv); |
208 | else | 208 | else |
209 | err = -ENODEV; | 209 | err = -ENODEV; |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 3f21142138b7..df010d64ecbb 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -1062,7 +1062,7 @@ static int flexcan_probe(struct platform_device *pdev) | |||
1062 | priv->dev = dev; | 1062 | priv->dev = dev; |
1063 | priv->clk_ipg = clk_ipg; | 1063 | priv->clk_ipg = clk_ipg; |
1064 | priv->clk_per = clk_per; | 1064 | priv->clk_per = clk_per; |
1065 | priv->pdata = pdev->dev.platform_data; | 1065 | priv->pdata = dev_get_platdata(&pdev->dev); |
1066 | priv->devtype_data = devtype_data; | 1066 | priv->devtype_data = devtype_data; |
1067 | 1067 | ||
1068 | priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); | 1068 | priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver"); |
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c index 36bd6fa1c7f3..ab5909a7bae9 100644 --- a/drivers/net/can/janz-ican3.c +++ b/drivers/net/can/janz-ican3.c | |||
@@ -1769,7 +1769,7 @@ static int ican3_probe(struct platform_device *pdev) | |||
1769 | struct device *dev; | 1769 | struct device *dev; |
1770 | int ret; | 1770 | int ret; |
1771 | 1771 | ||
1772 | pdata = pdev->dev.platform_data; | 1772 | pdata = dev_get_platdata(&pdev->dev); |
1773 | if (!pdata) | 1773 | if (!pdata) |
1774 | return -ENXIO; | 1774 | return -ENXIO; |
1775 | 1775 | ||
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index fe7dd696957e..08ac401e0214 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -999,7 +999,7 @@ static int mcp251x_can_probe(struct spi_device *spi) | |||
999 | { | 999 | { |
1000 | struct net_device *net; | 1000 | struct net_device *net; |
1001 | struct mcp251x_priv *priv; | 1001 | struct mcp251x_priv *priv; |
1002 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; | 1002 | struct mcp251x_platform_data *pdata = dev_get_platdata(&spi->dev); |
1003 | int ret = -ENODEV; | 1003 | int ret = -ENODEV; |
1004 | 1004 | ||
1005 | if (!pdata) | 1005 | if (!pdata) |
diff --git a/drivers/net/can/mscan/mscan.h b/drivers/net/can/mscan/mscan.h index 9c24d60a23b1..e98abb97a050 100644 --- a/drivers/net/can/mscan/mscan.h +++ b/drivers/net/can/mscan/mscan.h | |||
@@ -297,8 +297,8 @@ struct mscan_priv { | |||
297 | struct napi_struct napi; | 297 | struct napi_struct napi; |
298 | }; | 298 | }; |
299 | 299 | ||
300 | extern struct net_device *alloc_mscandev(void); | 300 | struct net_device *alloc_mscandev(void); |
301 | extern int register_mscandev(struct net_device *dev, int mscan_clksrc); | 301 | int register_mscandev(struct net_device *dev, int mscan_clksrc); |
302 | extern void unregister_mscandev(struct net_device *dev); | 302 | void unregister_mscandev(struct net_device *dev); |
303 | 303 | ||
304 | #endif /* __MSCAN_H__ */ | 304 | #endif /* __MSCAN_H__ */ |
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 5c314a961970..5f0e9b3bfa7b 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c | |||
@@ -964,7 +964,6 @@ static void pch_can_remove(struct pci_dev *pdev) | |||
964 | pci_disable_msi(priv->dev); | 964 | pci_disable_msi(priv->dev); |
965 | pci_release_regions(pdev); | 965 | pci_release_regions(pdev); |
966 | pci_disable_device(pdev); | 966 | pci_disable_device(pdev); |
967 | pci_set_drvdata(pdev, NULL); | ||
968 | pch_can_reset(priv); | 967 | pch_can_reset(priv); |
969 | pci_iounmap(pdev, priv->regs); | 968 | pci_iounmap(pdev, priv->regs); |
970 | free_candev(priv->ndev); | 969 | free_candev(priv->ndev); |
diff --git a/drivers/net/can/sja1000/ems_pci.c b/drivers/net/can/sja1000/ems_pci.c index 3752342a678a..835921388e7b 100644 --- a/drivers/net/can/sja1000/ems_pci.c +++ b/drivers/net/can/sja1000/ems_pci.c | |||
@@ -207,7 +207,6 @@ static void ems_pci_del_card(struct pci_dev *pdev) | |||
207 | kfree(card); | 207 | kfree(card); |
208 | 208 | ||
209 | pci_disable_device(pdev); | 209 | pci_disable_device(pdev); |
210 | pci_set_drvdata(pdev, NULL); | ||
211 | } | 210 | } |
212 | 211 | ||
213 | static void ems_pci_card_reset(struct ems_pci_card *card) | 212 | static void ems_pci_card_reset(struct ems_pci_card *card) |
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c index 217585b97cd3..087b13bd300e 100644 --- a/drivers/net/can/sja1000/kvaser_pci.c +++ b/drivers/net/can/sja1000/kvaser_pci.c | |||
@@ -387,7 +387,6 @@ static void kvaser_pci_remove_one(struct pci_dev *pdev) | |||
387 | 387 | ||
388 | pci_release_regions(pdev); | 388 | pci_release_regions(pdev); |
389 | pci_disable_device(pdev); | 389 | pci_disable_device(pdev); |
390 | pci_set_drvdata(pdev, NULL); | ||
391 | } | 390 | } |
392 | 391 | ||
393 | static struct pci_driver kvaser_pci_driver = { | 392 | static struct pci_driver kvaser_pci_driver = { |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 6b6f0ad75090..065ca49eb45e 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -744,8 +744,6 @@ static void peak_pci_remove(struct pci_dev *pdev) | |||
744 | pci_iounmap(pdev, cfg_base); | 744 | pci_iounmap(pdev, cfg_base); |
745 | pci_release_regions(pdev); | 745 | pci_release_regions(pdev); |
746 | pci_disable_device(pdev); | 746 | pci_disable_device(pdev); |
747 | |||
748 | pci_set_drvdata(pdev, NULL); | ||
749 | } | 747 | } |
750 | 748 | ||
751 | static struct pci_driver peak_pci_driver = { | 749 | static struct pci_driver peak_pci_driver = { |
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c index c52c1e96bf90..f9b4f81cd86a 100644 --- a/drivers/net/can/sja1000/plx_pci.c +++ b/drivers/net/can/sja1000/plx_pci.c | |||
@@ -477,7 +477,6 @@ static void plx_pci_del_card(struct pci_dev *pdev) | |||
477 | kfree(card); | 477 | kfree(card); |
478 | 478 | ||
479 | pci_disable_device(pdev); | 479 | pci_disable_device(pdev); |
480 | pci_set_drvdata(pdev, NULL); | ||
481 | } | 480 | } |
482 | 481 | ||
483 | /* | 482 | /* |
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c index 8e259c541036..29f9b6321187 100644 --- a/drivers/net/can/sja1000/sja1000_platform.c +++ b/drivers/net/can/sja1000/sja1000_platform.c | |||
@@ -76,7 +76,7 @@ static int sp_probe(struct platform_device *pdev) | |||
76 | struct resource *res_mem, *res_irq; | 76 | struct resource *res_mem, *res_irq; |
77 | struct sja1000_platform_data *pdata; | 77 | struct sja1000_platform_data *pdata; |
78 | 78 | ||
79 | pdata = pdev->dev.platform_data; | 79 | pdata = dev_get_platdata(&pdev->dev); |
80 | if (!pdata) { | 80 | if (!pdata) { |
81 | dev_err(&pdev->dev, "No platform data provided!\n"); | 81 | dev_err(&pdev->dev, "No platform data provided!\n"); |
82 | err = -ENODEV; | 82 | err = -ENODEV; |
diff --git a/drivers/net/can/softing/softing.h b/drivers/net/can/softing/softing.h index afd7d85b6915..35f062282dbd 100644 --- a/drivers/net/can/softing/softing.h +++ b/drivers/net/can/softing/softing.h | |||
@@ -71,34 +71,34 @@ struct softing { | |||
71 | } id; | 71 | } id; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | extern int softing_default_output(struct net_device *netdev); | 74 | int softing_default_output(struct net_device *netdev); |
75 | 75 | ||
76 | extern ktime_t softing_raw2ktime(struct softing *card, u32 raw); | 76 | ktime_t softing_raw2ktime(struct softing *card, u32 raw); |
77 | 77 | ||
78 | extern int softing_chip_poweron(struct softing *card); | 78 | int softing_chip_poweron(struct softing *card); |
79 | 79 | ||
80 | extern int softing_bootloader_command(struct softing *card, int16_t cmd, | 80 | int softing_bootloader_command(struct softing *card, int16_t cmd, |
81 | const char *msg); | 81 | const char *msg); |
82 | 82 | ||
83 | /* Load firmware after reset */ | 83 | /* Load firmware after reset */ |
84 | extern int softing_load_fw(const char *file, struct softing *card, | 84 | int softing_load_fw(const char *file, struct softing *card, |
85 | __iomem uint8_t *virt, unsigned int size, int offset); | 85 | __iomem uint8_t *virt, unsigned int size, int offset); |
86 | 86 | ||
87 | /* Load final application firmware after bootloader */ | 87 | /* Load final application firmware after bootloader */ |
88 | extern int softing_load_app_fw(const char *file, struct softing *card); | 88 | int softing_load_app_fw(const char *file, struct softing *card); |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * enable or disable irq | 91 | * enable or disable irq |
92 | * only called with fw.lock locked | 92 | * only called with fw.lock locked |
93 | */ | 93 | */ |
94 | extern int softing_enable_irq(struct softing *card, int enable); | 94 | int softing_enable_irq(struct softing *card, int enable); |
95 | 95 | ||
96 | /* start/stop 1 bus on card */ | 96 | /* start/stop 1 bus on card */ |
97 | extern int softing_startstop(struct net_device *netdev, int up); | 97 | int softing_startstop(struct net_device *netdev, int up); |
98 | 98 | ||
99 | /* netif_rx() */ | 99 | /* netif_rx() */ |
100 | extern int softing_netdev_rx(struct net_device *netdev, | 100 | int softing_netdev_rx(struct net_device *netdev, const struct can_frame *msg, |
101 | const struct can_frame *msg, ktime_t ktime); | 101 | ktime_t ktime); |
102 | 102 | ||
103 | /* SOFTING DPRAM mappings */ | 103 | /* SOFTING DPRAM mappings */ |
104 | #define DPRAM_RX 0x0000 | 104 | #define DPRAM_RX 0x0000 |
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c index 65eef1eea2e2..6cd5c01b624d 100644 --- a/drivers/net/can/softing/softing_main.c +++ b/drivers/net/can/softing/softing_main.c | |||
@@ -768,7 +768,7 @@ static int softing_pdev_remove(struct platform_device *pdev) | |||
768 | 768 | ||
769 | static int softing_pdev_probe(struct platform_device *pdev) | 769 | static int softing_pdev_probe(struct platform_device *pdev) |
770 | { | 770 | { |
771 | const struct softing_platform_data *pdat = pdev->dev.platform_data; | 771 | const struct softing_platform_data *pdat = dev_get_platdata(&pdev->dev); |
772 | struct softing *card; | 772 | struct softing *card; |
773 | struct net_device *netdev; | 773 | struct net_device *netdev; |
774 | struct softing_priv *priv; | 774 | struct softing_priv *priv; |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index 3a349a22d5bc..beb5ef834f0f 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
@@ -894,7 +894,7 @@ static int ti_hecc_probe(struct platform_device *pdev) | |||
894 | void __iomem *addr; | 894 | void __iomem *addr; |
895 | int err = -ENODEV; | 895 | int err = -ENODEV; |
896 | 896 | ||
897 | pdata = pdev->dev.platform_data; | 897 | pdata = dev_get_platdata(&pdev->dev); |
898 | if (!pdata) { | 898 | if (!pdata) { |
899 | dev_err(&pdev->dev, "No platform data\n"); | 899 | dev_err(&pdev->dev, "No platform data\n"); |
900 | goto probe_exit; | 900 | goto probe_exit; |
diff --git a/drivers/net/ethernet/8390/8390.h b/drivers/net/ethernet/8390/8390.h index ef325ffa1b5a..2923c51bb351 100644 --- a/drivers/net/ethernet/8390/8390.h +++ b/drivers/net/ethernet/8390/8390.h | |||
@@ -28,42 +28,42 @@ extern int ei_debug; | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #ifdef CONFIG_NET_POLL_CONTROLLER | 30 | #ifdef CONFIG_NET_POLL_CONTROLLER |
31 | extern void ei_poll(struct net_device *dev); | 31 | void ei_poll(struct net_device *dev); |
32 | extern void eip_poll(struct net_device *dev); | 32 | void eip_poll(struct net_device *dev); |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | 35 | ||
36 | /* Without I/O delay - non ISA or later chips */ | 36 | /* Without I/O delay - non ISA or later chips */ |
37 | extern void NS8390_init(struct net_device *dev, int startp); | 37 | void NS8390_init(struct net_device *dev, int startp); |
38 | extern int ei_open(struct net_device *dev); | 38 | int ei_open(struct net_device *dev); |
39 | extern int ei_close(struct net_device *dev); | 39 | int ei_close(struct net_device *dev); |
40 | extern irqreturn_t ei_interrupt(int irq, void *dev_id); | 40 | irqreturn_t ei_interrupt(int irq, void *dev_id); |
41 | extern void ei_tx_timeout(struct net_device *dev); | 41 | void ei_tx_timeout(struct net_device *dev); |
42 | extern netdev_tx_t ei_start_xmit(struct sk_buff *skb, struct net_device *dev); | 42 | netdev_tx_t ei_start_xmit(struct sk_buff *skb, struct net_device *dev); |
43 | extern void ei_set_multicast_list(struct net_device *dev); | 43 | void ei_set_multicast_list(struct net_device *dev); |
44 | extern struct net_device_stats *ei_get_stats(struct net_device *dev); | 44 | struct net_device_stats *ei_get_stats(struct net_device *dev); |
45 | 45 | ||
46 | extern const struct net_device_ops ei_netdev_ops; | 46 | extern const struct net_device_ops ei_netdev_ops; |
47 | 47 | ||
48 | extern struct net_device *__alloc_ei_netdev(int size); | 48 | struct net_device *__alloc_ei_netdev(int size); |
49 | static inline struct net_device *alloc_ei_netdev(void) | 49 | static inline struct net_device *alloc_ei_netdev(void) |
50 | { | 50 | { |
51 | return __alloc_ei_netdev(0); | 51 | return __alloc_ei_netdev(0); |
52 | } | 52 | } |
53 | 53 | ||
54 | /* With I/O delay form */ | 54 | /* With I/O delay form */ |
55 | extern void NS8390p_init(struct net_device *dev, int startp); | 55 | void NS8390p_init(struct net_device *dev, int startp); |
56 | extern int eip_open(struct net_device *dev); | 56 | int eip_open(struct net_device *dev); |
57 | extern int eip_close(struct net_device *dev); | 57 | int eip_close(struct net_device *dev); |
58 | extern irqreturn_t eip_interrupt(int irq, void *dev_id); | 58 | irqreturn_t eip_interrupt(int irq, void *dev_id); |
59 | extern void eip_tx_timeout(struct net_device *dev); | 59 | void eip_tx_timeout(struct net_device *dev); |
60 | extern netdev_tx_t eip_start_xmit(struct sk_buff *skb, struct net_device *dev); | 60 | netdev_tx_t eip_start_xmit(struct sk_buff *skb, struct net_device *dev); |
61 | extern void eip_set_multicast_list(struct net_device *dev); | 61 | void eip_set_multicast_list(struct net_device *dev); |
62 | extern struct net_device_stats *eip_get_stats(struct net_device *dev); | 62 | struct net_device_stats *eip_get_stats(struct net_device *dev); |
63 | 63 | ||
64 | extern const struct net_device_ops eip_netdev_ops; | 64 | extern const struct net_device_ops eip_netdev_ops; |
65 | 65 | ||
66 | extern struct net_device *__alloc_eip_netdev(int size); | 66 | struct net_device *__alloc_eip_netdev(int size); |
67 | static inline struct net_device *alloc_eip_netdev(void) | 67 | static inline struct net_device *alloc_eip_netdev(void) |
68 | { | 68 | { |
69 | return __alloc_eip_netdev(0); | 69 | return __alloc_eip_netdev(0); |
diff --git a/drivers/net/ethernet/adi/bfin_mac.h b/drivers/net/ethernet/adi/bfin_mac.h index 7a07ee07906b..6dec86ac97cd 100644 --- a/drivers/net/ethernet/adi/bfin_mac.h +++ b/drivers/net/ethernet/adi/bfin_mac.h | |||
@@ -104,6 +104,6 @@ struct bfin_mac_local { | |||
104 | #endif | 104 | #endif |
105 | }; | 105 | }; |
106 | 106 | ||
107 | extern int bfin_get_ether_addr(char *addr); | 107 | int bfin_get_ether_addr(char *addr); |
108 | 108 | ||
109 | #endif | 109 | #endif |
diff --git a/drivers/net/ethernet/amd/7990.h b/drivers/net/ethernet/amd/7990.h index 0a5837b96421..ae33a99bf476 100644 --- a/drivers/net/ethernet/amd/7990.h +++ b/drivers/net/ethernet/amd/7990.h | |||
@@ -242,13 +242,13 @@ struct lance_private | |||
242 | #define LANCE_ADDR(x) ((int)(x) & ~0xff000000) | 242 | #define LANCE_ADDR(x) ((int)(x) & ~0xff000000) |
243 | 243 | ||
244 | /* Now the prototypes we export */ | 244 | /* Now the prototypes we export */ |
245 | extern int lance_open(struct net_device *dev); | 245 | int lance_open(struct net_device *dev); |
246 | extern int lance_close (struct net_device *dev); | 246 | int lance_close (struct net_device *dev); |
247 | extern int lance_start_xmit (struct sk_buff *skb, struct net_device *dev); | 247 | int lance_start_xmit (struct sk_buff *skb, struct net_device *dev); |
248 | extern void lance_set_multicast (struct net_device *dev); | 248 | void lance_set_multicast (struct net_device *dev); |
249 | extern void lance_tx_timeout(struct net_device *dev); | 249 | void lance_tx_timeout(struct net_device *dev); |
250 | #ifdef CONFIG_NET_POLL_CONTROLLER | 250 | #ifdef CONFIG_NET_POLL_CONTROLLER |
251 | extern void lance_poll(struct net_device *dev); | 251 | void lance_poll(struct net_device *dev); |
252 | #endif | 252 | #endif |
253 | 253 | ||
254 | #endif /* ndef _7990_H */ | 254 | #endif /* ndef _7990_H */ |
diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c index 94edc9c6fbbf..cc35f6f4e703 100644 --- a/drivers/net/ethernet/amd/declance.c +++ b/drivers/net/ethernet/amd/declance.c | |||
@@ -344,8 +344,8 @@ static void cp_to_buf(const int type, void *to, const void *from, int len) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | clen = len & 1; | 346 | clen = len & 1; |
347 | rtp = tp; | 347 | rtp = (unsigned char *)tp; |
348 | rfp = fp; | 348 | rfp = (const unsigned char *)fp; |
349 | while (clen--) { | 349 | while (clen--) { |
350 | *rtp++ = *rfp++; | 350 | *rtp++ = *rfp++; |
351 | } | 351 | } |
@@ -372,8 +372,8 @@ static void cp_to_buf(const int type, void *to, const void *from, int len) | |||
372 | * do the rest, if any. | 372 | * do the rest, if any. |
373 | */ | 373 | */ |
374 | clen = len & 15; | 374 | clen = len & 15; |
375 | rtp = (unsigned char *) tp; | 375 | rtp = (unsigned char *)tp; |
376 | rfp = (unsigned char *) fp; | 376 | rfp = (const unsigned char *)fp; |
377 | while (clen--) { | 377 | while (clen--) { |
378 | *rtp++ = *rfp++; | 378 | *rtp++ = *rfp++; |
379 | } | 379 | } |
@@ -403,8 +403,8 @@ static void cp_from_buf(const int type, void *to, const void *from, int len) | |||
403 | 403 | ||
404 | clen = len & 1; | 404 | clen = len & 1; |
405 | 405 | ||
406 | rtp = tp; | 406 | rtp = (unsigned char *)tp; |
407 | rfp = fp; | 407 | rfp = (const unsigned char *)fp; |
408 | 408 | ||
409 | while (clen--) { | 409 | while (clen--) { |
410 | *rtp++ = *rfp++; | 410 | *rtp++ = *rfp++; |
@@ -433,8 +433,8 @@ static void cp_from_buf(const int type, void *to, const void *from, int len) | |||
433 | * do the rest, if any. | 433 | * do the rest, if any. |
434 | */ | 434 | */ |
435 | clen = len & 15; | 435 | clen = len & 15; |
436 | rtp = (unsigned char *) tp; | 436 | rtp = (unsigned char *)tp; |
437 | rfp = (unsigned char *) fp; | 437 | rfp = (const unsigned char *)fp; |
438 | while (clen--) { | 438 | while (clen--) { |
439 | *rtp++ = *rfp++; | 439 | *rtp++ = *rfp++; |
440 | } | 440 | } |
diff --git a/drivers/net/ethernet/amd/lance.c b/drivers/net/ethernet/amd/lance.c index 5c728436b85e..256f590f6bb1 100644 --- a/drivers/net/ethernet/amd/lance.c +++ b/drivers/net/ethernet/amd/lance.c | |||
@@ -754,7 +754,7 @@ lance_open(struct net_device *dev) | |||
754 | int i; | 754 | int i; |
755 | 755 | ||
756 | if (dev->irq == 0 || | 756 | if (dev->irq == 0 || |
757 | request_irq(dev->irq, lance_interrupt, 0, lp->name, dev)) { | 757 | request_irq(dev->irq, lance_interrupt, 0, dev->name, dev)) { |
758 | return -EAGAIN; | 758 | return -EAGAIN; |
759 | } | 759 | } |
760 | 760 | ||
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h index 0f0556526ba9..7f9369a3b378 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c.h +++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h | |||
@@ -600,7 +600,7 @@ struct atl1c_adapter { | |||
600 | extern char atl1c_driver_name[]; | 600 | extern char atl1c_driver_name[]; |
601 | extern char atl1c_driver_version[]; | 601 | extern char atl1c_driver_version[]; |
602 | 602 | ||
603 | extern void atl1c_reinit_locked(struct atl1c_adapter *adapter); | 603 | void atl1c_reinit_locked(struct atl1c_adapter *adapter); |
604 | extern s32 atl1c_reset_hw(struct atl1c_hw *hw); | 604 | s32 atl1c_reset_hw(struct atl1c_hw *hw); |
605 | extern void atl1c_set_ethtool_ops(struct net_device *netdev); | 605 | void atl1c_set_ethtool_ops(struct net_device *netdev); |
606 | #endif /* _ATL1C_H_ */ | 606 | #endif /* _ATL1C_H_ */ |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h index b5fd934585e9..1b0fe2d04a0e 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e.h +++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h | |||
@@ -499,10 +499,10 @@ struct atl1e_adapter { | |||
499 | extern char atl1e_driver_name[]; | 499 | extern char atl1e_driver_name[]; |
500 | extern char atl1e_driver_version[]; | 500 | extern char atl1e_driver_version[]; |
501 | 501 | ||
502 | extern void atl1e_check_options(struct atl1e_adapter *adapter); | 502 | void atl1e_check_options(struct atl1e_adapter *adapter); |
503 | extern int atl1e_up(struct atl1e_adapter *adapter); | 503 | int atl1e_up(struct atl1e_adapter *adapter); |
504 | extern void atl1e_down(struct atl1e_adapter *adapter); | 504 | void atl1e_down(struct atl1e_adapter *adapter); |
505 | extern void atl1e_reinit_locked(struct atl1e_adapter *adapter); | 505 | void atl1e_reinit_locked(struct atl1e_adapter *adapter); |
506 | extern s32 atl1e_reset_hw(struct atl1e_hw *hw); | 506 | s32 atl1e_reset_hw(struct atl1e_hw *hw); |
507 | extern void atl1e_set_ethtool_ops(struct net_device *netdev); | 507 | void atl1e_set_ethtool_ops(struct net_device *netdev); |
508 | #endif /* _ATL1_E_H_ */ | 508 | #endif /* _ATL1_E_H_ */ |
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.h b/drivers/net/ethernet/atheros/atlx/atl2.h index 3ebe19f7242b..2f27d4c4c3ad 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.h +++ b/drivers/net/ethernet/atheros/atlx/atl2.h | |||
@@ -42,7 +42,7 @@ | |||
42 | #include "atlx.h" | 42 | #include "atlx.h" |
43 | 43 | ||
44 | #ifdef ETHTOOL_OPS_COMPAT | 44 | #ifdef ETHTOOL_OPS_COMPAT |
45 | extern int ethtool_ioctl(struct ifreq *ifr); | 45 | int ethtool_ioctl(struct ifreq *ifr); |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #define PCI_COMMAND_REGISTER PCI_COMMAND | 48 | #define PCI_COMMAND_REGISTER PCI_COMMAND |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 9b017d9c58e9..c96930f12932 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -596,6 +596,7 @@ static void b44_timer(unsigned long __opaque) | |||
596 | static void b44_tx(struct b44 *bp) | 596 | static void b44_tx(struct b44 *bp) |
597 | { | 597 | { |
598 | u32 cur, cons; | 598 | u32 cur, cons; |
599 | unsigned bytes_compl = 0, pkts_compl = 0; | ||
599 | 600 | ||
600 | cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK; | 601 | cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK; |
601 | cur /= sizeof(struct dma_desc); | 602 | cur /= sizeof(struct dma_desc); |
@@ -612,9 +613,14 @@ static void b44_tx(struct b44 *bp) | |||
612 | skb->len, | 613 | skb->len, |
613 | DMA_TO_DEVICE); | 614 | DMA_TO_DEVICE); |
614 | rp->skb = NULL; | 615 | rp->skb = NULL; |
616 | |||
617 | bytes_compl += skb->len; | ||
618 | pkts_compl++; | ||
619 | |||
615 | dev_kfree_skb_irq(skb); | 620 | dev_kfree_skb_irq(skb); |
616 | } | 621 | } |
617 | 622 | ||
623 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); | ||
618 | bp->tx_cons = cons; | 624 | bp->tx_cons = cons; |
619 | if (netif_queue_stopped(bp->dev) && | 625 | if (netif_queue_stopped(bp->dev) && |
620 | TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH) | 626 | TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH) |
@@ -1018,6 +1024,8 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1018 | if (bp->flags & B44_FLAG_REORDER_BUG) | 1024 | if (bp->flags & B44_FLAG_REORDER_BUG) |
1019 | br32(bp, B44_DMATX_PTR); | 1025 | br32(bp, B44_DMATX_PTR); |
1020 | 1026 | ||
1027 | netdev_sent_queue(dev, skb->len); | ||
1028 | |||
1021 | if (TX_BUFFS_AVAIL(bp) < 1) | 1029 | if (TX_BUFFS_AVAIL(bp) < 1) |
1022 | netif_stop_queue(dev); | 1030 | netif_stop_queue(dev); |
1023 | 1031 | ||
@@ -1416,6 +1424,8 @@ static void b44_init_hw(struct b44 *bp, int reset_kind) | |||
1416 | 1424 | ||
1417 | val = br32(bp, B44_ENET_CTRL); | 1425 | val = br32(bp, B44_ENET_CTRL); |
1418 | bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); | 1426 | bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); |
1427 | |||
1428 | netdev_reset_queue(bp->dev); | ||
1419 | } | 1429 | } |
1420 | 1430 | ||
1421 | static int b44_open(struct net_device *dev) | 1431 | static int b44_open(struct net_device *dev) |
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 249468f95365..7eca5a174733 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
@@ -149,6 +149,8 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, | |||
149 | dma_desc->ctl0 = cpu_to_le32(ctl0); | 149 | dma_desc->ctl0 = cpu_to_le32(ctl0); |
150 | dma_desc->ctl1 = cpu_to_le32(ctl1); | 150 | dma_desc->ctl1 = cpu_to_le32(ctl1); |
151 | 151 | ||
152 | netdev_sent_queue(net_dev, skb->len); | ||
153 | |||
152 | wmb(); | 154 | wmb(); |
153 | 155 | ||
154 | /* Increase ring->end to point empty slot. We tell hardware the first | 156 | /* Increase ring->end to point empty slot. We tell hardware the first |
@@ -178,6 +180,7 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) | |||
178 | struct device *dma_dev = bgmac->core->dma_dev; | 180 | struct device *dma_dev = bgmac->core->dma_dev; |
179 | int empty_slot; | 181 | int empty_slot; |
180 | bool freed = false; | 182 | bool freed = false; |
183 | unsigned bytes_compl = 0, pkts_compl = 0; | ||
181 | 184 | ||
182 | /* The last slot that hardware didn't consume yet */ | 185 | /* The last slot that hardware didn't consume yet */ |
183 | empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); | 186 | empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); |
@@ -195,6 +198,9 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) | |||
195 | slot->skb->len, DMA_TO_DEVICE); | 198 | slot->skb->len, DMA_TO_DEVICE); |
196 | slot->dma_addr = 0; | 199 | slot->dma_addr = 0; |
197 | 200 | ||
201 | bytes_compl += slot->skb->len; | ||
202 | pkts_compl++; | ||
203 | |||
198 | /* Free memory! :) */ | 204 | /* Free memory! :) */ |
199 | dev_kfree_skb(slot->skb); | 205 | dev_kfree_skb(slot->skb); |
200 | slot->skb = NULL; | 206 | slot->skb = NULL; |
@@ -208,6 +214,8 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) | |||
208 | freed = true; | 214 | freed = true; |
209 | } | 215 | } |
210 | 216 | ||
217 | netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl); | ||
218 | |||
211 | if (freed && netif_queue_stopped(bgmac->net_dev)) | 219 | if (freed && netif_queue_stopped(bgmac->net_dev)) |
212 | netif_wake_queue(bgmac->net_dev); | 220 | netif_wake_queue(bgmac->net_dev); |
213 | } | 221 | } |
@@ -988,6 +996,8 @@ static void bgmac_chip_reset(struct bgmac *bgmac) | |||
988 | bgmac_miiconfig(bgmac); | 996 | bgmac_miiconfig(bgmac); |
989 | bgmac_phy_init(bgmac); | 997 | bgmac_phy_init(bgmac); |
990 | 998 | ||
999 | netdev_reset_queue(bgmac->net_dev); | ||
1000 | |||
991 | bgmac->int_status = 0; | 1001 | bgmac->int_status = 0; |
992 | } | 1002 | } |
993 | 1003 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index 97b3d32a98bd..8fe4bcb2407d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -2231,7 +2231,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, | |||
2231 | #define BNX2X_NUM_TESTS_SF 7 | 2231 | #define BNX2X_NUM_TESTS_SF 7 |
2232 | #define BNX2X_NUM_TESTS_MF 3 | 2232 | #define BNX2X_NUM_TESTS_MF 3 |
2233 | #define BNX2X_NUM_TESTS(bp) (IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \ | 2233 | #define BNX2X_NUM_TESTS(bp) (IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \ |
2234 | BNX2X_NUM_TESTS_SF) | 2234 | IS_VF(bp) ? 0 : BNX2X_NUM_TESTS_SF) |
2235 | 2235 | ||
2236 | #define BNX2X_PHY_LOOPBACK 0 | 2236 | #define BNX2X_PHY_LOOPBACK 0 |
2237 | #define BNX2X_MAC_LOOPBACK 1 | 2237 | #define BNX2X_MAC_LOOPBACK 1 |
@@ -2491,11 +2491,5 @@ enum { | |||
2491 | 2491 | ||
2492 | #define NUM_MACS 8 | 2492 | #define NUM_MACS 8 |
2493 | 2493 | ||
2494 | enum bnx2x_pci_bus_speed { | ||
2495 | BNX2X_PCI_LINK_SPEED_2500 = 2500, | ||
2496 | BNX2X_PCI_LINK_SPEED_5000 = 5000, | ||
2497 | BNX2X_PCI_LINK_SPEED_8000 = 8000 | ||
2498 | }; | ||
2499 | |||
2500 | void bnx2x_set_local_cmng(struct bnx2x *bp); | 2494 | void bnx2x_set_local_cmng(struct bnx2x *bp); |
2501 | #endif /* bnx2x.h */ | 2495 | #endif /* bnx2x.h */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index e66beff2704d..0c64122aeaff 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3255,14 +3255,16 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb) | |||
3255 | if (prot == IPPROTO_TCP) | 3255 | if (prot == IPPROTO_TCP) |
3256 | rc |= XMIT_CSUM_TCP; | 3256 | rc |= XMIT_CSUM_TCP; |
3257 | 3257 | ||
3258 | if (skb_is_gso_v6(skb)) { | 3258 | if (skb_is_gso(skb)) { |
3259 | rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP); | 3259 | if (skb_is_gso_v6(skb)) { |
3260 | if (rc & XMIT_CSUM_ENC) | 3260 | rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP); |
3261 | rc |= XMIT_GSO_ENC_V6; | 3261 | if (rc & XMIT_CSUM_ENC) |
3262 | } else if (skb_is_gso(skb)) { | 3262 | rc |= XMIT_GSO_ENC_V6; |
3263 | rc |= (XMIT_GSO_V4 | XMIT_CSUM_TCP); | 3263 | } else { |
3264 | if (rc & XMIT_CSUM_ENC) | 3264 | rc |= (XMIT_GSO_V4 | XMIT_CSUM_TCP); |
3265 | rc |= XMIT_GSO_ENC_V4; | 3265 | if (rc & XMIT_CSUM_ENC) |
3266 | rc |= XMIT_GSO_ENC_V4; | ||
3267 | } | ||
3266 | } | 3268 | } |
3267 | 3269 | ||
3268 | return rc; | 3270 | return rc; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index 324de5f05332..8213cc827aae 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
@@ -639,6 +639,9 @@ static int bnx2x_get_regs_len(struct net_device *dev) | |||
639 | struct bnx2x *bp = netdev_priv(dev); | 639 | struct bnx2x *bp = netdev_priv(dev); |
640 | int regdump_len = 0; | 640 | int regdump_len = 0; |
641 | 641 | ||
642 | if (IS_VF(bp)) | ||
643 | return 0; | ||
644 | |||
642 | regdump_len = __bnx2x_get_regs_len(bp); | 645 | regdump_len = __bnx2x_get_regs_len(bp); |
643 | regdump_len *= 4; | 646 | regdump_len *= 4; |
644 | regdump_len += sizeof(struct dump_header); | 647 | regdump_len += sizeof(struct dump_header); |
@@ -2900,9 +2903,16 @@ static void bnx2x_self_test(struct net_device *dev, | |||
2900 | 2903 | ||
2901 | memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS(bp)); | 2904 | memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS(bp)); |
2902 | 2905 | ||
2906 | if (bnx2x_test_nvram(bp) != 0) { | ||
2907 | if (!IS_MF(bp)) | ||
2908 | buf[4] = 1; | ||
2909 | else | ||
2910 | buf[0] = 1; | ||
2911 | etest->flags |= ETH_TEST_FL_FAILED; | ||
2912 | } | ||
2913 | |||
2903 | if (!netif_running(dev)) { | 2914 | if (!netif_running(dev)) { |
2904 | DP(BNX2X_MSG_ETHTOOL, | 2915 | DP(BNX2X_MSG_ETHTOOL, "Interface is down\n"); |
2905 | "Can't perform self-test when interface is down\n"); | ||
2906 | return; | 2916 | return; |
2907 | } | 2917 | } |
2908 | 2918 | ||
@@ -2964,13 +2974,7 @@ static void bnx2x_self_test(struct net_device *dev, | |||
2964 | /* wait until link state is restored */ | 2974 | /* wait until link state is restored */ |
2965 | bnx2x_wait_for_link(bp, link_up, is_serdes); | 2975 | bnx2x_wait_for_link(bp, link_up, is_serdes); |
2966 | } | 2976 | } |
2967 | if (bnx2x_test_nvram(bp) != 0) { | 2977 | |
2968 | if (!IS_MF(bp)) | ||
2969 | buf[4] = 1; | ||
2970 | else | ||
2971 | buf[0] = 1; | ||
2972 | etest->flags |= ETH_TEST_FL_FAILED; | ||
2973 | } | ||
2974 | if (bnx2x_test_intr(bp) != 0) { | 2978 | if (bnx2x_test_intr(bp) != 0) { |
2975 | if (!IS_MF(bp)) | 2979 | if (!IS_MF(bp)) |
2976 | buf[5] = 1; | 2980 | buf[5] = 1; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 32767f6aa33f..cf1df8b62e2c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -172,6 +172,7 @@ struct shared_hw_cfg { /* NVRAM Offset */ | |||
172 | #define SHARED_HW_CFG_LED_MAC4 0x000c0000 | 172 | #define SHARED_HW_CFG_LED_MAC4 0x000c0000 |
173 | #define SHARED_HW_CFG_LED_PHY8 0x000d0000 | 173 | #define SHARED_HW_CFG_LED_PHY8 0x000d0000 |
174 | #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000 | 174 | #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000 |
175 | #define SHARED_HW_CFG_LED_EXTPHY2 0x000f0000 | ||
175 | 176 | ||
176 | 177 | ||
177 | #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000 | 178 | #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 51468227bf3b..20dcc02431ca 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -3122,7 +3122,7 @@ static void bnx2x_bsc_module_sel(struct link_params *params) | |||
3122 | } | 3122 | } |
3123 | 3123 | ||
3124 | static int bnx2x_bsc_read(struct link_params *params, | 3124 | static int bnx2x_bsc_read(struct link_params *params, |
3125 | struct bnx2x_phy *phy, | 3125 | struct bnx2x *bp, |
3126 | u8 sl_devid, | 3126 | u8 sl_devid, |
3127 | u16 sl_addr, | 3127 | u16 sl_addr, |
3128 | u8 lc_addr, | 3128 | u8 lc_addr, |
@@ -3131,7 +3131,6 @@ static int bnx2x_bsc_read(struct link_params *params, | |||
3131 | { | 3131 | { |
3132 | u32 val, i; | 3132 | u32 val, i; |
3133 | int rc = 0; | 3133 | int rc = 0; |
3134 | struct bnx2x *bp = params->bp; | ||
3135 | 3134 | ||
3136 | if (xfer_cnt > 16) { | 3135 | if (xfer_cnt > 16) { |
3137 | DP(NETIF_MSG_LINK, "invalid xfer_cnt %d. Max is 16 bytes\n", | 3136 | DP(NETIF_MSG_LINK, "invalid xfer_cnt %d. Max is 16 bytes\n", |
@@ -6371,9 +6370,15 @@ int bnx2x_set_led(struct link_params *params, | |||
6371 | * intended override. | 6370 | * intended override. |
6372 | */ | 6371 | */ |
6373 | break; | 6372 | break; |
6374 | } else | 6373 | } else { |
6374 | u32 nig_led_mode = ((params->hw_led_mode << | ||
6375 | SHARED_HW_CFG_LED_MODE_SHIFT) == | ||
6376 | SHARED_HW_CFG_LED_EXTPHY2) ? | ||
6377 | (SHARED_HW_CFG_LED_PHY1 >> | ||
6378 | SHARED_HW_CFG_LED_MODE_SHIFT) : hw_led_mode; | ||
6375 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, | 6379 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, |
6376 | hw_led_mode); | 6380 | nig_led_mode); |
6381 | } | ||
6377 | 6382 | ||
6378 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0); | 6383 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0); |
6379 | /* Set blinking rate to ~15.9Hz */ | 6384 | /* Set blinking rate to ~15.9Hz */ |
@@ -7917,7 +7922,7 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7917 | usleep_range(1000, 2000); | 7922 | usleep_range(1000, 2000); |
7918 | bnx2x_warpcore_power_module(params, 1); | 7923 | bnx2x_warpcore_power_module(params, 1); |
7919 | } | 7924 | } |
7920 | rc = bnx2x_bsc_read(params, phy, dev_addr, addr32, 0, byte_cnt, | 7925 | rc = bnx2x_bsc_read(params, bp, dev_addr, addr32, 0, byte_cnt, |
7921 | data_array); | 7926 | data_array); |
7922 | } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); | 7927 | } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); |
7923 | 7928 | ||
@@ -10653,10 +10658,18 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
10653 | 0x40); | 10658 | 0x40); |
10654 | 10659 | ||
10655 | } else { | 10660 | } else { |
10661 | /* EXTPHY2 LED mode indicate that the 100M/1G/10G LED | ||
10662 | * sources are all wired through LED1, rather than only | ||
10663 | * 10G in other modes. | ||
10664 | */ | ||
10665 | val = ((params->hw_led_mode << | ||
10666 | SHARED_HW_CFG_LED_MODE_SHIFT) == | ||
10667 | SHARED_HW_CFG_LED_EXTPHY2) ? 0x98 : 0x80; | ||
10668 | |||
10656 | bnx2x_cl45_write(bp, phy, | 10669 | bnx2x_cl45_write(bp, phy, |
10657 | MDIO_PMA_DEVAD, | 10670 | MDIO_PMA_DEVAD, |
10658 | MDIO_PMA_REG_8481_LED1_MASK, | 10671 | MDIO_PMA_REG_8481_LED1_MASK, |
10659 | 0x80); | 10672 | val); |
10660 | 10673 | ||
10661 | /* Tell LED3 to blink on source */ | 10674 | /* Tell LED3 to blink on source */ |
10662 | bnx2x_cl45_read(bp, phy, | 10675 | bnx2x_cl45_read(bp, phy, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 82b658d8c04c..10c8fdb6146a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -11746,7 +11746,7 @@ static int bnx2x_open(struct net_device *dev) | |||
11746 | rc = bnx2x_nic_load(bp, LOAD_OPEN); | 11746 | rc = bnx2x_nic_load(bp, LOAD_OPEN); |
11747 | if (rc) | 11747 | if (rc) |
11748 | return rc; | 11748 | return rc; |
11749 | return bnx2x_open_epilog(bp); | 11749 | return 0; |
11750 | } | 11750 | } |
11751 | 11751 | ||
11752 | /* called with rtnl_lock */ | 11752 | /* called with rtnl_lock */ |
@@ -12280,28 +12280,6 @@ err_out: | |||
12280 | return rc; | 12280 | return rc; |
12281 | } | 12281 | } |
12282 | 12282 | ||
12283 | static void bnx2x_get_pcie_width_speed(struct bnx2x *bp, int *width, | ||
12284 | enum bnx2x_pci_bus_speed *speed) | ||
12285 | { | ||
12286 | u32 link_speed, val = 0; | ||
12287 | |||
12288 | pci_read_config_dword(bp->pdev, PCICFG_LINK_CONTROL, &val); | ||
12289 | *width = (val & PCICFG_LINK_WIDTH) >> PCICFG_LINK_WIDTH_SHIFT; | ||
12290 | |||
12291 | link_speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT; | ||
12292 | |||
12293 | switch (link_speed) { | ||
12294 | case 3: | ||
12295 | *speed = BNX2X_PCI_LINK_SPEED_8000; | ||
12296 | break; | ||
12297 | case 2: | ||
12298 | *speed = BNX2X_PCI_LINK_SPEED_5000; | ||
12299 | break; | ||
12300 | default: | ||
12301 | *speed = BNX2X_PCI_LINK_SPEED_2500; | ||
12302 | } | ||
12303 | } | ||
12304 | |||
12305 | static int bnx2x_check_firmware(struct bnx2x *bp) | 12283 | static int bnx2x_check_firmware(struct bnx2x *bp) |
12306 | { | 12284 | { |
12307 | const struct firmware *firmware = bp->firmware; | 12285 | const struct firmware *firmware = bp->firmware; |
@@ -12658,8 +12636,8 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
12658 | { | 12636 | { |
12659 | struct net_device *dev = NULL; | 12637 | struct net_device *dev = NULL; |
12660 | struct bnx2x *bp; | 12638 | struct bnx2x *bp; |
12661 | int pcie_width; | 12639 | enum pcie_link_width pcie_width; |
12662 | enum bnx2x_pci_bus_speed pcie_speed; | 12640 | enum pci_bus_speed pcie_speed; |
12663 | int rc, max_non_def_sbs; | 12641 | int rc, max_non_def_sbs; |
12664 | int rx_count, tx_count, rss_count, doorbell_size; | 12642 | int rx_count, tx_count, rss_count, doorbell_size; |
12665 | int max_cos_est; | 12643 | int max_cos_est; |
@@ -12808,18 +12786,19 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
12808 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); | 12786 | dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); |
12809 | rtnl_unlock(); | 12787 | rtnl_unlock(); |
12810 | } | 12788 | } |
12811 | 12789 | if (pcie_get_minimum_link(bp->pdev, &pcie_speed, &pcie_width) || | |
12812 | bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed); | 12790 | pcie_speed == PCI_SPEED_UNKNOWN || |
12813 | BNX2X_DEV_INFO("got pcie width %d and speed %d\n", | 12791 | pcie_width == PCIE_LNK_WIDTH_UNKNOWN) |
12814 | pcie_width, pcie_speed); | 12792 | BNX2X_DEV_INFO("Failed to determine PCI Express Bandwidth\n"); |
12815 | 12793 | else | |
12816 | BNX2X_DEV_INFO("%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", | 12794 | BNX2X_DEV_INFO( |
12795 | "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", | ||
12817 | board_info[ent->driver_data].name, | 12796 | board_info[ent->driver_data].name, |
12818 | (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), | 12797 | (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), |
12819 | pcie_width, | 12798 | pcie_width, |
12820 | pcie_speed == BNX2X_PCI_LINK_SPEED_2500 ? "2.5GHz" : | 12799 | pcie_speed == PCIE_SPEED_2_5GT ? "2.5GHz" : |
12821 | pcie_speed == BNX2X_PCI_LINK_SPEED_5000 ? "5.0GHz" : | 12800 | pcie_speed == PCIE_SPEED_5_0GT ? "5.0GHz" : |
12822 | pcie_speed == BNX2X_PCI_LINK_SPEED_8000 ? "8.0GHz" : | 12801 | pcie_speed == PCIE_SPEED_8_0GT ? "8.0GHz" : |
12823 | "Unknown", | 12802 | "Unknown", |
12824 | dev->base_addr, bp->pdev->irq, dev->dev_addr); | 12803 | dev->base_addr, bp->pdev->irq, dev->dev_addr); |
12825 | 12804 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 9ad012bdd915..122703d8127e 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -2802,7 +2802,7 @@ struct set_vf_state_cookie { | |||
2802 | u8 state; | 2802 | u8 state; |
2803 | }; | 2803 | }; |
2804 | 2804 | ||
2805 | void bnx2x_set_vf_state(void *cookie) | 2805 | static void bnx2x_set_vf_state(void *cookie) |
2806 | { | 2806 | { |
2807 | struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie; | 2807 | struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie; |
2808 | 2808 | ||
@@ -3225,8 +3225,9 @@ void bnx2x_disable_sriov(struct bnx2x *bp) | |||
3225 | pci_disable_sriov(bp->pdev); | 3225 | pci_disable_sriov(bp->pdev); |
3226 | } | 3226 | } |
3227 | 3227 | ||
3228 | int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf, | 3228 | static int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, |
3229 | struct pf_vf_bulletin_content **bulletin) | 3229 | struct bnx2x_virtf **vf, |
3230 | struct pf_vf_bulletin_content **bulletin) | ||
3230 | { | 3231 | { |
3231 | if (bp->state != BNX2X_STATE_OPEN) { | 3232 | if (bp->state != BNX2X_STATE_OPEN) { |
3232 | BNX2X_ERR("vf ndo called though PF is down\n"); | 3233 | BNX2X_ERR("vf ndo called though PF is down\n"); |
@@ -3637,29 +3638,6 @@ alloc_mem_err: | |||
3637 | return -ENOMEM; | 3638 | return -ENOMEM; |
3638 | } | 3639 | } |
3639 | 3640 | ||
3640 | int bnx2x_open_epilog(struct bnx2x *bp) | ||
3641 | { | ||
3642 | /* Enable sriov via delayed work. This must be done via delayed work | ||
3643 | * because it causes the probe of the vf devices to be run, which invoke | ||
3644 | * register_netdevice which must have rtnl lock taken. As we are holding | ||
3645 | * the lock right now, that could only work if the probe would not take | ||
3646 | * the lock. However, as the probe of the vf may be called from other | ||
3647 | * contexts as well (such as passthrough to vm fails) it can't assume | ||
3648 | * the lock is being held for it. Using delayed work here allows the | ||
3649 | * probe code to simply take the lock (i.e. wait for it to be released | ||
3650 | * if it is being held). We only want to do this if the number of VFs | ||
3651 | * was set before PF driver was loaded. | ||
3652 | */ | ||
3653 | if (IS_SRIOV(bp) && BNX2X_NR_VIRTFN(bp)) { | ||
3654 | smp_mb__before_clear_bit(); | ||
3655 | set_bit(BNX2X_SP_RTNL_ENABLE_SRIOV, &bp->sp_rtnl_state); | ||
3656 | smp_mb__after_clear_bit(); | ||
3657 | schedule_delayed_work(&bp->sp_rtnl_task, 0); | ||
3658 | } | ||
3659 | |||
3660 | return 0; | ||
3661 | } | ||
3662 | |||
3663 | void bnx2x_iov_channel_down(struct bnx2x *bp) | 3641 | void bnx2x_iov_channel_down(struct bnx2x *bp) |
3664 | { | 3642 | { |
3665 | int vf_idx; | 3643 | int vf_idx; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h index 059f0d460af2..1ff6a9366629 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | |||
@@ -782,7 +782,6 @@ static inline int bnx2x_vf_headroom(struct bnx2x *bp) | |||
782 | void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp); | 782 | void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp); |
783 | int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs); | 783 | int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs); |
784 | void bnx2x_iov_channel_down(struct bnx2x *bp); | 784 | void bnx2x_iov_channel_down(struct bnx2x *bp); |
785 | int bnx2x_open_epilog(struct bnx2x *bp); | ||
786 | 785 | ||
787 | #else /* CONFIG_BNX2X_SRIOV */ | 786 | #else /* CONFIG_BNX2X_SRIOV */ |
788 | 787 | ||
@@ -842,7 +841,6 @@ static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; } | |||
842 | static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {} | 841 | static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {} |
843 | static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; } | 842 | static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; } |
844 | static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {} | 843 | static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {} |
845 | static inline int bnx2x_open_epilog(struct bnx2x *bp) {return 0; } | ||
846 | 844 | ||
847 | #endif /* CONFIG_BNX2X_SRIOV */ | 845 | #endif /* CONFIG_BNX2X_SRIOV */ |
848 | #endif /* bnx2x_sriov.h */ | 846 | #endif /* bnx2x_sriov.h */ |
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h b/drivers/net/ethernet/broadcom/cnic_if.h index 0658b43e148c..ebbfe25acaa6 100644 --- a/drivers/net/ethernet/broadcom/cnic_if.h +++ b/drivers/net/ethernet/broadcom/cnic_if.h | |||
@@ -353,8 +353,8 @@ struct cnic_ulp_ops { | |||
353 | atomic_t ref_count; | 353 | atomic_t ref_count; |
354 | }; | 354 | }; |
355 | 355 | ||
356 | extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); | 356 | int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); |
357 | 357 | ||
358 | extern int cnic_unregister_driver(int ulp_type); | 358 | int cnic_unregister_driver(int ulp_type); |
359 | 359 | ||
360 | #endif | 360 | #endif |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 12d961c4ebca..221a1815fd36 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
94 | 94 | ||
95 | #define DRV_MODULE_NAME "tg3" | 95 | #define DRV_MODULE_NAME "tg3" |
96 | #define TG3_MAJ_NUM 3 | 96 | #define TG3_MAJ_NUM 3 |
97 | #define TG3_MIN_NUM 133 | 97 | #define TG3_MIN_NUM 134 |
98 | #define DRV_MODULE_VERSION \ | 98 | #define DRV_MODULE_VERSION \ |
99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
100 | #define DRV_MODULE_RELDATE "Jul 29, 2013" | 100 | #define DRV_MODULE_RELDATE "Sep 16, 2013" |
101 | 101 | ||
102 | #define RESET_KIND_SHUTDOWN 0 | 102 | #define RESET_KIND_SHUTDOWN 0 |
103 | #define RESET_KIND_INIT 1 | 103 | #define RESET_KIND_INIT 1 |
@@ -337,6 +337,11 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = { | |||
337 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)}, | 337 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)}, |
338 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)}, | 338 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)}, |
339 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)}, | 339 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)}, |
340 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57764)}, | ||
341 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57767)}, | ||
342 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57787)}, | ||
343 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57782)}, | ||
344 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57786)}, | ||
340 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, | 345 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, |
341 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, | 346 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, |
342 | {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, | 347 | {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, |
@@ -1326,6 +1331,12 @@ static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable) | |||
1326 | return err; | 1331 | return err; |
1327 | } | 1332 | } |
1328 | 1333 | ||
1334 | static int tg3_phy_shdw_write(struct tg3 *tp, int reg, u32 val) | ||
1335 | { | ||
1336 | return tg3_writephy(tp, MII_TG3_MISC_SHDW, | ||
1337 | reg | val | MII_TG3_MISC_SHDW_WREN); | ||
1338 | } | ||
1339 | |||
1329 | static int tg3_bmcr_reset(struct tg3 *tp) | 1340 | static int tg3_bmcr_reset(struct tg3 *tp) |
1330 | { | 1341 | { |
1331 | u32 phy_control; | 1342 | u32 phy_control; |
@@ -2218,25 +2229,21 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable) | |||
2218 | return; | 2229 | return; |
2219 | } | 2230 | } |
2220 | 2231 | ||
2221 | reg = MII_TG3_MISC_SHDW_WREN | | 2232 | reg = MII_TG3_MISC_SHDW_SCR5_LPED | |
2222 | MII_TG3_MISC_SHDW_SCR5_SEL | | ||
2223 | MII_TG3_MISC_SHDW_SCR5_LPED | | ||
2224 | MII_TG3_MISC_SHDW_SCR5_DLPTLM | | 2233 | MII_TG3_MISC_SHDW_SCR5_DLPTLM | |
2225 | MII_TG3_MISC_SHDW_SCR5_SDTL | | 2234 | MII_TG3_MISC_SHDW_SCR5_SDTL | |
2226 | MII_TG3_MISC_SHDW_SCR5_C125OE; | 2235 | MII_TG3_MISC_SHDW_SCR5_C125OE; |
2227 | if (tg3_asic_rev(tp) != ASIC_REV_5784 || !enable) | 2236 | if (tg3_asic_rev(tp) != ASIC_REV_5784 || !enable) |
2228 | reg |= MII_TG3_MISC_SHDW_SCR5_DLLAPD; | 2237 | reg |= MII_TG3_MISC_SHDW_SCR5_DLLAPD; |
2229 | 2238 | ||
2230 | tg3_writephy(tp, MII_TG3_MISC_SHDW, reg); | 2239 | tg3_phy_shdw_write(tp, MII_TG3_MISC_SHDW_SCR5_SEL, reg); |
2231 | 2240 | ||
2232 | 2241 | ||
2233 | reg = MII_TG3_MISC_SHDW_WREN | | 2242 | reg = MII_TG3_MISC_SHDW_APD_WKTM_84MS; |
2234 | MII_TG3_MISC_SHDW_APD_SEL | | ||
2235 | MII_TG3_MISC_SHDW_APD_WKTM_84MS; | ||
2236 | if (enable) | 2243 | if (enable) |
2237 | reg |= MII_TG3_MISC_SHDW_APD_ENABLE; | 2244 | reg |= MII_TG3_MISC_SHDW_APD_ENABLE; |
2238 | 2245 | ||
2239 | tg3_writephy(tp, MII_TG3_MISC_SHDW, reg); | 2246 | tg3_phy_shdw_write(tp, MII_TG3_MISC_SHDW_APD_SEL, reg); |
2240 | } | 2247 | } |
2241 | 2248 | ||
2242 | static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable) | 2249 | static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable) |
@@ -9196,10 +9203,7 @@ static int tg3_halt(struct tg3 *tp, int kind, bool silent) | |||
9196 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); | 9203 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); |
9197 | } | 9204 | } |
9198 | 9205 | ||
9199 | if (err) | 9206 | return err; |
9200 | return err; | ||
9201 | |||
9202 | return 0; | ||
9203 | } | 9207 | } |
9204 | 9208 | ||
9205 | static int tg3_set_mac_addr(struct net_device *dev, void *p) | 9209 | static int tg3_set_mac_addr(struct net_device *dev, void *p) |
@@ -11035,7 +11039,18 @@ static int tg3_request_irq(struct tg3 *tp, int irq_num) | |||
11035 | name = tp->dev->name; | 11039 | name = tp->dev->name; |
11036 | else { | 11040 | else { |
11037 | name = &tnapi->irq_lbl[0]; | 11041 | name = &tnapi->irq_lbl[0]; |
11038 | snprintf(name, IFNAMSIZ, "%s-%d", tp->dev->name, irq_num); | 11042 | if (tnapi->tx_buffers && tnapi->rx_rcb) |
11043 | snprintf(name, IFNAMSIZ, | ||
11044 | "%s-txrx-%d", tp->dev->name, irq_num); | ||
11045 | else if (tnapi->tx_buffers) | ||
11046 | snprintf(name, IFNAMSIZ, | ||
11047 | "%s-tx-%d", tp->dev->name, irq_num); | ||
11048 | else if (tnapi->rx_rcb) | ||
11049 | snprintf(name, IFNAMSIZ, | ||
11050 | "%s-rx-%d", tp->dev->name, irq_num); | ||
11051 | else | ||
11052 | snprintf(name, IFNAMSIZ, | ||
11053 | "%s-%d", tp->dev->name, irq_num); | ||
11039 | name[IFNAMSIZ-1] = 0; | 11054 | name[IFNAMSIZ-1] = 0; |
11040 | } | 11055 | } |
11041 | 11056 | ||
@@ -12093,12 +12108,10 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
12093 | 12108 | ||
12094 | device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC); | 12109 | device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC); |
12095 | 12110 | ||
12096 | spin_lock_bh(&tp->lock); | ||
12097 | if (device_may_wakeup(dp)) | 12111 | if (device_may_wakeup(dp)) |
12098 | tg3_flag_set(tp, WOL_ENABLE); | 12112 | tg3_flag_set(tp, WOL_ENABLE); |
12099 | else | 12113 | else |
12100 | tg3_flag_clear(tp, WOL_ENABLE); | 12114 | tg3_flag_clear(tp, WOL_ENABLE); |
12101 | spin_unlock_bh(&tp->lock); | ||
12102 | 12115 | ||
12103 | return 0; | 12116 | return 0; |
12104 | } | 12117 | } |
@@ -14921,6 +14934,12 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
14921 | tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1) | 14934 | tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1) |
14922 | tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 | | 14935 | tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 | |
14923 | LED_CTRL_MODE_PHY_2); | 14936 | LED_CTRL_MODE_PHY_2); |
14937 | |||
14938 | if (tg3_flag(tp, 5717_PLUS) || | ||
14939 | tg3_asic_rev(tp) == ASIC_REV_5762) | ||
14940 | tp->led_ctrl |= LED_CTRL_BLINK_RATE_OVERRIDE | | ||
14941 | LED_CTRL_BLINK_RATE_MASK; | ||
14942 | |||
14924 | break; | 14943 | break; |
14925 | 14944 | ||
14926 | case SHASTA_EXT_LED_MAC: | 14945 | case SHASTA_EXT_LED_MAC: |
@@ -15759,9 +15778,12 @@ static void tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg) | |||
15759 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || | 15778 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || |
15760 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || | 15779 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || |
15761 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || | 15780 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || |
15781 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 || | ||
15782 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 || | ||
15762 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || | 15783 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || |
15763 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || | 15784 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || |
15764 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) | 15785 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 || |
15786 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) | ||
15765 | reg = TG3PCI_GEN2_PRODID_ASICREV; | 15787 | reg = TG3PCI_GEN2_PRODID_ASICREV; |
15766 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 || | 15788 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 || |
15767 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 || | 15789 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 || |
@@ -17052,10 +17074,6 @@ static int tg3_test_dma(struct tg3 *tp) | |||
17052 | 17074 | ||
17053 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); | 17075 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); |
17054 | 17076 | ||
17055 | #if 0 | ||
17056 | /* Unneeded, already done by tg3_get_invariants. */ | ||
17057 | tg3_switch_clocks(tp); | ||
17058 | #endif | ||
17059 | 17077 | ||
17060 | if (tg3_asic_rev(tp) != ASIC_REV_5700 && | 17078 | if (tg3_asic_rev(tp) != ASIC_REV_5700 && |
17061 | tg3_asic_rev(tp) != ASIC_REV_5701) | 17079 | tg3_asic_rev(tp) != ASIC_REV_5701) |
@@ -17083,20 +17101,6 @@ static int tg3_test_dma(struct tg3 *tp) | |||
17083 | break; | 17101 | break; |
17084 | } | 17102 | } |
17085 | 17103 | ||
17086 | #if 0 | ||
17087 | /* validate data reached card RAM correctly. */ | ||
17088 | for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) { | ||
17089 | u32 val; | ||
17090 | tg3_read_mem(tp, 0x2100 + (i*4), &val); | ||
17091 | if (le32_to_cpu(val) != p[i]) { | ||
17092 | dev_err(&tp->pdev->dev, | ||
17093 | "%s: Buffer corrupted on device! " | ||
17094 | "(%d != %d)\n", __func__, val, i); | ||
17095 | /* ret = -ENODEV here? */ | ||
17096 | } | ||
17097 | p[i] = 0; | ||
17098 | } | ||
17099 | #endif | ||
17100 | /* Now read it back. */ | 17104 | /* Now read it back. */ |
17101 | ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false); | 17105 | ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false); |
17102 | if (ret) { | 17106 | if (ret) { |
@@ -17409,9 +17413,12 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
17409 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || | 17413 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || |
17410 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || | 17414 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || |
17411 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || | 17415 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || |
17416 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 || | ||
17417 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 || | ||
17412 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || | 17418 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || |
17413 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || | 17419 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || |
17414 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) { | 17420 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 || |
17421 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) { | ||
17415 | tg3_flag_set(tp, ENABLE_APE); | 17422 | tg3_flag_set(tp, ENABLE_APE); |
17416 | tp->aperegs = pci_ioremap_bar(pdev, BAR_2); | 17423 | tp->aperegs = pci_ioremap_bar(pdev, BAR_2); |
17417 | if (!tp->aperegs) { | 17424 | if (!tp->aperegs) { |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 70257808aa37..5c3835aa1e1b 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -68,6 +68,9 @@ | |||
68 | #define TG3PCI_DEVICE_TIGON3_5762 0x1687 | 68 | #define TG3PCI_DEVICE_TIGON3_5762 0x1687 |
69 | #define TG3PCI_DEVICE_TIGON3_5725 0x1643 | 69 | #define TG3PCI_DEVICE_TIGON3_5725 0x1643 |
70 | #define TG3PCI_DEVICE_TIGON3_5727 0x16f3 | 70 | #define TG3PCI_DEVICE_TIGON3_5727 0x16f3 |
71 | #define TG3PCI_DEVICE_TIGON3_57764 0x1642 | ||
72 | #define TG3PCI_DEVICE_TIGON3_57767 0x1683 | ||
73 | #define TG3PCI_DEVICE_TIGON3_57787 0x1641 | ||
71 | /* 0x04 --> 0x2c unused */ | 74 | /* 0x04 --> 0x2c unused */ |
72 | #define TG3PCI_SUBVENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM | 75 | #define TG3PCI_SUBVENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM |
73 | #define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6 0x1644 | 76 | #define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6 0x1644 |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.h b/drivers/net/ethernet/brocade/bna/bnad.h index aefee77523f2..f7e033f8a00e 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.h +++ b/drivers/net/ethernet/brocade/bna/bnad.h | |||
@@ -372,38 +372,37 @@ extern u32 bnad_rxqs_per_cq; | |||
372 | /* | 372 | /* |
373 | * EXTERN PROTOTYPES | 373 | * EXTERN PROTOTYPES |
374 | */ | 374 | */ |
375 | extern u32 *cna_get_firmware_buf(struct pci_dev *pdev); | 375 | u32 *cna_get_firmware_buf(struct pci_dev *pdev); |
376 | /* Netdev entry point prototypes */ | 376 | /* Netdev entry point prototypes */ |
377 | extern void bnad_set_rx_mode(struct net_device *netdev); | 377 | void bnad_set_rx_mode(struct net_device *netdev); |
378 | extern struct net_device_stats *bnad_get_netdev_stats( | 378 | struct net_device_stats *bnad_get_netdev_stats(struct net_device *netdev); |
379 | struct net_device *netdev); | 379 | int bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr); |
380 | extern int bnad_mac_addr_set_locked(struct bnad *bnad, u8 *mac_addr); | 380 | int bnad_enable_default_bcast(struct bnad *bnad); |
381 | extern int bnad_enable_default_bcast(struct bnad *bnad); | 381 | void bnad_restore_vlans(struct bnad *bnad, u32 rx_id); |
382 | extern void bnad_restore_vlans(struct bnad *bnad, u32 rx_id); | 382 | void bnad_set_ethtool_ops(struct net_device *netdev); |
383 | extern void bnad_set_ethtool_ops(struct net_device *netdev); | 383 | void bnad_cb_completion(void *arg, enum bfa_status status); |
384 | extern void bnad_cb_completion(void *arg, enum bfa_status status); | ||
385 | 384 | ||
386 | /* Configuration & setup */ | 385 | /* Configuration & setup */ |
387 | extern void bnad_tx_coalescing_timeo_set(struct bnad *bnad); | 386 | void bnad_tx_coalescing_timeo_set(struct bnad *bnad); |
388 | extern void bnad_rx_coalescing_timeo_set(struct bnad *bnad); | 387 | void bnad_rx_coalescing_timeo_set(struct bnad *bnad); |
389 | 388 | ||
390 | extern int bnad_setup_rx(struct bnad *bnad, u32 rx_id); | 389 | int bnad_setup_rx(struct bnad *bnad, u32 rx_id); |
391 | extern int bnad_setup_tx(struct bnad *bnad, u32 tx_id); | 390 | int bnad_setup_tx(struct bnad *bnad, u32 tx_id); |
392 | extern void bnad_destroy_tx(struct bnad *bnad, u32 tx_id); | 391 | void bnad_destroy_tx(struct bnad *bnad, u32 tx_id); |
393 | extern void bnad_destroy_rx(struct bnad *bnad, u32 rx_id); | 392 | void bnad_destroy_rx(struct bnad *bnad, u32 rx_id); |
394 | 393 | ||
395 | /* Timer start/stop protos */ | 394 | /* Timer start/stop protos */ |
396 | extern void bnad_dim_timer_start(struct bnad *bnad); | 395 | void bnad_dim_timer_start(struct bnad *bnad); |
397 | 396 | ||
398 | /* Statistics */ | 397 | /* Statistics */ |
399 | extern void bnad_netdev_qstats_fill(struct bnad *bnad, | 398 | void bnad_netdev_qstats_fill(struct bnad *bnad, |
400 | struct rtnl_link_stats64 *stats); | 399 | struct rtnl_link_stats64 *stats); |
401 | extern void bnad_netdev_hwstats_fill(struct bnad *bnad, | 400 | void bnad_netdev_hwstats_fill(struct bnad *bnad, |
402 | struct rtnl_link_stats64 *stats); | 401 | struct rtnl_link_stats64 *stats); |
403 | 402 | ||
404 | /* Debugfs */ | 403 | /* Debugfs */ |
405 | void bnad_debugfs_init(struct bnad *bnad); | 404 | void bnad_debugfs_init(struct bnad *bnad); |
406 | void bnad_debugfs_uninit(struct bnad *bnad); | 405 | void bnad_debugfs_uninit(struct bnad *bnad); |
407 | 406 | ||
408 | /* MACROS */ | 407 | /* MACROS */ |
409 | /* To set & get the stats counters */ | 408 | /* To set & get the stats counters */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb/common.h b/drivers/net/ethernet/chelsio/cxgb/common.h index 5ccbed1784d2..8abb46b39032 100644 --- a/drivers/net/ethernet/chelsio/cxgb/common.h +++ b/drivers/net/ethernet/chelsio/cxgb/common.h | |||
@@ -324,30 +324,30 @@ static inline unsigned int core_ticks_per_usec(const adapter_t *adap) | |||
324 | return board_info(adap)->clock_core / 1000000; | 324 | return board_info(adap)->clock_core / 1000000; |
325 | } | 325 | } |
326 | 326 | ||
327 | extern int __t1_tpi_read(adapter_t *adapter, u32 addr, u32 *valp); | 327 | int __t1_tpi_read(adapter_t *adapter, u32 addr, u32 *valp); |
328 | extern int __t1_tpi_write(adapter_t *adapter, u32 addr, u32 value); | 328 | int __t1_tpi_write(adapter_t *adapter, u32 addr, u32 value); |
329 | extern int t1_tpi_write(adapter_t *adapter, u32 addr, u32 value); | 329 | int t1_tpi_write(adapter_t *adapter, u32 addr, u32 value); |
330 | extern int t1_tpi_read(adapter_t *adapter, u32 addr, u32 *value); | 330 | int t1_tpi_read(adapter_t *adapter, u32 addr, u32 *value); |
331 | 331 | ||
332 | extern void t1_interrupts_enable(adapter_t *adapter); | 332 | void t1_interrupts_enable(adapter_t *adapter); |
333 | extern void t1_interrupts_disable(adapter_t *adapter); | 333 | void t1_interrupts_disable(adapter_t *adapter); |
334 | extern void t1_interrupts_clear(adapter_t *adapter); | 334 | void t1_interrupts_clear(adapter_t *adapter); |
335 | extern int t1_elmer0_ext_intr_handler(adapter_t *adapter); | 335 | int t1_elmer0_ext_intr_handler(adapter_t *adapter); |
336 | extern void t1_elmer0_ext_intr(adapter_t *adapter); | 336 | void t1_elmer0_ext_intr(adapter_t *adapter); |
337 | extern int t1_slow_intr_handler(adapter_t *adapter); | 337 | int t1_slow_intr_handler(adapter_t *adapter); |
338 | 338 | ||
339 | extern int t1_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); | 339 | int t1_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); |
340 | extern const struct board_info *t1_get_board_info(unsigned int board_id); | 340 | const struct board_info *t1_get_board_info(unsigned int board_id); |
341 | extern const struct board_info *t1_get_board_info_from_ids(unsigned int devid, | 341 | const struct board_info *t1_get_board_info_from_ids(unsigned int devid, |
342 | unsigned short ssid); | 342 | unsigned short ssid); |
343 | extern int t1_seeprom_read(adapter_t *adapter, u32 addr, __le32 *data); | 343 | int t1_seeprom_read(adapter_t *adapter, u32 addr, __le32 *data); |
344 | extern int t1_get_board_rev(adapter_t *adapter, const struct board_info *bi, | 344 | int t1_get_board_rev(adapter_t *adapter, const struct board_info *bi, |
345 | struct adapter_params *p); | 345 | struct adapter_params *p); |
346 | extern int t1_init_hw_modules(adapter_t *adapter); | 346 | int t1_init_hw_modules(adapter_t *adapter); |
347 | extern int t1_init_sw_modules(adapter_t *adapter, const struct board_info *bi); | 347 | int t1_init_sw_modules(adapter_t *adapter, const struct board_info *bi); |
348 | extern void t1_free_sw_modules(adapter_t *adapter); | 348 | void t1_free_sw_modules(adapter_t *adapter); |
349 | extern void t1_fatal_err(adapter_t *adapter); | 349 | void t1_fatal_err(adapter_t *adapter); |
350 | extern void t1_link_changed(adapter_t *adapter, int port_id); | 350 | void t1_link_changed(adapter_t *adapter, int port_id); |
351 | extern void t1_link_negotiated(adapter_t *adapter, int port_id, int link_stat, | 351 | void t1_link_negotiated(adapter_t *adapter, int port_id, int link_stat, |
352 | int speed, int duplex, int pause); | 352 | int speed, int duplex, int pause); |
353 | #endif /* _CXGB_COMMON_H_ */ | 353 | #endif /* _CXGB_COMMON_H_ */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c73cabdbd4c0..85d0cda5fbfa 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3983,6 +3983,7 @@ static int cxgb4_inet6addr_handler(struct notifier_block *this, | |||
3983 | struct net_device *event_dev; | 3983 | struct net_device *event_dev; |
3984 | int ret = NOTIFY_DONE; | 3984 | int ret = NOTIFY_DONE; |
3985 | struct bonding *bond = netdev_priv(ifa->idev->dev); | 3985 | struct bonding *bond = netdev_priv(ifa->idev->dev); |
3986 | struct list_head *iter; | ||
3986 | struct slave *slave; | 3987 | struct slave *slave; |
3987 | struct pci_dev *first_pdev = NULL; | 3988 | struct pci_dev *first_pdev = NULL; |
3988 | 3989 | ||
@@ -3995,7 +3996,7 @@ static int cxgb4_inet6addr_handler(struct notifier_block *this, | |||
3995 | * in all of them only once. | 3996 | * in all of them only once. |
3996 | */ | 3997 | */ |
3997 | read_lock(&bond->lock); | 3998 | read_lock(&bond->lock); |
3998 | bond_for_each_slave(bond, slave) { | 3999 | bond_for_each_slave(bond, slave, iter) { |
3999 | if (!first_pdev) { | 4000 | if (!first_pdev) { |
4000 | ret = clip_add(slave->dev, ifa, event); | 4001 | ret = clip_add(slave->dev, ifa, event); |
4001 | /* If clip_add is success then only initialize | 4002 | /* If clip_add is success then only initialize |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index df296af20bd5..8475c4cda9e4 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -1396,8 +1396,9 @@ static inline void copy_frags(struct sk_buff *skb, | |||
1396 | * Builds an sk_buff from the given packet gather list. Returns the | 1396 | * Builds an sk_buff from the given packet gather list. Returns the |
1397 | * sk_buff or %NULL if sk_buff allocation failed. | 1397 | * sk_buff or %NULL if sk_buff allocation failed. |
1398 | */ | 1398 | */ |
1399 | struct sk_buff *t4vf_pktgl_to_skb(const struct pkt_gl *gl, | 1399 | static struct sk_buff *t4vf_pktgl_to_skb(const struct pkt_gl *gl, |
1400 | unsigned int skb_len, unsigned int pull_len) | 1400 | unsigned int skb_len, |
1401 | unsigned int pull_len) | ||
1401 | { | 1402 | { |
1402 | struct sk_buff *skb; | 1403 | struct sk_buff *skb; |
1403 | 1404 | ||
@@ -1443,7 +1444,7 @@ out: | |||
1443 | * Releases the pages of a packet gather list. We do not own the last | 1444 | * Releases the pages of a packet gather list. We do not own the last |
1444 | * page on the list and do not free it. | 1445 | * page on the list and do not free it. |
1445 | */ | 1446 | */ |
1446 | void t4vf_pktgl_free(const struct pkt_gl *gl) | 1447 | static void t4vf_pktgl_free(const struct pkt_gl *gl) |
1447 | { | 1448 | { |
1448 | int frag; | 1449 | int frag; |
1449 | 1450 | ||
@@ -1640,7 +1641,7 @@ static inline void rspq_next(struct sge_rspq *rspq) | |||
1640 | * on this queue. If the system is under memory shortage use a fairly | 1641 | * on this queue. If the system is under memory shortage use a fairly |
1641 | * long delay to help recovery. | 1642 | * long delay to help recovery. |
1642 | */ | 1643 | */ |
1643 | int process_responses(struct sge_rspq *rspq, int budget) | 1644 | static int process_responses(struct sge_rspq *rspq, int budget) |
1644 | { | 1645 | { |
1645 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); | 1646 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); |
1646 | int budget_left = budget; | 1647 | int budget_left = budget; |
@@ -1893,7 +1894,7 @@ static unsigned int process_intrq(struct adapter *adapter) | |||
1893 | * The MSI interrupt handler handles data events from SGE response queues as | 1894 | * The MSI interrupt handler handles data events from SGE response queues as |
1894 | * well as error and other async events as they all use the same MSI vector. | 1895 | * well as error and other async events as they all use the same MSI vector. |
1895 | */ | 1896 | */ |
1896 | irqreturn_t t4vf_intr_msi(int irq, void *cookie) | 1897 | static irqreturn_t t4vf_intr_msi(int irq, void *cookie) |
1897 | { | 1898 | { |
1898 | struct adapter *adapter = cookie; | 1899 | struct adapter *adapter = cookie; |
1899 | 1900 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index db020230bd0b..add6d7a953c6 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -89,7 +89,7 @@ static inline char *nic_name(struct pci_dev *pdev) | |||
89 | 89 | ||
90 | #define BE_NUM_VLANS_SUPPORTED 64 | 90 | #define BE_NUM_VLANS_SUPPORTED 64 |
91 | #define BE_UMC_NUM_VLANS_SUPPORTED 15 | 91 | #define BE_UMC_NUM_VLANS_SUPPORTED 15 |
92 | #define BE_MAX_EQD 96u | 92 | #define BE_MAX_EQD 128u |
93 | #define BE_MAX_TX_FRAG_COUNT 30 | 93 | #define BE_MAX_TX_FRAG_COUNT 30 |
94 | 94 | ||
95 | #define EVNT_Q_LEN 1024 | 95 | #define EVNT_Q_LEN 1024 |
@@ -201,6 +201,17 @@ struct be_eq_obj { | |||
201 | struct be_adapter *adapter; | 201 | struct be_adapter *adapter; |
202 | } ____cacheline_aligned_in_smp; | 202 | } ____cacheline_aligned_in_smp; |
203 | 203 | ||
204 | struct be_aic_obj { /* Adaptive interrupt coalescing (AIC) info */ | ||
205 | bool enable; | ||
206 | u32 min_eqd; /* in usecs */ | ||
207 | u32 max_eqd; /* in usecs */ | ||
208 | u32 prev_eqd; /* in usecs */ | ||
209 | u32 et_eqd; /* configured val when aic is off */ | ||
210 | ulong jiffies; | ||
211 | u64 rx_pkts_prev; /* Used to calculate RX pps */ | ||
212 | u64 tx_reqs_prev; /* Used to calculate TX pps */ | ||
213 | }; | ||
214 | |||
204 | struct be_mcc_obj { | 215 | struct be_mcc_obj { |
205 | struct be_queue_info q; | 216 | struct be_queue_info q; |
206 | struct be_queue_info cq; | 217 | struct be_queue_info cq; |
@@ -215,6 +226,7 @@ struct be_tx_stats { | |||
215 | u64 tx_compl; | 226 | u64 tx_compl; |
216 | ulong tx_jiffies; | 227 | ulong tx_jiffies; |
217 | u32 tx_stops; | 228 | u32 tx_stops; |
229 | u32 tx_drv_drops; /* pkts dropped by driver */ | ||
218 | struct u64_stats_sync sync; | 230 | struct u64_stats_sync sync; |
219 | struct u64_stats_sync sync_compl; | 231 | struct u64_stats_sync sync_compl; |
220 | }; | 232 | }; |
@@ -239,15 +251,12 @@ struct be_rx_page_info { | |||
239 | struct be_rx_stats { | 251 | struct be_rx_stats { |
240 | u64 rx_bytes; | 252 | u64 rx_bytes; |
241 | u64 rx_pkts; | 253 | u64 rx_pkts; |
242 | u64 rx_pkts_prev; | ||
243 | ulong rx_jiffies; | ||
244 | u32 rx_drops_no_skbs; /* skb allocation errors */ | 254 | u32 rx_drops_no_skbs; /* skb allocation errors */ |
245 | u32 rx_drops_no_frags; /* HW has no fetched frags */ | 255 | u32 rx_drops_no_frags; /* HW has no fetched frags */ |
246 | u32 rx_post_fail; /* page post alloc failures */ | 256 | u32 rx_post_fail; /* page post alloc failures */ |
247 | u32 rx_compl; | 257 | u32 rx_compl; |
248 | u32 rx_mcast_pkts; | 258 | u32 rx_mcast_pkts; |
249 | u32 rx_compl_err; /* completions with err set */ | 259 | u32 rx_compl_err; /* completions with err set */ |
250 | u32 rx_pps; /* pkts per second */ | ||
251 | struct u64_stats_sync sync; | 260 | struct u64_stats_sync sync; |
252 | }; | 261 | }; |
253 | 262 | ||
@@ -405,6 +414,7 @@ struct be_adapter { | |||
405 | u32 big_page_size; /* Compounded page size shared by rx wrbs */ | 414 | u32 big_page_size; /* Compounded page size shared by rx wrbs */ |
406 | 415 | ||
407 | struct be_drv_stats drv_stats; | 416 | struct be_drv_stats drv_stats; |
417 | struct be_aic_obj aic_obj[MAX_EVT_QS]; | ||
408 | u16 vlans_added; | 418 | u16 vlans_added; |
409 | u8 vlan_tag[VLAN_N_VID]; | 419 | u8 vlan_tag[VLAN_N_VID]; |
410 | u8 vlan_prio_bmap; /* Available Priority BitMap */ | 420 | u8 vlan_prio_bmap; /* Available Priority BitMap */ |
@@ -472,8 +482,8 @@ struct be_adapter { | |||
472 | 482 | ||
473 | #define be_physfn(adapter) (!adapter->virtfn) | 483 | #define be_physfn(adapter) (!adapter->virtfn) |
474 | #define sriov_enabled(adapter) (adapter->num_vfs > 0) | 484 | #define sriov_enabled(adapter) (adapter->num_vfs > 0) |
475 | #define sriov_want(adapter) (be_max_vfs(adapter) && num_vfs && \ | 485 | #define sriov_want(adapter) (be_physfn(adapter) && \ |
476 | be_physfn(adapter)) | 486 | (num_vfs || pci_num_vf(adapter->pdev))) |
477 | #define for_all_vfs(adapter, vf_cfg, i) \ | 487 | #define for_all_vfs(adapter, vf_cfg, i) \ |
478 | for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \ | 488 | for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \ |
479 | i++, vf_cfg++) | 489 | i++, vf_cfg++) |
@@ -696,27 +706,27 @@ static inline int qnq_async_evt_rcvd(struct be_adapter *adapter) | |||
696 | return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD; | 706 | return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD; |
697 | } | 707 | } |
698 | 708 | ||
699 | extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, | 709 | void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, |
700 | u16 num_popped); | 710 | u16 num_popped); |
701 | extern void be_link_status_update(struct be_adapter *adapter, u8 link_status); | 711 | void be_link_status_update(struct be_adapter *adapter, u8 link_status); |
702 | extern void be_parse_stats(struct be_adapter *adapter); | 712 | void be_parse_stats(struct be_adapter *adapter); |
703 | extern int be_load_fw(struct be_adapter *adapter, u8 *func); | 713 | int be_load_fw(struct be_adapter *adapter, u8 *func); |
704 | extern bool be_is_wol_supported(struct be_adapter *adapter); | 714 | bool be_is_wol_supported(struct be_adapter *adapter); |
705 | extern bool be_pause_supported(struct be_adapter *adapter); | 715 | bool be_pause_supported(struct be_adapter *adapter); |
706 | extern u32 be_get_fw_log_level(struct be_adapter *adapter); | 716 | u32 be_get_fw_log_level(struct be_adapter *adapter); |
707 | int be_update_queues(struct be_adapter *adapter); | 717 | int be_update_queues(struct be_adapter *adapter); |
708 | int be_poll(struct napi_struct *napi, int budget); | 718 | int be_poll(struct napi_struct *napi, int budget); |
709 | 719 | ||
710 | /* | 720 | /* |
711 | * internal function to initialize-cleanup roce device. | 721 | * internal function to initialize-cleanup roce device. |
712 | */ | 722 | */ |
713 | extern void be_roce_dev_add(struct be_adapter *); | 723 | void be_roce_dev_add(struct be_adapter *); |
714 | extern void be_roce_dev_remove(struct be_adapter *); | 724 | void be_roce_dev_remove(struct be_adapter *); |
715 | 725 | ||
716 | /* | 726 | /* |
717 | * internal function to open-close roce device during ifup-ifdown. | 727 | * internal function to open-close roce device during ifup-ifdown. |
718 | */ | 728 | */ |
719 | extern void be_roce_dev_open(struct be_adapter *); | 729 | void be_roce_dev_open(struct be_adapter *); |
720 | extern void be_roce_dev_close(struct be_adapter *); | 730 | void be_roce_dev_close(struct be_adapter *); |
721 | 731 | ||
722 | #endif /* BE_H */ | 732 | #endif /* BE_H */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index bd0e0c0bbcd8..787bce8c5246 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -1198,7 +1198,6 @@ int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo) | |||
1198 | 1198 | ||
1199 | if (lancer_chip(adapter)) { | 1199 | if (lancer_chip(adapter)) { |
1200 | req->hdr.version = 1; | 1200 | req->hdr.version = 1; |
1201 | req->if_id = cpu_to_le16(adapter->if_handle); | ||
1202 | } else if (BEx_chip(adapter)) { | 1201 | } else if (BEx_chip(adapter)) { |
1203 | if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) | 1202 | if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) |
1204 | req->hdr.version = 2; | 1203 | req->hdr.version = 2; |
@@ -1206,6 +1205,8 @@ int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo) | |||
1206 | req->hdr.version = 2; | 1205 | req->hdr.version = 2; |
1207 | } | 1206 | } |
1208 | 1207 | ||
1208 | if (req->hdr.version > 0) | ||
1209 | req->if_id = cpu_to_le16(adapter->if_handle); | ||
1209 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); | 1210 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); |
1210 | req->ulp_num = BE_ULP1_NUM; | 1211 | req->ulp_num = BE_ULP1_NUM; |
1211 | req->type = BE_ETH_TX_RING_TYPE_STANDARD; | 1212 | req->type = BE_ETH_TX_RING_TYPE_STANDARD; |
@@ -1718,11 +1719,12 @@ err: | |||
1718 | /* set the EQ delay interval of an EQ to specified value | 1719 | /* set the EQ delay interval of an EQ to specified value |
1719 | * Uses async mcc | 1720 | * Uses async mcc |
1720 | */ | 1721 | */ |
1721 | int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd) | 1722 | int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd, |
1723 | int num) | ||
1722 | { | 1724 | { |
1723 | struct be_mcc_wrb *wrb; | 1725 | struct be_mcc_wrb *wrb; |
1724 | struct be_cmd_req_modify_eq_delay *req; | 1726 | struct be_cmd_req_modify_eq_delay *req; |
1725 | int status = 0; | 1727 | int status = 0, i; |
1726 | 1728 | ||
1727 | spin_lock_bh(&adapter->mcc_lock); | 1729 | spin_lock_bh(&adapter->mcc_lock); |
1728 | 1730 | ||
@@ -1736,13 +1738,15 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd) | |||
1736 | be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, | 1738 | be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
1737 | OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req), wrb, NULL); | 1739 | OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req), wrb, NULL); |
1738 | 1740 | ||
1739 | req->num_eq = cpu_to_le32(1); | 1741 | req->num_eq = cpu_to_le32(num); |
1740 | req->delay[0].eq_id = cpu_to_le32(eq_id); | 1742 | for (i = 0; i < num; i++) { |
1741 | req->delay[0].phase = 0; | 1743 | req->set_eqd[i].eq_id = cpu_to_le32(set_eqd[i].eq_id); |
1742 | req->delay[0].delay_multiplier = cpu_to_le32(eqd); | 1744 | req->set_eqd[i].phase = 0; |
1745 | req->set_eqd[i].delay_multiplier = | ||
1746 | cpu_to_le32(set_eqd[i].delay_multiplier); | ||
1747 | } | ||
1743 | 1748 | ||
1744 | be_mcc_notify(adapter); | 1749 | be_mcc_notify(adapter); |
1745 | |||
1746 | err: | 1750 | err: |
1747 | spin_unlock_bh(&adapter->mcc_lock); | 1751 | spin_unlock_bh(&adapter->mcc_lock); |
1748 | return status; | 1752 | return status; |
@@ -3519,7 +3523,7 @@ int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain) | |||
3519 | struct be_cmd_enable_disable_vf *req; | 3523 | struct be_cmd_enable_disable_vf *req; |
3520 | int status; | 3524 | int status; |
3521 | 3525 | ||
3522 | if (!lancer_chip(adapter)) | 3526 | if (BEx_chip(adapter)) |
3523 | return 0; | 3527 | return 0; |
3524 | 3528 | ||
3525 | spin_lock_bh(&adapter->mcc_lock); | 3529 | spin_lock_bh(&adapter->mcc_lock); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 108ca8abf0af..337ef1f96f0b 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1057,14 +1057,16 @@ struct be_cmd_resp_get_flow_control { | |||
1057 | } __packed; | 1057 | } __packed; |
1058 | 1058 | ||
1059 | /******************** Modify EQ Delay *******************/ | 1059 | /******************** Modify EQ Delay *******************/ |
1060 | struct be_set_eqd { | ||
1061 | u32 eq_id; | ||
1062 | u32 phase; | ||
1063 | u32 delay_multiplier; | ||
1064 | }; | ||
1065 | |||
1060 | struct be_cmd_req_modify_eq_delay { | 1066 | struct be_cmd_req_modify_eq_delay { |
1061 | struct be_cmd_req_hdr hdr; | 1067 | struct be_cmd_req_hdr hdr; |
1062 | u32 num_eq; | 1068 | u32 num_eq; |
1063 | struct { | 1069 | struct be_set_eqd set_eqd[MAX_EVT_QS]; |
1064 | u32 eq_id; | ||
1065 | u32 phase; | ||
1066 | u32 delay_multiplier; | ||
1067 | } delay[8]; | ||
1068 | } __packed; | 1070 | } __packed; |
1069 | 1071 | ||
1070 | struct be_cmd_resp_modify_eq_delay { | 1072 | struct be_cmd_resp_modify_eq_delay { |
@@ -1865,137 +1867,120 @@ struct be_cmd_resp_get_iface_list { | |||
1865 | struct be_if_desc if_desc; | 1867 | struct be_if_desc if_desc; |
1866 | }; | 1868 | }; |
1867 | 1869 | ||
1868 | extern int be_pci_fnum_get(struct be_adapter *adapter); | 1870 | int be_pci_fnum_get(struct be_adapter *adapter); |
1869 | extern int be_fw_wait_ready(struct be_adapter *adapter); | 1871 | int be_fw_wait_ready(struct be_adapter *adapter); |
1870 | extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | 1872 | int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, |
1871 | bool permanent, u32 if_handle, u32 pmac_id); | 1873 | bool permanent, u32 if_handle, u32 pmac_id); |
1872 | extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, | 1874 | int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, u32 if_id, |
1873 | u32 if_id, u32 *pmac_id, u32 domain); | 1875 | u32 *pmac_id, u32 domain); |
1874 | extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, | 1876 | int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id, |
1875 | int pmac_id, u32 domain); | 1877 | u32 domain); |
1876 | extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, | 1878 | int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, |
1877 | u32 en_flags, u32 *if_handle, u32 domain); | 1879 | u32 *if_handle, u32 domain); |
1878 | extern int be_cmd_if_destroy(struct be_adapter *adapter, int if_handle, | 1880 | int be_cmd_if_destroy(struct be_adapter *adapter, int if_handle, u32 domain); |
1879 | u32 domain); | 1881 | int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo); |
1880 | extern int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo); | 1882 | int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, |
1881 | extern int be_cmd_cq_create(struct be_adapter *adapter, | 1883 | struct be_queue_info *eq, bool no_delay, |
1882 | struct be_queue_info *cq, struct be_queue_info *eq, | 1884 | int num_cqe_dma_coalesce); |
1883 | bool no_delay, int num_cqe_dma_coalesce); | 1885 | int be_cmd_mccq_create(struct be_adapter *adapter, struct be_queue_info *mccq, |
1884 | extern int be_cmd_mccq_create(struct be_adapter *adapter, | 1886 | struct be_queue_info *cq); |
1885 | struct be_queue_info *mccq, | 1887 | int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo); |
1886 | struct be_queue_info *cq); | 1888 | int be_cmd_rxq_create(struct be_adapter *adapter, struct be_queue_info *rxq, |
1887 | extern int be_cmd_txq_create(struct be_adapter *adapter, | 1889 | u16 cq_id, u16 frag_size, u32 if_id, u32 rss, u8 *rss_id); |
1888 | struct be_tx_obj *txo); | 1890 | int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, |
1889 | extern int be_cmd_rxq_create(struct be_adapter *adapter, | 1891 | int type); |
1890 | struct be_queue_info *rxq, u16 cq_id, | 1892 | int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q); |
1891 | u16 frag_size, u32 if_id, u32 rss, u8 *rss_id); | 1893 | int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed, |
1892 | extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, | 1894 | u8 *link_status, u32 dom); |
1893 | int type); | 1895 | int be_cmd_reset(struct be_adapter *adapter); |
1894 | extern int be_cmd_rxq_destroy(struct be_adapter *adapter, | 1896 | int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd); |
1895 | struct be_queue_info *q); | 1897 | int lancer_cmd_get_pport_stats(struct be_adapter *adapter, |
1896 | extern int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed, | 1898 | struct be_dma_mem *nonemb_cmd); |
1897 | u8 *link_status, u32 dom); | 1899 | int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, |
1898 | extern int be_cmd_reset(struct be_adapter *adapter); | 1900 | char *fw_on_flash); |
1899 | extern int be_cmd_get_stats(struct be_adapter *adapter, | 1901 | int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num); |
1900 | struct be_dma_mem *nonemb_cmd); | 1902 | int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, |
1901 | extern int lancer_cmd_get_pport_stats(struct be_adapter *adapter, | 1903 | u32 num, bool untagged, bool promiscuous); |
1902 | struct be_dma_mem *nonemb_cmd); | 1904 | int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); |
1903 | extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, | 1905 | int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); |
1904 | char *fw_on_flash); | 1906 | int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc); |
1905 | 1907 | int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, | |
1906 | extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd); | ||
1907 | extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, | ||
1908 | u16 *vtag_array, u32 num, bool untagged, | ||
1909 | bool promiscuous); | ||
1910 | extern int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); | ||
1911 | extern int be_cmd_set_flow_control(struct be_adapter *adapter, | ||
1912 | u32 tx_fc, u32 rx_fc); | ||
1913 | extern int be_cmd_get_flow_control(struct be_adapter *adapter, | ||
1914 | u32 *tx_fc, u32 *rx_fc); | ||
1915 | extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, | ||
1916 | u32 *function_mode, u32 *function_caps, u16 *asic_rev); | 1908 | u32 *function_mode, u32 *function_caps, u16 *asic_rev); |
1917 | extern int be_cmd_reset_function(struct be_adapter *adapter); | 1909 | int be_cmd_reset_function(struct be_adapter *adapter); |
1918 | extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, | 1910 | int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, |
1919 | u32 rss_hash_opts, u16 table_size); | 1911 | u32 rss_hash_opts, u16 table_size); |
1920 | extern int be_process_mcc(struct be_adapter *adapter); | 1912 | int be_process_mcc(struct be_adapter *adapter); |
1921 | extern int be_cmd_set_beacon_state(struct be_adapter *adapter, | 1913 | int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon, |
1922 | u8 port_num, u8 beacon, u8 status, u8 state); | 1914 | u8 status, u8 state); |
1923 | extern int be_cmd_get_beacon_state(struct be_adapter *adapter, | 1915 | int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, |
1924 | u8 port_num, u32 *state); | 1916 | u32 *state); |
1925 | extern int be_cmd_write_flashrom(struct be_adapter *adapter, | 1917 | int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, |
1926 | struct be_dma_mem *cmd, u32 flash_oper, | 1918 | u32 flash_oper, u32 flash_opcode, u32 buf_size); |
1927 | u32 flash_opcode, u32 buf_size); | 1919 | int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, |
1928 | extern int lancer_cmd_write_object(struct be_adapter *adapter, | 1920 | u32 data_size, u32 data_offset, |
1929 | struct be_dma_mem *cmd, | 1921 | const char *obj_name, u32 *data_written, |
1930 | u32 data_size, u32 data_offset, | 1922 | u8 *change_status, u8 *addn_status); |
1931 | const char *obj_name, | ||
1932 | u32 *data_written, u8 *change_status, | ||
1933 | u8 *addn_status); | ||
1934 | int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, | 1923 | int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, |
1935 | u32 data_size, u32 data_offset, const char *obj_name, | 1924 | u32 data_size, u32 data_offset, const char *obj_name, |
1936 | u32 *data_read, u32 *eof, u8 *addn_status); | 1925 | u32 *data_read, u32 *eof, u8 *addn_status); |
1937 | int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, | 1926 | int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, |
1938 | int offset); | 1927 | int offset); |
1939 | extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, | 1928 | int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, |
1940 | struct be_dma_mem *nonemb_cmd); | 1929 | struct be_dma_mem *nonemb_cmd); |
1941 | extern int be_cmd_fw_init(struct be_adapter *adapter); | 1930 | int be_cmd_fw_init(struct be_adapter *adapter); |
1942 | extern int be_cmd_fw_clean(struct be_adapter *adapter); | 1931 | int be_cmd_fw_clean(struct be_adapter *adapter); |
1943 | extern void be_async_mcc_enable(struct be_adapter *adapter); | 1932 | void be_async_mcc_enable(struct be_adapter *adapter); |
1944 | extern void be_async_mcc_disable(struct be_adapter *adapter); | 1933 | void be_async_mcc_disable(struct be_adapter *adapter); |
1945 | extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | 1934 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, |
1946 | u32 loopback_type, u32 pkt_size, | 1935 | u32 loopback_type, u32 pkt_size, u32 num_pkts, |
1947 | u32 num_pkts, u64 pattern); | 1936 | u64 pattern); |
1948 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, | 1937 | int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, u32 byte_cnt, |
1949 | u32 byte_cnt, struct be_dma_mem *cmd); | 1938 | struct be_dma_mem *cmd); |
1950 | extern int be_cmd_get_seeprom_data(struct be_adapter *adapter, | 1939 | int be_cmd_get_seeprom_data(struct be_adapter *adapter, |
1951 | struct be_dma_mem *nonemb_cmd); | 1940 | struct be_dma_mem *nonemb_cmd); |
1952 | extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | 1941 | int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, |
1953 | u8 loopback_type, u8 enable); | 1942 | u8 loopback_type, u8 enable); |
1954 | extern int be_cmd_get_phy_info(struct be_adapter *adapter); | 1943 | int be_cmd_get_phy_info(struct be_adapter *adapter); |
1955 | extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); | 1944 | int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); |
1956 | extern void be_detect_error(struct be_adapter *adapter); | 1945 | void be_detect_error(struct be_adapter *adapter); |
1957 | extern int be_cmd_get_die_temperature(struct be_adapter *adapter); | 1946 | int be_cmd_get_die_temperature(struct be_adapter *adapter); |
1958 | extern int be_cmd_get_cntl_attributes(struct be_adapter *adapter); | 1947 | int be_cmd_get_cntl_attributes(struct be_adapter *adapter); |
1959 | extern int be_cmd_req_native_mode(struct be_adapter *adapter); | 1948 | int be_cmd_req_native_mode(struct be_adapter *adapter); |
1960 | extern int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size); | 1949 | int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size); |
1961 | extern void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf); | 1950 | void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf); |
1962 | extern int be_cmd_get_fn_privileges(struct be_adapter *adapter, | 1951 | int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege, |
1963 | u32 *privilege, u32 domain); | 1952 | u32 domain); |
1964 | extern int be_cmd_set_fn_privileges(struct be_adapter *adapter, | 1953 | int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges, |
1965 | u32 privileges, u32 vf_num); | 1954 | u32 vf_num); |
1966 | extern int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, | 1955 | int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, |
1967 | bool *pmac_id_active, u32 *pmac_id, | 1956 | bool *pmac_id_active, u32 *pmac_id, u8 domain); |
1968 | u8 domain); | 1957 | int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac); |
1969 | extern int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, | 1958 | int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac); |
1970 | u8 *mac); | 1959 | int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, u8 mac_count, |
1971 | extern int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac); | 1960 | u32 domain); |
1972 | extern int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, | 1961 | int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom); |
1973 | u8 mac_count, u32 domain); | 1962 | int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, u32 domain, |
1974 | extern int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, | 1963 | u16 intf_id, u16 hsw_mode); |
1975 | u32 dom); | 1964 | int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, u32 domain, |
1976 | extern int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, | 1965 | u16 intf_id, u8 *mode); |
1977 | u32 domain, u16 intf_id, u16 hsw_mode); | 1966 | int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter); |
1978 | extern int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, | 1967 | int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter, |
1979 | u32 domain, u16 intf_id, u8 *mode); | 1968 | struct be_dma_mem *cmd); |
1980 | extern int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter); | 1969 | int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter, |
1981 | extern int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter, | 1970 | struct be_dma_mem *cmd, |
1982 | struct be_dma_mem *cmd); | 1971 | struct be_fat_conf_params *cfgs); |
1983 | extern int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter, | 1972 | int lancer_wait_ready(struct be_adapter *adapter); |
1984 | struct be_dma_mem *cmd, | 1973 | int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask); |
1985 | struct be_fat_conf_params *cfgs); | 1974 | int lancer_initiate_dump(struct be_adapter *adapter); |
1986 | extern int lancer_wait_ready(struct be_adapter *adapter); | 1975 | bool dump_present(struct be_adapter *adapter); |
1987 | extern int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask); | 1976 | int lancer_test_and_set_rdy_state(struct be_adapter *adapter); |
1988 | extern int lancer_initiate_dump(struct be_adapter *adapter); | 1977 | int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name); |
1989 | extern bool dump_present(struct be_adapter *adapter); | ||
1990 | extern int lancer_test_and_set_rdy_state(struct be_adapter *adapter); | ||
1991 | extern int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name); | ||
1992 | int be_cmd_get_func_config(struct be_adapter *adapter, | 1978 | int be_cmd_get_func_config(struct be_adapter *adapter, |
1993 | struct be_resources *res); | 1979 | struct be_resources *res); |
1994 | int be_cmd_get_profile_config(struct be_adapter *adapter, | 1980 | int be_cmd_get_profile_config(struct be_adapter *adapter, |
1995 | struct be_resources *res, u8 domain); | 1981 | struct be_resources *res, u8 domain); |
1996 | extern int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps, | 1982 | int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps, u8 domain); |
1997 | u8 domain); | 1983 | int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg, |
1998 | extern int be_cmd_get_if_id(struct be_adapter *adapter, | 1984 | int vf_num); |
1999 | struct be_vf_cfg *vf_cfg, int vf_num); | 1985 | int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain); |
2000 | extern int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain); | 1986 | int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable); |
2001 | extern int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable); | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index b440a1fac77b..3dcf817e756d 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -155,7 +155,9 @@ static const struct be_ethtool_stat et_tx_stats[] = { | |||
155 | /* Number of times the TX queue was stopped due to lack | 155 | /* Number of times the TX queue was stopped due to lack |
156 | * of spaces in the TXQ. | 156 | * of spaces in the TXQ. |
157 | */ | 157 | */ |
158 | {DRVSTAT_TX_INFO(tx_stops)} | 158 | {DRVSTAT_TX_INFO(tx_stops)}, |
159 | /* Pkts dropped in the driver's transmit path */ | ||
160 | {DRVSTAT_TX_INFO(tx_drv_drops)} | ||
159 | }; | 161 | }; |
160 | #define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats)) | 162 | #define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats)) |
161 | 163 | ||
@@ -290,19 +292,19 @@ static int be_get_coalesce(struct net_device *netdev, | |||
290 | struct ethtool_coalesce *et) | 292 | struct ethtool_coalesce *et) |
291 | { | 293 | { |
292 | struct be_adapter *adapter = netdev_priv(netdev); | 294 | struct be_adapter *adapter = netdev_priv(netdev); |
293 | struct be_eq_obj *eqo = &adapter->eq_obj[0]; | 295 | struct be_aic_obj *aic = &adapter->aic_obj[0]; |
294 | 296 | ||
295 | 297 | ||
296 | et->rx_coalesce_usecs = eqo->cur_eqd; | 298 | et->rx_coalesce_usecs = aic->prev_eqd; |
297 | et->rx_coalesce_usecs_high = eqo->max_eqd; | 299 | et->rx_coalesce_usecs_high = aic->max_eqd; |
298 | et->rx_coalesce_usecs_low = eqo->min_eqd; | 300 | et->rx_coalesce_usecs_low = aic->min_eqd; |
299 | 301 | ||
300 | et->tx_coalesce_usecs = eqo->cur_eqd; | 302 | et->tx_coalesce_usecs = aic->prev_eqd; |
301 | et->tx_coalesce_usecs_high = eqo->max_eqd; | 303 | et->tx_coalesce_usecs_high = aic->max_eqd; |
302 | et->tx_coalesce_usecs_low = eqo->min_eqd; | 304 | et->tx_coalesce_usecs_low = aic->min_eqd; |
303 | 305 | ||
304 | et->use_adaptive_rx_coalesce = eqo->enable_aic; | 306 | et->use_adaptive_rx_coalesce = aic->enable; |
305 | et->use_adaptive_tx_coalesce = eqo->enable_aic; | 307 | et->use_adaptive_tx_coalesce = aic->enable; |
306 | 308 | ||
307 | return 0; | 309 | return 0; |
308 | } | 310 | } |
@@ -314,14 +316,17 @@ static int be_set_coalesce(struct net_device *netdev, | |||
314 | struct ethtool_coalesce *et) | 316 | struct ethtool_coalesce *et) |
315 | { | 317 | { |
316 | struct be_adapter *adapter = netdev_priv(netdev); | 318 | struct be_adapter *adapter = netdev_priv(netdev); |
319 | struct be_aic_obj *aic = &adapter->aic_obj[0]; | ||
317 | struct be_eq_obj *eqo; | 320 | struct be_eq_obj *eqo; |
318 | int i; | 321 | int i; |
319 | 322 | ||
320 | for_all_evt_queues(adapter, eqo, i) { | 323 | for_all_evt_queues(adapter, eqo, i) { |
321 | eqo->enable_aic = et->use_adaptive_rx_coalesce; | 324 | aic->enable = et->use_adaptive_rx_coalesce; |
322 | eqo->max_eqd = min(et->rx_coalesce_usecs_high, BE_MAX_EQD); | 325 | aic->max_eqd = min(et->rx_coalesce_usecs_high, BE_MAX_EQD); |
323 | eqo->min_eqd = min(et->rx_coalesce_usecs_low, eqo->max_eqd); | 326 | aic->min_eqd = min(et->rx_coalesce_usecs_low, aic->max_eqd); |
324 | eqo->eqd = et->rx_coalesce_usecs; | 327 | aic->et_eqd = min(et->rx_coalesce_usecs, aic->max_eqd); |
328 | aic->et_eqd = max(aic->et_eqd, aic->min_eqd); | ||
329 | aic++; | ||
325 | } | 330 | } |
326 | 331 | ||
327 | return 0; | 332 | return 0; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 2c38cc402119..9daee2e8db04 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -935,8 +935,10 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
935 | u32 start = txq->head; | 935 | u32 start = txq->head; |
936 | 936 | ||
937 | skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan); | 937 | skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan); |
938 | if (!skb) | 938 | if (!skb) { |
939 | tx_stats(txo)->tx_drv_drops++; | ||
939 | return NETDEV_TX_OK; | 940 | return NETDEV_TX_OK; |
941 | } | ||
940 | 942 | ||
941 | wrb_cnt = wrb_cnt_for_skb(adapter, skb, &dummy_wrb); | 943 | wrb_cnt = wrb_cnt_for_skb(adapter, skb, &dummy_wrb); |
942 | 944 | ||
@@ -965,6 +967,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
965 | be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped); | 967 | be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped); |
966 | } else { | 968 | } else { |
967 | txq->head = start; | 969 | txq->head = start; |
970 | tx_stats(txo)->tx_drv_drops++; | ||
968 | dev_kfree_skb_any(skb); | 971 | dev_kfree_skb_any(skb); |
969 | } | 972 | } |
970 | return NETDEV_TX_OK; | 973 | return NETDEV_TX_OK; |
@@ -1275,53 +1278,79 @@ static int be_set_vf_tx_rate(struct net_device *netdev, | |||
1275 | return status; | 1278 | return status; |
1276 | } | 1279 | } |
1277 | 1280 | ||
1278 | static void be_eqd_update(struct be_adapter *adapter, struct be_eq_obj *eqo) | 1281 | static void be_aic_update(struct be_aic_obj *aic, u64 rx_pkts, u64 tx_pkts, |
1282 | ulong now) | ||
1279 | { | 1283 | { |
1280 | struct be_rx_stats *stats = rx_stats(&adapter->rx_obj[eqo->idx]); | 1284 | aic->rx_pkts_prev = rx_pkts; |
1281 | ulong now = jiffies; | 1285 | aic->tx_reqs_prev = tx_pkts; |
1282 | ulong delta = now - stats->rx_jiffies; | 1286 | aic->jiffies = now; |
1283 | u64 pkts; | 1287 | } |
1284 | unsigned int start, eqd; | ||
1285 | 1288 | ||
1286 | if (!eqo->enable_aic) { | 1289 | static void be_eqd_update(struct be_adapter *adapter) |
1287 | eqd = eqo->eqd; | 1290 | { |
1288 | goto modify_eqd; | 1291 | struct be_set_eqd set_eqd[MAX_EVT_QS]; |
1289 | } | 1292 | int eqd, i, num = 0, start; |
1293 | struct be_aic_obj *aic; | ||
1294 | struct be_eq_obj *eqo; | ||
1295 | struct be_rx_obj *rxo; | ||
1296 | struct be_tx_obj *txo; | ||
1297 | u64 rx_pkts, tx_pkts; | ||
1298 | ulong now; | ||
1299 | u32 pps, delta; | ||
1290 | 1300 | ||
1291 | if (eqo->idx >= adapter->num_rx_qs) | 1301 | for_all_evt_queues(adapter, eqo, i) { |
1292 | return; | 1302 | aic = &adapter->aic_obj[eqo->idx]; |
1303 | if (!aic->enable) { | ||
1304 | if (aic->jiffies) | ||
1305 | aic->jiffies = 0; | ||
1306 | eqd = aic->et_eqd; | ||
1307 | goto modify_eqd; | ||
1308 | } | ||
1293 | 1309 | ||
1294 | stats = rx_stats(&adapter->rx_obj[eqo->idx]); | 1310 | rxo = &adapter->rx_obj[eqo->idx]; |
1311 | do { | ||
1312 | start = u64_stats_fetch_begin_bh(&rxo->stats.sync); | ||
1313 | rx_pkts = rxo->stats.rx_pkts; | ||
1314 | } while (u64_stats_fetch_retry_bh(&rxo->stats.sync, start)); | ||
1295 | 1315 | ||
1296 | /* Wrapped around */ | 1316 | txo = &adapter->tx_obj[eqo->idx]; |
1297 | if (time_before(now, stats->rx_jiffies)) { | 1317 | do { |
1298 | stats->rx_jiffies = now; | 1318 | start = u64_stats_fetch_begin_bh(&txo->stats.sync); |
1299 | return; | 1319 | tx_pkts = txo->stats.tx_reqs; |
1300 | } | 1320 | } while (u64_stats_fetch_retry_bh(&txo->stats.sync, start)); |
1301 | 1321 | ||
1302 | /* Update once a second */ | ||
1303 | if (delta < HZ) | ||
1304 | return; | ||
1305 | 1322 | ||
1306 | do { | 1323 | /* Skip, if wrapped around or first calculation */ |
1307 | start = u64_stats_fetch_begin_bh(&stats->sync); | 1324 | now = jiffies; |
1308 | pkts = stats->rx_pkts; | 1325 | if (!aic->jiffies || time_before(now, aic->jiffies) || |
1309 | } while (u64_stats_fetch_retry_bh(&stats->sync, start)); | 1326 | rx_pkts < aic->rx_pkts_prev || |
1310 | 1327 | tx_pkts < aic->tx_reqs_prev) { | |
1311 | stats->rx_pps = (unsigned long)(pkts - stats->rx_pkts_prev) / (delta / HZ); | 1328 | be_aic_update(aic, rx_pkts, tx_pkts, now); |
1312 | stats->rx_pkts_prev = pkts; | 1329 | continue; |
1313 | stats->rx_jiffies = now; | 1330 | } |
1314 | eqd = (stats->rx_pps / 110000) << 3; | 1331 | |
1315 | eqd = min(eqd, eqo->max_eqd); | 1332 | delta = jiffies_to_msecs(now - aic->jiffies); |
1316 | eqd = max(eqd, eqo->min_eqd); | 1333 | pps = (((u32)(rx_pkts - aic->rx_pkts_prev) * 1000) / delta) + |
1317 | if (eqd < 10) | 1334 | (((u32)(tx_pkts - aic->tx_reqs_prev) * 1000) / delta); |
1318 | eqd = 0; | 1335 | eqd = (pps / 15000) << 2; |
1336 | |||
1337 | if (eqd < 8) | ||
1338 | eqd = 0; | ||
1339 | eqd = min_t(u32, eqd, aic->max_eqd); | ||
1340 | eqd = max_t(u32, eqd, aic->min_eqd); | ||
1319 | 1341 | ||
1342 | be_aic_update(aic, rx_pkts, tx_pkts, now); | ||
1320 | modify_eqd: | 1343 | modify_eqd: |
1321 | if (eqd != eqo->cur_eqd) { | 1344 | if (eqd != aic->prev_eqd) { |
1322 | be_cmd_modify_eqd(adapter, eqo->q.id, eqd); | 1345 | set_eqd[num].delay_multiplier = (eqd * 65)/100; |
1323 | eqo->cur_eqd = eqd; | 1346 | set_eqd[num].eq_id = eqo->q.id; |
1347 | aic->prev_eqd = eqd; | ||
1348 | num++; | ||
1349 | } | ||
1324 | } | 1350 | } |
1351 | |||
1352 | if (num) | ||
1353 | be_cmd_modify_eqd(adapter, set_eqd, num); | ||
1325 | } | 1354 | } |
1326 | 1355 | ||
1327 | static void be_rx_stats_update(struct be_rx_obj *rxo, | 1356 | static void be_rx_stats_update(struct be_rx_obj *rxo, |
@@ -1938,6 +1967,7 @@ static int be_evt_queues_create(struct be_adapter *adapter) | |||
1938 | { | 1967 | { |
1939 | struct be_queue_info *eq; | 1968 | struct be_queue_info *eq; |
1940 | struct be_eq_obj *eqo; | 1969 | struct be_eq_obj *eqo; |
1970 | struct be_aic_obj *aic; | ||
1941 | int i, rc; | 1971 | int i, rc; |
1942 | 1972 | ||
1943 | adapter->num_evt_qs = min_t(u16, num_irqs(adapter), | 1973 | adapter->num_evt_qs = min_t(u16, num_irqs(adapter), |
@@ -1946,11 +1976,12 @@ static int be_evt_queues_create(struct be_adapter *adapter) | |||
1946 | for_all_evt_queues(adapter, eqo, i) { | 1976 | for_all_evt_queues(adapter, eqo, i) { |
1947 | netif_napi_add(adapter->netdev, &eqo->napi, be_poll, | 1977 | netif_napi_add(adapter->netdev, &eqo->napi, be_poll, |
1948 | BE_NAPI_WEIGHT); | 1978 | BE_NAPI_WEIGHT); |
1979 | aic = &adapter->aic_obj[i]; | ||
1949 | eqo->adapter = adapter; | 1980 | eqo->adapter = adapter; |
1950 | eqo->tx_budget = BE_TX_BUDGET; | 1981 | eqo->tx_budget = BE_TX_BUDGET; |
1951 | eqo->idx = i; | 1982 | eqo->idx = i; |
1952 | eqo->max_eqd = BE_MAX_EQD; | 1983 | aic->max_eqd = BE_MAX_EQD; |
1953 | eqo->enable_aic = true; | 1984 | aic->enable = true; |
1954 | 1985 | ||
1955 | eq = &eqo->q; | 1986 | eq = &eqo->q; |
1956 | rc = be_queue_alloc(adapter, eq, EVNT_Q_LEN, | 1987 | rc = be_queue_alloc(adapter, eq, EVNT_Q_LEN, |
@@ -2937,7 +2968,8 @@ static int be_vf_setup(struct be_adapter *adapter) | |||
2937 | goto err; | 2968 | goto err; |
2938 | vf_cfg->def_vid = def_vlan; | 2969 | vf_cfg->def_vid = def_vlan; |
2939 | 2970 | ||
2940 | be_cmd_enable_vf(adapter, vf + 1); | 2971 | if (!old_vfs) |
2972 | be_cmd_enable_vf(adapter, vf + 1); | ||
2941 | } | 2973 | } |
2942 | 2974 | ||
2943 | if (!old_vfs) { | 2975 | if (!old_vfs) { |
@@ -2962,12 +2994,12 @@ static void BEx_get_resources(struct be_adapter *adapter, | |||
2962 | struct pci_dev *pdev = adapter->pdev; | 2994 | struct pci_dev *pdev = adapter->pdev; |
2963 | bool use_sriov = false; | 2995 | bool use_sriov = false; |
2964 | 2996 | ||
2965 | if (BE3_chip(adapter) && be_physfn(adapter)) { | 2997 | if (BE3_chip(adapter) && sriov_want(adapter)) { |
2966 | int max_vfs; | 2998 | int max_vfs; |
2967 | 2999 | ||
2968 | max_vfs = pci_sriov_get_totalvfs(pdev); | 3000 | max_vfs = pci_sriov_get_totalvfs(pdev); |
2969 | res->max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0; | 3001 | res->max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0; |
2970 | use_sriov = res->max_vfs && num_vfs; | 3002 | use_sriov = res->max_vfs; |
2971 | } | 3003 | } |
2972 | 3004 | ||
2973 | if (be_physfn(adapter)) | 3005 | if (be_physfn(adapter)) |
@@ -2983,8 +3015,9 @@ static void BEx_get_resources(struct be_adapter *adapter, | |||
2983 | res->max_vlans = BE_NUM_VLANS_SUPPORTED; | 3015 | res->max_vlans = BE_NUM_VLANS_SUPPORTED; |
2984 | res->max_mcast_mac = BE_MAX_MC; | 3016 | res->max_mcast_mac = BE_MAX_MC; |
2985 | 3017 | ||
3018 | /* For BE3 1Gb ports, F/W does not properly support multiple TXQs */ | ||
2986 | if (BE2_chip(adapter) || use_sriov || be_is_mc(adapter) || | 3019 | if (BE2_chip(adapter) || use_sriov || be_is_mc(adapter) || |
2987 | !be_physfn(adapter)) | 3020 | !be_physfn(adapter) || (adapter->port_num > 1)) |
2988 | res->max_tx_qs = 1; | 3021 | res->max_tx_qs = 1; |
2989 | else | 3022 | else |
2990 | res->max_tx_qs = BE3_MAX_TX_QS; | 3023 | res->max_tx_qs = BE3_MAX_TX_QS; |
@@ -3026,14 +3059,6 @@ static int be_get_resources(struct be_adapter *adapter) | |||
3026 | adapter->res = res; | 3059 | adapter->res = res; |
3027 | } | 3060 | } |
3028 | 3061 | ||
3029 | /* For BE3 only check if FW suggests a different max-txqs value */ | ||
3030 | if (BE3_chip(adapter)) { | ||
3031 | status = be_cmd_get_profile_config(adapter, &res, 0); | ||
3032 | if (!status && res.max_tx_qs) | ||
3033 | adapter->res.max_tx_qs = | ||
3034 | min(adapter->res.max_tx_qs, res.max_tx_qs); | ||
3035 | } | ||
3036 | |||
3037 | /* For Lancer, SH etc read per-function resource limits from FW. | 3062 | /* For Lancer, SH etc read per-function resource limits from FW. |
3038 | * GET_FUNC_CONFIG returns per function guaranteed limits. | 3063 | * GET_FUNC_CONFIG returns per function guaranteed limits. |
3039 | * GET_PROFILE_CONFIG returns PCI-E related limits PF-pool limits | 3064 | * GET_PROFILE_CONFIG returns PCI-E related limits PF-pool limits |
@@ -3258,7 +3283,7 @@ static int be_setup(struct be_adapter *adapter) | |||
3258 | be_cmd_set_flow_control(adapter, adapter->tx_fc, | 3283 | be_cmd_set_flow_control(adapter, adapter->tx_fc, |
3259 | adapter->rx_fc); | 3284 | adapter->rx_fc); |
3260 | 3285 | ||
3261 | if (be_physfn(adapter) && num_vfs) { | 3286 | if (sriov_want(adapter)) { |
3262 | if (be_max_vfs(adapter)) | 3287 | if (be_max_vfs(adapter)) |
3263 | be_vf_setup(adapter); | 3288 | be_vf_setup(adapter); |
3264 | else | 3289 | else |
@@ -4262,7 +4287,6 @@ static void be_worker(struct work_struct *work) | |||
4262 | struct be_adapter *adapter = | 4287 | struct be_adapter *adapter = |
4263 | container_of(work, struct be_adapter, work.work); | 4288 | container_of(work, struct be_adapter, work.work); |
4264 | struct be_rx_obj *rxo; | 4289 | struct be_rx_obj *rxo; |
4265 | struct be_eq_obj *eqo; | ||
4266 | int i; | 4290 | int i; |
4267 | 4291 | ||
4268 | /* when interrupts are not yet enabled, just reap any pending | 4292 | /* when interrupts are not yet enabled, just reap any pending |
@@ -4293,8 +4317,7 @@ static void be_worker(struct work_struct *work) | |||
4293 | } | 4317 | } |
4294 | } | 4318 | } |
4295 | 4319 | ||
4296 | for_all_evt_queues(adapter, eqo, i) | 4320 | be_eqd_update(adapter); |
4297 | be_eqd_update(adapter, eqo); | ||
4298 | 4321 | ||
4299 | reschedule: | 4322 | reschedule: |
4300 | adapter->work_counter++; | 4323 | adapter->work_counter++; |
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h index 04112b98ff5d..114c58f9d8d2 100644 --- a/drivers/net/ethernet/freescale/gianfar.h +++ b/drivers/net/ethernet/freescale/gianfar.h | |||
@@ -1177,21 +1177,21 @@ static inline void gfar_read_filer(struct gfar_private *priv, | |||
1177 | *fpr = gfar_read(®s->rqfpr); | 1177 | *fpr = gfar_read(®s->rqfpr); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | extern void lock_rx_qs(struct gfar_private *priv); | 1180 | void lock_rx_qs(struct gfar_private *priv); |
1181 | extern void lock_tx_qs(struct gfar_private *priv); | 1181 | void lock_tx_qs(struct gfar_private *priv); |
1182 | extern void unlock_rx_qs(struct gfar_private *priv); | 1182 | void unlock_rx_qs(struct gfar_private *priv); |
1183 | extern void unlock_tx_qs(struct gfar_private *priv); | 1183 | void unlock_tx_qs(struct gfar_private *priv); |
1184 | extern irqreturn_t gfar_receive(int irq, void *dev_id); | 1184 | irqreturn_t gfar_receive(int irq, void *dev_id); |
1185 | extern int startup_gfar(struct net_device *dev); | 1185 | int startup_gfar(struct net_device *dev); |
1186 | extern void stop_gfar(struct net_device *dev); | 1186 | void stop_gfar(struct net_device *dev); |
1187 | extern void gfar_halt(struct net_device *dev); | 1187 | void gfar_halt(struct net_device *dev); |
1188 | extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, | 1188 | void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, int enable, |
1189 | int enable, u32 regnum, u32 read); | 1189 | u32 regnum, u32 read); |
1190 | extern void gfar_configure_coalescing_all(struct gfar_private *priv); | 1190 | void gfar_configure_coalescing_all(struct gfar_private *priv); |
1191 | void gfar_init_sysfs(struct net_device *dev); | 1191 | void gfar_init_sysfs(struct net_device *dev); |
1192 | int gfar_set_features(struct net_device *dev, netdev_features_t features); | 1192 | int gfar_set_features(struct net_device *dev, netdev_features_t features); |
1193 | extern void gfar_check_rx_parser_mode(struct gfar_private *priv); | 1193 | void gfar_check_rx_parser_mode(struct gfar_private *priv); |
1194 | extern void gfar_vlan_mode(struct net_device *dev, netdev_features_t features); | 1194 | void gfar_vlan_mode(struct net_device *dev, netdev_features_t features); |
1195 | 1195 | ||
1196 | extern const struct ethtool_ops gfar_ethtool_ops; | 1196 | extern const struct ethtool_ops gfar_ethtool_ops; |
1197 | 1197 | ||
diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c index 91227d03274e..37860096f744 100644 --- a/drivers/net/ethernet/hp/hp100.c +++ b/drivers/net/ethernet/hp/hp100.c | |||
@@ -1098,7 +1098,7 @@ static int hp100_open(struct net_device *dev) | |||
1098 | if (request_irq(dev->irq, hp100_interrupt, | 1098 | if (request_irq(dev->irq, hp100_interrupt, |
1099 | lp->bus == HP100_BUS_PCI || lp->bus == | 1099 | lp->bus == HP100_BUS_PCI || lp->bus == |
1100 | HP100_BUS_EISA ? IRQF_SHARED : 0, | 1100 | HP100_BUS_EISA ? IRQF_SHARED : 0, |
1101 | "hp100", dev)) { | 1101 | dev->name, dev)) { |
1102 | printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); | 1102 | printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); |
1103 | return -EAGAIN; | 1103 | return -EAGAIN; |
1104 | } | 1104 | } |
diff --git a/drivers/net/ethernet/ibm/emac/debug.h b/drivers/net/ethernet/ibm/emac/debug.h index 59a92d5870b5..9c45efe4c8fe 100644 --- a/drivers/net/ethernet/ibm/emac/debug.h +++ b/drivers/net/ethernet/ibm/emac/debug.h | |||
@@ -29,13 +29,13 @@ | |||
29 | struct emac_instance; | 29 | struct emac_instance; |
30 | struct mal_instance; | 30 | struct mal_instance; |
31 | 31 | ||
32 | extern void emac_dbg_register(struct emac_instance *dev); | 32 | void emac_dbg_register(struct emac_instance *dev); |
33 | extern void emac_dbg_unregister(struct emac_instance *dev); | 33 | void emac_dbg_unregister(struct emac_instance *dev); |
34 | extern void mal_dbg_register(struct mal_instance *mal); | 34 | void mal_dbg_register(struct mal_instance *mal); |
35 | extern void mal_dbg_unregister(struct mal_instance *mal); | 35 | void mal_dbg_unregister(struct mal_instance *mal); |
36 | extern int emac_init_debug(void) __init; | 36 | int emac_init_debug(void) __init; |
37 | extern void emac_fini_debug(void) __exit; | 37 | void emac_fini_debug(void) __exit; |
38 | extern void emac_dbg_dump_all(void); | 38 | void emac_dbg_dump_all(void); |
39 | 39 | ||
40 | # define DBG_LEVEL 1 | 40 | # define DBG_LEVEL 1 |
41 | 41 | ||
diff --git a/drivers/net/ethernet/ibm/emac/rgmii.h b/drivers/net/ethernet/ibm/emac/rgmii.h index 668bceeff4a2..d4f1374d1900 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.h +++ b/drivers/net/ethernet/ibm/emac/rgmii.h | |||
@@ -56,15 +56,15 @@ struct rgmii_instance { | |||
56 | 56 | ||
57 | #ifdef CONFIG_IBM_EMAC_RGMII | 57 | #ifdef CONFIG_IBM_EMAC_RGMII |
58 | 58 | ||
59 | extern int rgmii_init(void); | 59 | int rgmii_init(void); |
60 | extern void rgmii_exit(void); | 60 | void rgmii_exit(void); |
61 | extern int rgmii_attach(struct platform_device *ofdev, int input, int mode); | 61 | int rgmii_attach(struct platform_device *ofdev, int input, int mode); |
62 | extern void rgmii_detach(struct platform_device *ofdev, int input); | 62 | void rgmii_detach(struct platform_device *ofdev, int input); |
63 | extern void rgmii_get_mdio(struct platform_device *ofdev, int input); | 63 | void rgmii_get_mdio(struct platform_device *ofdev, int input); |
64 | extern void rgmii_put_mdio(struct platform_device *ofdev, int input); | 64 | void rgmii_put_mdio(struct platform_device *ofdev, int input); |
65 | extern void rgmii_set_speed(struct platform_device *ofdev, int input, int speed); | 65 | void rgmii_set_speed(struct platform_device *ofdev, int input, int speed); |
66 | extern int rgmii_get_regs_len(struct platform_device *ofdev); | 66 | int rgmii_get_regs_len(struct platform_device *ofdev); |
67 | extern void *rgmii_dump_regs(struct platform_device *ofdev, void *buf); | 67 | void *rgmii_dump_regs(struct platform_device *ofdev, void *buf); |
68 | 68 | ||
69 | #else | 69 | #else |
70 | 70 | ||
diff --git a/drivers/net/ethernet/ibm/emac/tah.h b/drivers/net/ethernet/ibm/emac/tah.h index 350b7096a041..4d5f336f07b3 100644 --- a/drivers/net/ethernet/ibm/emac/tah.h +++ b/drivers/net/ethernet/ibm/emac/tah.h | |||
@@ -72,13 +72,13 @@ struct tah_instance { | |||
72 | 72 | ||
73 | #ifdef CONFIG_IBM_EMAC_TAH | 73 | #ifdef CONFIG_IBM_EMAC_TAH |
74 | 74 | ||
75 | extern int tah_init(void); | 75 | int tah_init(void); |
76 | extern void tah_exit(void); | 76 | void tah_exit(void); |
77 | extern int tah_attach(struct platform_device *ofdev, int channel); | 77 | int tah_attach(struct platform_device *ofdev, int channel); |
78 | extern void tah_detach(struct platform_device *ofdev, int channel); | 78 | void tah_detach(struct platform_device *ofdev, int channel); |
79 | extern void tah_reset(struct platform_device *ofdev); | 79 | void tah_reset(struct platform_device *ofdev); |
80 | extern int tah_get_regs_len(struct platform_device *ofdev); | 80 | int tah_get_regs_len(struct platform_device *ofdev); |
81 | extern void *tah_dump_regs(struct platform_device *ofdev, void *buf); | 81 | void *tah_dump_regs(struct platform_device *ofdev, void *buf); |
82 | 82 | ||
83 | #else | 83 | #else |
84 | 84 | ||
diff --git a/drivers/net/ethernet/ibm/emac/zmii.h b/drivers/net/ethernet/ibm/emac/zmii.h index 455bfb085493..0959c55b1459 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.h +++ b/drivers/net/ethernet/ibm/emac/zmii.h | |||
@@ -53,15 +53,15 @@ struct zmii_instance { | |||
53 | 53 | ||
54 | #ifdef CONFIG_IBM_EMAC_ZMII | 54 | #ifdef CONFIG_IBM_EMAC_ZMII |
55 | 55 | ||
56 | extern int zmii_init(void); | 56 | int zmii_init(void); |
57 | extern void zmii_exit(void); | 57 | void zmii_exit(void); |
58 | extern int zmii_attach(struct platform_device *ofdev, int input, int *mode); | 58 | int zmii_attach(struct platform_device *ofdev, int input, int *mode); |
59 | extern void zmii_detach(struct platform_device *ofdev, int input); | 59 | void zmii_detach(struct platform_device *ofdev, int input); |
60 | extern void zmii_get_mdio(struct platform_device *ofdev, int input); | 60 | void zmii_get_mdio(struct platform_device *ofdev, int input); |
61 | extern void zmii_put_mdio(struct platform_device *ofdev, int input); | 61 | void zmii_put_mdio(struct platform_device *ofdev, int input); |
62 | extern void zmii_set_speed(struct platform_device *ofdev, int input, int speed); | 62 | void zmii_set_speed(struct platform_device *ofdev, int input, int speed); |
63 | extern int zmii_get_regs_len(struct platform_device *ocpdev); | 63 | int zmii_get_regs_len(struct platform_device *ocpdev); |
64 | extern void *zmii_dump_regs(struct platform_device *ofdev, void *buf); | 64 | void *zmii_dump_regs(struct platform_device *ofdev, void *buf); |
65 | 65 | ||
66 | #else | 66 | #else |
67 | # define zmii_init() 0 | 67 | # define zmii_init() 0 |
diff --git a/drivers/net/ethernet/intel/e1000/e1000.h b/drivers/net/ethernet/intel/e1000/e1000.h index 26d9cd59ec75..58c147271a36 100644 --- a/drivers/net/ethernet/intel/e1000/e1000.h +++ b/drivers/net/ethernet/intel/e1000/e1000.h | |||
@@ -325,7 +325,7 @@ enum e1000_state_t { | |||
325 | #undef pr_fmt | 325 | #undef pr_fmt |
326 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 326 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
327 | 327 | ||
328 | extern struct net_device *e1000_get_hw_dev(struct e1000_hw *hw); | 328 | struct net_device *e1000_get_hw_dev(struct e1000_hw *hw); |
329 | #define e_dbg(format, arg...) \ | 329 | #define e_dbg(format, arg...) \ |
330 | netdev_dbg(e1000_get_hw_dev(hw), format, ## arg) | 330 | netdev_dbg(e1000_get_hw_dev(hw), format, ## arg) |
331 | #define e_err(msglvl, format, arg...) \ | 331 | #define e_err(msglvl, format, arg...) \ |
@@ -346,20 +346,20 @@ extern struct net_device *e1000_get_hw_dev(struct e1000_hw *hw); | |||
346 | extern char e1000_driver_name[]; | 346 | extern char e1000_driver_name[]; |
347 | extern const char e1000_driver_version[]; | 347 | extern const char e1000_driver_version[]; |
348 | 348 | ||
349 | extern int e1000_up(struct e1000_adapter *adapter); | 349 | int e1000_up(struct e1000_adapter *adapter); |
350 | extern void e1000_down(struct e1000_adapter *adapter); | 350 | void e1000_down(struct e1000_adapter *adapter); |
351 | extern void e1000_reinit_locked(struct e1000_adapter *adapter); | 351 | void e1000_reinit_locked(struct e1000_adapter *adapter); |
352 | extern void e1000_reset(struct e1000_adapter *adapter); | 352 | void e1000_reset(struct e1000_adapter *adapter); |
353 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx); | 353 | int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx); |
354 | extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); | 354 | int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); |
355 | extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); | 355 | int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); |
356 | extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter); | 356 | void e1000_free_all_rx_resources(struct e1000_adapter *adapter); |
357 | extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter); | 357 | void e1000_free_all_tx_resources(struct e1000_adapter *adapter); |
358 | extern void e1000_update_stats(struct e1000_adapter *adapter); | 358 | void e1000_update_stats(struct e1000_adapter *adapter); |
359 | extern bool e1000_has_link(struct e1000_adapter *adapter); | 359 | bool e1000_has_link(struct e1000_adapter *adapter); |
360 | extern void e1000_power_up_phy(struct e1000_adapter *); | 360 | void e1000_power_up_phy(struct e1000_adapter *); |
361 | extern void e1000_set_ethtool_ops(struct net_device *netdev); | 361 | void e1000_set_ethtool_ops(struct net_device *netdev); |
362 | extern void e1000_check_options(struct e1000_adapter *adapter); | 362 | void e1000_check_options(struct e1000_adapter *adapter); |
363 | extern char *e1000_get_hw_dev_name(struct e1000_hw *hw); | 363 | char *e1000_get_hw_dev_name(struct e1000_hw *hw); |
364 | 364 | ||
365 | #endif /* _E1000_H_ */ | 365 | #endif /* _E1000_H_ */ |
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h index ad0edd11015d..0150f7fc893d 100644 --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | |||
@@ -472,26 +472,25 @@ enum latency_range { | |||
472 | extern char e1000e_driver_name[]; | 472 | extern char e1000e_driver_name[]; |
473 | extern const char e1000e_driver_version[]; | 473 | extern const char e1000e_driver_version[]; |
474 | 474 | ||
475 | extern void e1000e_check_options(struct e1000_adapter *adapter); | 475 | void e1000e_check_options(struct e1000_adapter *adapter); |
476 | extern void e1000e_set_ethtool_ops(struct net_device *netdev); | 476 | void e1000e_set_ethtool_ops(struct net_device *netdev); |
477 | 477 | ||
478 | extern int e1000e_up(struct e1000_adapter *adapter); | 478 | int e1000e_up(struct e1000_adapter *adapter); |
479 | extern void e1000e_down(struct e1000_adapter *adapter); | 479 | void e1000e_down(struct e1000_adapter *adapter); |
480 | extern void e1000e_reinit_locked(struct e1000_adapter *adapter); | 480 | void e1000e_reinit_locked(struct e1000_adapter *adapter); |
481 | extern void e1000e_reset(struct e1000_adapter *adapter); | 481 | void e1000e_reset(struct e1000_adapter *adapter); |
482 | extern void e1000e_power_up_phy(struct e1000_adapter *adapter); | 482 | void e1000e_power_up_phy(struct e1000_adapter *adapter); |
483 | extern int e1000e_setup_rx_resources(struct e1000_ring *ring); | 483 | int e1000e_setup_rx_resources(struct e1000_ring *ring); |
484 | extern int e1000e_setup_tx_resources(struct e1000_ring *ring); | 484 | int e1000e_setup_tx_resources(struct e1000_ring *ring); |
485 | extern void e1000e_free_rx_resources(struct e1000_ring *ring); | 485 | void e1000e_free_rx_resources(struct e1000_ring *ring); |
486 | extern void e1000e_free_tx_resources(struct e1000_ring *ring); | 486 | void e1000e_free_tx_resources(struct e1000_ring *ring); |
487 | extern struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, | 487 | struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, |
488 | struct rtnl_link_stats64 | 488 | struct rtnl_link_stats64 *stats); |
489 | *stats); | 489 | void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); |
490 | extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); | 490 | void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); |
491 | extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); | 491 | void e1000e_get_hw_control(struct e1000_adapter *adapter); |
492 | extern void e1000e_get_hw_control(struct e1000_adapter *adapter); | 492 | void e1000e_release_hw_control(struct e1000_adapter *adapter); |
493 | extern void e1000e_release_hw_control(struct e1000_adapter *adapter); | 493 | void e1000e_write_itr(struct e1000_adapter *adapter, u32 itr); |
494 | extern void e1000e_write_itr(struct e1000_adapter *adapter, u32 itr); | ||
495 | 494 | ||
496 | extern unsigned int copybreak; | 495 | extern unsigned int copybreak; |
497 | 496 | ||
@@ -508,8 +507,8 @@ extern const struct e1000_info e1000_pch2_info; | |||
508 | extern const struct e1000_info e1000_pch_lpt_info; | 507 | extern const struct e1000_info e1000_pch_lpt_info; |
509 | extern const struct e1000_info e1000_es2_info; | 508 | extern const struct e1000_info e1000_es2_info; |
510 | 509 | ||
511 | extern void e1000e_ptp_init(struct e1000_adapter *adapter); | 510 | void e1000e_ptp_init(struct e1000_adapter *adapter); |
512 | extern void e1000e_ptp_remove(struct e1000_adapter *adapter); | 511 | void e1000e_ptp_remove(struct e1000_adapter *adapter); |
513 | 512 | ||
514 | static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw) | 513 | static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw) |
515 | { | 514 | { |
@@ -536,7 +535,7 @@ static inline s32 e1e_wphy_locked(struct e1000_hw *hw, u32 offset, u16 data) | |||
536 | return hw->phy.ops.write_reg_locked(hw, offset, data); | 535 | return hw->phy.ops.write_reg_locked(hw, offset, data); |
537 | } | 536 | } |
538 | 537 | ||
539 | extern void e1000e_reload_nvm_generic(struct e1000_hw *hw); | 538 | void e1000e_reload_nvm_generic(struct e1000_hw *hw); |
540 | 539 | ||
541 | static inline s32 e1000e_read_mac_addr(struct e1000_hw *hw) | 540 | static inline s32 e1000e_read_mac_addr(struct e1000_hw *hw) |
542 | { | 541 | { |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h index 74a1506b4235..8c2437722aad 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.h +++ b/drivers/net/ethernet/intel/igb/e1000_82575.h | |||
@@ -28,14 +28,14 @@ | |||
28 | #ifndef _E1000_82575_H_ | 28 | #ifndef _E1000_82575_H_ |
29 | #define _E1000_82575_H_ | 29 | #define _E1000_82575_H_ |
30 | 30 | ||
31 | extern void igb_shutdown_serdes_link_82575(struct e1000_hw *hw); | 31 | void igb_shutdown_serdes_link_82575(struct e1000_hw *hw); |
32 | extern void igb_power_up_serdes_link_82575(struct e1000_hw *hw); | 32 | void igb_power_up_serdes_link_82575(struct e1000_hw *hw); |
33 | extern void igb_power_down_phy_copper_82575(struct e1000_hw *hw); | 33 | void igb_power_down_phy_copper_82575(struct e1000_hw *hw); |
34 | extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw); | 34 | void igb_rx_fifo_flush_82575(struct e1000_hw *hw); |
35 | extern s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, | 35 | s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, u8 dev_addr, |
36 | u8 dev_addr, u8 *data); | 36 | u8 *data); |
37 | extern s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset, | 37 | s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset, u8 dev_addr, |
38 | u8 dev_addr, u8 data); | 38 | u8 data); |
39 | 39 | ||
40 | #define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \ | 40 | #define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \ |
41 | (ID_LED_DEF1_DEF2 << 8) | \ | 41 | (ID_LED_DEF1_DEF2 << 8) | \ |
diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h index 37a9c06a6c68..2e166b22d52b 100644 --- a/drivers/net/ethernet/intel/igb/e1000_hw.h +++ b/drivers/net/ethernet/intel/igb/e1000_hw.h | |||
@@ -562,11 +562,11 @@ struct e1000_hw { | |||
562 | u8 revision_id; | 562 | u8 revision_id; |
563 | }; | 563 | }; |
564 | 564 | ||
565 | extern struct net_device *igb_get_hw_dev(struct e1000_hw *hw); | 565 | struct net_device *igb_get_hw_dev(struct e1000_hw *hw); |
566 | #define hw_dbg(format, arg...) \ | 566 | #define hw_dbg(format, arg...) \ |
567 | netdev_dbg(igb_get_hw_dev(hw), format, ##arg) | 567 | netdev_dbg(igb_get_hw_dev(hw), format, ##arg) |
568 | 568 | ||
569 | /* These functions must be implemented by drivers */ | 569 | /* These functions must be implemented by drivers */ |
570 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); | 570 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); |
571 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); | 571 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); |
572 | #endif /* _E1000_HW_H_ */ | 572 | #endif /* _E1000_HW_H_ */ |
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.h b/drivers/net/ethernet/intel/igb/e1000_i210.h index dde3c4b7ea99..2d913716573a 100644 --- a/drivers/net/ethernet/intel/igb/e1000_i210.h +++ b/drivers/net/ethernet/intel/igb/e1000_i210.h | |||
@@ -28,26 +28,24 @@ | |||
28 | #ifndef _E1000_I210_H_ | 28 | #ifndef _E1000_I210_H_ |
29 | #define _E1000_I210_H_ | 29 | #define _E1000_I210_H_ |
30 | 30 | ||
31 | extern s32 igb_update_flash_i210(struct e1000_hw *hw); | 31 | s32 igb_update_flash_i210(struct e1000_hw *hw); |
32 | extern s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw); | 32 | s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw); |
33 | extern s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw); | 33 | s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw); |
34 | extern s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, | 34 | s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, |
35 | u16 words, u16 *data); | 35 | u16 *data); |
36 | extern s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, | 36 | s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, |
37 | u16 words, u16 *data); | 37 | u16 *data); |
38 | extern s32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask); | 38 | s32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask); |
39 | extern void igb_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask); | 39 | void igb_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask); |
40 | extern s32 igb_acquire_nvm_i210(struct e1000_hw *hw); | 40 | s32 igb_acquire_nvm_i210(struct e1000_hw *hw); |
41 | extern void igb_release_nvm_i210(struct e1000_hw *hw); | 41 | void igb_release_nvm_i210(struct e1000_hw *hw); |
42 | extern s32 igb_valid_led_default_i210(struct e1000_hw *hw, u16 *data); | 42 | s32 igb_valid_led_default_i210(struct e1000_hw *hw, u16 *data); |
43 | extern s32 igb_read_invm_version(struct e1000_hw *hw, | 43 | s32 igb_read_invm_version(struct e1000_hw *hw, |
44 | struct e1000_fw_version *invm_ver); | 44 | struct e1000_fw_version *invm_ver); |
45 | extern s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, | 45 | s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data); |
46 | u16 *data); | 46 | s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data); |
47 | extern s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, | 47 | s32 igb_init_nvm_params_i210(struct e1000_hw *hw); |
48 | u16 data); | 48 | bool igb_get_flash_presence_i210(struct e1000_hw *hw); |
49 | extern s32 igb_init_nvm_params_i210(struct e1000_hw *hw); | ||
50 | extern bool igb_get_flash_presence_i210(struct e1000_hw *hw); | ||
51 | 49 | ||
52 | #define E1000_STM_OPCODE 0xDB00 | 50 | #define E1000_STM_OPCODE 0xDB00 |
53 | #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 | 51 | #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 |
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.h b/drivers/net/ethernet/intel/igb/e1000_mac.h index 5e13e83cc608..e4cbe8ef67b3 100644 --- a/drivers/net/ethernet/intel/igb/e1000_mac.h +++ b/drivers/net/ethernet/intel/igb/e1000_mac.h | |||
@@ -86,6 +86,6 @@ enum e1000_mng_mode { | |||
86 | 86 | ||
87 | #define E1000_MNG_DHCP_COOKIE_STATUS_VLAN 0x2 | 87 | #define E1000_MNG_DHCP_COOKIE_STATUS_VLAN 0x2 |
88 | 88 | ||
89 | extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); | 89 | void e1000_init_function_pointers_82575(struct e1000_hw *hw); |
90 | 90 | ||
91 | #endif | 91 | #endif |
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 6807b098edae..5e9ed89403aa 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -483,40 +483,38 @@ enum igb_boards { | |||
483 | extern char igb_driver_name[]; | 483 | extern char igb_driver_name[]; |
484 | extern char igb_driver_version[]; | 484 | extern char igb_driver_version[]; |
485 | 485 | ||
486 | extern int igb_up(struct igb_adapter *); | 486 | int igb_up(struct igb_adapter *); |
487 | extern void igb_down(struct igb_adapter *); | 487 | void igb_down(struct igb_adapter *); |
488 | extern void igb_reinit_locked(struct igb_adapter *); | 488 | void igb_reinit_locked(struct igb_adapter *); |
489 | extern void igb_reset(struct igb_adapter *); | 489 | void igb_reset(struct igb_adapter *); |
490 | extern void igb_write_rss_indir_tbl(struct igb_adapter *); | 490 | int igb_reinit_queues(struct igb_adapter *); |
491 | extern int igb_set_spd_dplx(struct igb_adapter *, u32, u8); | 491 | void igb_write_rss_indir_tbl(struct igb_adapter *); |
492 | extern int igb_setup_tx_resources(struct igb_ring *); | 492 | int igb_set_spd_dplx(struct igb_adapter *, u32, u8); |
493 | extern int igb_setup_rx_resources(struct igb_ring *); | 493 | int igb_setup_tx_resources(struct igb_ring *); |
494 | extern void igb_free_tx_resources(struct igb_ring *); | 494 | int igb_setup_rx_resources(struct igb_ring *); |
495 | extern void igb_free_rx_resources(struct igb_ring *); | 495 | void igb_free_tx_resources(struct igb_ring *); |
496 | extern void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *); | 496 | void igb_free_rx_resources(struct igb_ring *); |
497 | extern void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *); | 497 | void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *); |
498 | extern void igb_setup_tctl(struct igb_adapter *); | 498 | void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *); |
499 | extern void igb_setup_rctl(struct igb_adapter *); | 499 | void igb_setup_tctl(struct igb_adapter *); |
500 | extern netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *); | 500 | void igb_setup_rctl(struct igb_adapter *); |
501 | extern void igb_unmap_and_free_tx_resource(struct igb_ring *, | 501 | netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *); |
502 | struct igb_tx_buffer *); | 502 | void igb_unmap_and_free_tx_resource(struct igb_ring *, struct igb_tx_buffer *); |
503 | extern void igb_alloc_rx_buffers(struct igb_ring *, u16); | 503 | void igb_alloc_rx_buffers(struct igb_ring *, u16); |
504 | extern void igb_update_stats(struct igb_adapter *, struct rtnl_link_stats64 *); | 504 | void igb_update_stats(struct igb_adapter *, struct rtnl_link_stats64 *); |
505 | extern bool igb_has_link(struct igb_adapter *adapter); | 505 | bool igb_has_link(struct igb_adapter *adapter); |
506 | extern void igb_set_ethtool_ops(struct net_device *); | 506 | void igb_set_ethtool_ops(struct net_device *); |
507 | extern void igb_power_up_link(struct igb_adapter *); | 507 | void igb_power_up_link(struct igb_adapter *); |
508 | extern void igb_set_fw_version(struct igb_adapter *); | 508 | void igb_set_fw_version(struct igb_adapter *); |
509 | extern void igb_ptp_init(struct igb_adapter *adapter); | 509 | void igb_ptp_init(struct igb_adapter *adapter); |
510 | extern void igb_ptp_stop(struct igb_adapter *adapter); | 510 | void igb_ptp_stop(struct igb_adapter *adapter); |
511 | extern void igb_ptp_reset(struct igb_adapter *adapter); | 511 | void igb_ptp_reset(struct igb_adapter *adapter); |
512 | extern void igb_ptp_tx_work(struct work_struct *work); | 512 | void igb_ptp_tx_work(struct work_struct *work); |
513 | extern void igb_ptp_rx_hang(struct igb_adapter *adapter); | 513 | void igb_ptp_rx_hang(struct igb_adapter *adapter); |
514 | extern void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter); | 514 | void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter); |
515 | extern void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, | 515 | void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb); |
516 | struct sk_buff *skb); | 516 | void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va, |
517 | extern void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, | 517 | struct sk_buff *skb); |
518 | unsigned char *va, | ||
519 | struct sk_buff *skb); | ||
520 | static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring, | 518 | static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring, |
521 | union e1000_adv_rx_desc *rx_desc, | 519 | union e1000_adv_rx_desc *rx_desc, |
522 | struct sk_buff *skb) | 520 | struct sk_buff *skb) |
@@ -531,11 +529,11 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring, | |||
531 | rx_ring->last_rx_timestamp = jiffies; | 529 | rx_ring->last_rx_timestamp = jiffies; |
532 | } | 530 | } |
533 | 531 | ||
534 | extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | 532 | int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, |
535 | struct ifreq *ifr, int cmd); | 533 | int cmd); |
536 | #ifdef CONFIG_IGB_HWMON | 534 | #ifdef CONFIG_IGB_HWMON |
537 | extern void igb_sysfs_exit(struct igb_adapter *adapter); | 535 | void igb_sysfs_exit(struct igb_adapter *adapter); |
538 | extern int igb_sysfs_init(struct igb_adapter *adapter); | 536 | int igb_sysfs_init(struct igb_adapter *adapter); |
539 | #endif | 537 | #endif |
540 | static inline s32 igb_reset_phy(struct e1000_hw *hw) | 538 | static inline s32 igb_reset_phy(struct e1000_hw *hw) |
541 | { | 539 | { |
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 86d51429a189..ebdac0273501 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -1659,7 +1659,8 @@ static int igb_setup_loopback_test(struct igb_adapter *adapter) | |||
1659 | if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || | 1659 | if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || |
1660 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || | 1660 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || |
1661 | (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || | 1661 | (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || |
1662 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP)) { | 1662 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || |
1663 | (hw->device_id == E1000_DEV_ID_I354_SGMII)) { | ||
1663 | 1664 | ||
1664 | /* Enable DH89xxCC MPHY for near end loopback */ | 1665 | /* Enable DH89xxCC MPHY for near end loopback */ |
1665 | reg = rd32(E1000_MPHY_ADDR_CTL); | 1666 | reg = rd32(E1000_MPHY_ADDR_CTL); |
@@ -1725,7 +1726,8 @@ static void igb_loopback_cleanup(struct igb_adapter *adapter) | |||
1725 | if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || | 1726 | if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || |
1726 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || | 1727 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || |
1727 | (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || | 1728 | (hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || |
1728 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP)) { | 1729 | (hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || |
1730 | (hw->device_id == E1000_DEV_ID_I354_SGMII)) { | ||
1729 | u32 reg; | 1731 | u32 reg; |
1730 | 1732 | ||
1731 | /* Disable near end loopback on DH89xxCC */ | 1733 | /* Disable near end loopback on DH89xxCC */ |
@@ -2875,6 +2877,88 @@ static int igb_set_rxfh_indir(struct net_device *netdev, const u32 *indir) | |||
2875 | return 0; | 2877 | return 0; |
2876 | } | 2878 | } |
2877 | 2879 | ||
2880 | static unsigned int igb_max_channels(struct igb_adapter *adapter) | ||
2881 | { | ||
2882 | struct e1000_hw *hw = &adapter->hw; | ||
2883 | unsigned int max_combined = 0; | ||
2884 | |||
2885 | switch (hw->mac.type) { | ||
2886 | case e1000_i211: | ||
2887 | max_combined = IGB_MAX_RX_QUEUES_I211; | ||
2888 | break; | ||
2889 | case e1000_82575: | ||
2890 | case e1000_i210: | ||
2891 | max_combined = IGB_MAX_RX_QUEUES_82575; | ||
2892 | break; | ||
2893 | case e1000_i350: | ||
2894 | if (!!adapter->vfs_allocated_count) { | ||
2895 | max_combined = 1; | ||
2896 | break; | ||
2897 | } | ||
2898 | /* fall through */ | ||
2899 | case e1000_82576: | ||
2900 | if (!!adapter->vfs_allocated_count) { | ||
2901 | max_combined = 2; | ||
2902 | break; | ||
2903 | } | ||
2904 | /* fall through */ | ||
2905 | case e1000_82580: | ||
2906 | case e1000_i354: | ||
2907 | default: | ||
2908 | max_combined = IGB_MAX_RX_QUEUES; | ||
2909 | break; | ||
2910 | } | ||
2911 | |||
2912 | return max_combined; | ||
2913 | } | ||
2914 | |||
2915 | static void igb_get_channels(struct net_device *netdev, | ||
2916 | struct ethtool_channels *ch) | ||
2917 | { | ||
2918 | struct igb_adapter *adapter = netdev_priv(netdev); | ||
2919 | |||
2920 | /* Report maximum channels */ | ||
2921 | ch->max_combined = igb_max_channels(adapter); | ||
2922 | |||
2923 | /* Report info for other vector */ | ||
2924 | if (adapter->msix_entries) { | ||
2925 | ch->max_other = NON_Q_VECTORS; | ||
2926 | ch->other_count = NON_Q_VECTORS; | ||
2927 | } | ||
2928 | |||
2929 | ch->combined_count = adapter->rss_queues; | ||
2930 | } | ||
2931 | |||
2932 | static int igb_set_channels(struct net_device *netdev, | ||
2933 | struct ethtool_channels *ch) | ||
2934 | { | ||
2935 | struct igb_adapter *adapter = netdev_priv(netdev); | ||
2936 | unsigned int count = ch->combined_count; | ||
2937 | |||
2938 | /* Verify they are not requesting separate vectors */ | ||
2939 | if (!count || ch->rx_count || ch->tx_count) | ||
2940 | return -EINVAL; | ||
2941 | |||
2942 | /* Verify other_count is valid and has not been changed */ | ||
2943 | if (ch->other_count != NON_Q_VECTORS) | ||
2944 | return -EINVAL; | ||
2945 | |||
2946 | /* Verify the number of channels doesn't exceed hw limits */ | ||
2947 | if (count > igb_max_channels(adapter)) | ||
2948 | return -EINVAL; | ||
2949 | |||
2950 | if (count != adapter->rss_queues) { | ||
2951 | adapter->rss_queues = count; | ||
2952 | |||
2953 | /* Hardware has to reinitialize queues and interrupts to | ||
2954 | * match the new configuration. | ||
2955 | */ | ||
2956 | return igb_reinit_queues(adapter); | ||
2957 | } | ||
2958 | |||
2959 | return 0; | ||
2960 | } | ||
2961 | |||
2878 | static const struct ethtool_ops igb_ethtool_ops = { | 2962 | static const struct ethtool_ops igb_ethtool_ops = { |
2879 | .get_settings = igb_get_settings, | 2963 | .get_settings = igb_get_settings, |
2880 | .set_settings = igb_set_settings, | 2964 | .set_settings = igb_set_settings, |
@@ -2911,6 +2995,8 @@ static const struct ethtool_ops igb_ethtool_ops = { | |||
2911 | .get_rxfh_indir_size = igb_get_rxfh_indir_size, | 2995 | .get_rxfh_indir_size = igb_get_rxfh_indir_size, |
2912 | .get_rxfh_indir = igb_get_rxfh_indir, | 2996 | .get_rxfh_indir = igb_get_rxfh_indir, |
2913 | .set_rxfh_indir = igb_set_rxfh_indir, | 2997 | .set_rxfh_indir = igb_set_rxfh_indir, |
2998 | .get_channels = igb_get_channels, | ||
2999 | .set_channels = igb_set_channels, | ||
2914 | .begin = igb_ethtool_begin, | 3000 | .begin = igb_ethtool_begin, |
2915 | .complete = igb_ethtool_complete, | 3001 | .complete = igb_ethtool_complete, |
2916 | }; | 3002 | }; |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 8cf44f2a8ccd..a56266eacc64 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -7838,4 +7838,26 @@ s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset, | |||
7838 | return E1000_SUCCESS; | 7838 | return E1000_SUCCESS; |
7839 | 7839 | ||
7840 | } | 7840 | } |
7841 | |||
7842 | int igb_reinit_queues(struct igb_adapter *adapter) | ||
7843 | { | ||
7844 | struct net_device *netdev = adapter->netdev; | ||
7845 | struct pci_dev *pdev = adapter->pdev; | ||
7846 | int err = 0; | ||
7847 | |||
7848 | if (netif_running(netdev)) | ||
7849 | igb_close(netdev); | ||
7850 | |||
7851 | igb_clear_interrupt_scheme(adapter); | ||
7852 | |||
7853 | if (igb_init_interrupt_scheme(adapter, true)) { | ||
7854 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); | ||
7855 | return -ENOMEM; | ||
7856 | } | ||
7857 | |||
7858 | if (netif_running(netdev)) | ||
7859 | err = igb_open(netdev); | ||
7860 | |||
7861 | return err; | ||
7862 | } | ||
7841 | /* igb_main.c */ | 7863 | /* igb_main.c */ |
diff --git a/drivers/net/ethernet/intel/igbvf/igbvf.h b/drivers/net/ethernet/intel/igbvf/igbvf.h index a1463e3d14c0..7d6a25c8f889 100644 --- a/drivers/net/ethernet/intel/igbvf/igbvf.h +++ b/drivers/net/ethernet/intel/igbvf/igbvf.h | |||
@@ -312,17 +312,17 @@ enum igbvf_state_t { | |||
312 | extern char igbvf_driver_name[]; | 312 | extern char igbvf_driver_name[]; |
313 | extern const char igbvf_driver_version[]; | 313 | extern const char igbvf_driver_version[]; |
314 | 314 | ||
315 | extern void igbvf_check_options(struct igbvf_adapter *); | 315 | void igbvf_check_options(struct igbvf_adapter *); |
316 | extern void igbvf_set_ethtool_ops(struct net_device *); | 316 | void igbvf_set_ethtool_ops(struct net_device *); |
317 | 317 | ||
318 | extern int igbvf_up(struct igbvf_adapter *); | 318 | int igbvf_up(struct igbvf_adapter *); |
319 | extern void igbvf_down(struct igbvf_adapter *); | 319 | void igbvf_down(struct igbvf_adapter *); |
320 | extern void igbvf_reinit_locked(struct igbvf_adapter *); | 320 | void igbvf_reinit_locked(struct igbvf_adapter *); |
321 | extern int igbvf_setup_rx_resources(struct igbvf_adapter *, struct igbvf_ring *); | 321 | int igbvf_setup_rx_resources(struct igbvf_adapter *, struct igbvf_ring *); |
322 | extern int igbvf_setup_tx_resources(struct igbvf_adapter *, struct igbvf_ring *); | 322 | int igbvf_setup_tx_resources(struct igbvf_adapter *, struct igbvf_ring *); |
323 | extern void igbvf_free_rx_resources(struct igbvf_ring *); | 323 | void igbvf_free_rx_resources(struct igbvf_ring *); |
324 | extern void igbvf_free_tx_resources(struct igbvf_ring *); | 324 | void igbvf_free_tx_resources(struct igbvf_ring *); |
325 | extern void igbvf_update_stats(struct igbvf_adapter *); | 325 | void igbvf_update_stats(struct igbvf_adapter *); |
326 | 326 | ||
327 | extern unsigned int copybreak; | 327 | extern unsigned int copybreak; |
328 | 328 | ||
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb.h b/drivers/net/ethernet/intel/ixgb/ixgb.h index 4d2ae97ff1b3..2224cc2edf13 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb.h +++ b/drivers/net/ethernet/intel/ixgb/ixgb.h | |||
@@ -187,21 +187,21 @@ enum ixgb_state_t { | |||
187 | }; | 187 | }; |
188 | 188 | ||
189 | /* Exported from other modules */ | 189 | /* Exported from other modules */ |
190 | extern void ixgb_check_options(struct ixgb_adapter *adapter); | 190 | void ixgb_check_options(struct ixgb_adapter *adapter); |
191 | extern void ixgb_set_ethtool_ops(struct net_device *netdev); | 191 | void ixgb_set_ethtool_ops(struct net_device *netdev); |
192 | extern char ixgb_driver_name[]; | 192 | extern char ixgb_driver_name[]; |
193 | extern const char ixgb_driver_version[]; | 193 | extern const char ixgb_driver_version[]; |
194 | 194 | ||
195 | extern void ixgb_set_speed_duplex(struct net_device *netdev); | 195 | void ixgb_set_speed_duplex(struct net_device *netdev); |
196 | 196 | ||
197 | extern int ixgb_up(struct ixgb_adapter *adapter); | 197 | int ixgb_up(struct ixgb_adapter *adapter); |
198 | extern void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog); | 198 | void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog); |
199 | extern void ixgb_reset(struct ixgb_adapter *adapter); | 199 | void ixgb_reset(struct ixgb_adapter *adapter); |
200 | extern int ixgb_setup_rx_resources(struct ixgb_adapter *adapter); | 200 | int ixgb_setup_rx_resources(struct ixgb_adapter *adapter); |
201 | extern int ixgb_setup_tx_resources(struct ixgb_adapter *adapter); | 201 | int ixgb_setup_tx_resources(struct ixgb_adapter *adapter); |
202 | extern void ixgb_free_rx_resources(struct ixgb_adapter *adapter); | 202 | void ixgb_free_rx_resources(struct ixgb_adapter *adapter); |
203 | extern void ixgb_free_tx_resources(struct ixgb_adapter *adapter); | 203 | void ixgb_free_tx_resources(struct ixgb_adapter *adapter); |
204 | extern void ixgb_update_stats(struct ixgb_adapter *adapter); | 204 | void ixgb_update_stats(struct ixgb_adapter *adapter); |
205 | 205 | ||
206 | 206 | ||
207 | #endif /* _IXGB_H_ */ | 207 | #endif /* _IXGB_H_ */ |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_hw.h b/drivers/net/ethernet/intel/ixgb/ixgb_hw.h index 2a99a35c33aa..0bd5d72e1af5 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_hw.h +++ b/drivers/net/ethernet/intel/ixgb/ixgb_hw.h | |||
@@ -759,27 +759,20 @@ struct ixgb_hw_stats { | |||
759 | }; | 759 | }; |
760 | 760 | ||
761 | /* Function Prototypes */ | 761 | /* Function Prototypes */ |
762 | extern bool ixgb_adapter_stop(struct ixgb_hw *hw); | 762 | bool ixgb_adapter_stop(struct ixgb_hw *hw); |
763 | extern bool ixgb_init_hw(struct ixgb_hw *hw); | 763 | bool ixgb_init_hw(struct ixgb_hw *hw); |
764 | extern bool ixgb_adapter_start(struct ixgb_hw *hw); | 764 | bool ixgb_adapter_start(struct ixgb_hw *hw); |
765 | extern void ixgb_check_for_link(struct ixgb_hw *hw); | 765 | void ixgb_check_for_link(struct ixgb_hw *hw); |
766 | extern bool ixgb_check_for_bad_link(struct ixgb_hw *hw); | 766 | bool ixgb_check_for_bad_link(struct ixgb_hw *hw); |
767 | |||
768 | extern void ixgb_rar_set(struct ixgb_hw *hw, | ||
769 | u8 *addr, | ||
770 | u32 index); | ||
771 | 767 | ||
768 | void ixgb_rar_set(struct ixgb_hw *hw, u8 *addr, u32 index); | ||
772 | 769 | ||
773 | /* Filters (multicast, vlan, receive) */ | 770 | /* Filters (multicast, vlan, receive) */ |
774 | extern void ixgb_mc_addr_list_update(struct ixgb_hw *hw, | 771 | void ixgb_mc_addr_list_update(struct ixgb_hw *hw, u8 *mc_addr_list, |
775 | u8 *mc_addr_list, | 772 | u32 mc_addr_count, u32 pad); |
776 | u32 mc_addr_count, | ||
777 | u32 pad); | ||
778 | 773 | ||
779 | /* Vfta functions */ | 774 | /* Vfta functions */ |
780 | extern void ixgb_write_vfta(struct ixgb_hw *hw, | 775 | void ixgb_write_vfta(struct ixgb_hw *hw, u32 offset, u32 value); |
781 | u32 offset, | ||
782 | u32 value); | ||
783 | 776 | ||
784 | /* Access functions to eeprom data */ | 777 | /* Access functions to eeprom data */ |
785 | void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, u8 *mac_addr); | 778 | void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, u8 *mac_addr); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 0ac6b11c6e4e..dc1588ee264a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <net/busy_poll.h> | 55 | #include <net/busy_poll.h> |
56 | 56 | ||
57 | #ifdef CONFIG_NET_RX_BUSY_POLL | 57 | #ifdef CONFIG_NET_RX_BUSY_POLL |
58 | #define LL_EXTENDED_STATS | 58 | #define BP_EXTENDED_STATS |
59 | #endif | 59 | #endif |
60 | /* common prefix used by pr_<> macros */ | 60 | /* common prefix used by pr_<> macros */ |
61 | #undef pr_fmt | 61 | #undef pr_fmt |
@@ -187,11 +187,11 @@ struct ixgbe_rx_buffer { | |||
187 | struct ixgbe_queue_stats { | 187 | struct ixgbe_queue_stats { |
188 | u64 packets; | 188 | u64 packets; |
189 | u64 bytes; | 189 | u64 bytes; |
190 | #ifdef LL_EXTENDED_STATS | 190 | #ifdef BP_EXTENDED_STATS |
191 | u64 yields; | 191 | u64 yields; |
192 | u64 misses; | 192 | u64 misses; |
193 | u64 cleaned; | 193 | u64 cleaned; |
194 | #endif /* LL_EXTENDED_STATS */ | 194 | #endif /* BP_EXTENDED_STATS */ |
195 | }; | 195 | }; |
196 | 196 | ||
197 | struct ixgbe_tx_queue_stats { | 197 | struct ixgbe_tx_queue_stats { |
@@ -399,7 +399,7 @@ static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector) | |||
399 | WARN_ON(q_vector->state & IXGBE_QV_STATE_NAPI); | 399 | WARN_ON(q_vector->state & IXGBE_QV_STATE_NAPI); |
400 | q_vector->state |= IXGBE_QV_STATE_NAPI_YIELD; | 400 | q_vector->state |= IXGBE_QV_STATE_NAPI_YIELD; |
401 | rc = false; | 401 | rc = false; |
402 | #ifdef LL_EXTENDED_STATS | 402 | #ifdef BP_EXTENDED_STATS |
403 | q_vector->tx.ring->stats.yields++; | 403 | q_vector->tx.ring->stats.yields++; |
404 | #endif | 404 | #endif |
405 | } else | 405 | } else |
@@ -432,7 +432,7 @@ static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector) | |||
432 | if ((q_vector->state & IXGBE_QV_LOCKED)) { | 432 | if ((q_vector->state & IXGBE_QV_LOCKED)) { |
433 | q_vector->state |= IXGBE_QV_STATE_POLL_YIELD; | 433 | q_vector->state |= IXGBE_QV_STATE_POLL_YIELD; |
434 | rc = false; | 434 | rc = false; |
435 | #ifdef LL_EXTENDED_STATS | 435 | #ifdef BP_EXTENDED_STATS |
436 | q_vector->rx.ring->stats.yields++; | 436 | q_vector->rx.ring->stats.yields++; |
437 | #endif | 437 | #endif |
438 | } else | 438 | } else |
@@ -457,7 +457,7 @@ static inline bool ixgbe_qv_unlock_poll(struct ixgbe_q_vector *q_vector) | |||
457 | } | 457 | } |
458 | 458 | ||
459 | /* true if a socket is polling, even if it did not get the lock */ | 459 | /* true if a socket is polling, even if it did not get the lock */ |
460 | static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) | 460 | static inline bool ixgbe_qv_busy_polling(struct ixgbe_q_vector *q_vector) |
461 | { | 461 | { |
462 | WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); | 462 | WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); |
463 | return q_vector->state & IXGBE_QV_USER_PEND; | 463 | return q_vector->state & IXGBE_QV_USER_PEND; |
@@ -487,7 +487,7 @@ static inline bool ixgbe_qv_unlock_poll(struct ixgbe_q_vector *q_vector) | |||
487 | return false; | 487 | return false; |
488 | } | 488 | } |
489 | 489 | ||
490 | static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) | 490 | static inline bool ixgbe_qv_busy_polling(struct ixgbe_q_vector *q_vector) |
491 | { | 491 | { |
492 | return false; | 492 | return false; |
493 | } | 493 | } |
@@ -786,93 +786,89 @@ extern const char ixgbe_driver_version[]; | |||
786 | extern char ixgbe_default_device_descr[]; | 786 | extern char ixgbe_default_device_descr[]; |
787 | #endif /* IXGBE_FCOE */ | 787 | #endif /* IXGBE_FCOE */ |
788 | 788 | ||
789 | extern void ixgbe_up(struct ixgbe_adapter *adapter); | 789 | void ixgbe_up(struct ixgbe_adapter *adapter); |
790 | extern void ixgbe_down(struct ixgbe_adapter *adapter); | 790 | void ixgbe_down(struct ixgbe_adapter *adapter); |
791 | extern void ixgbe_reinit_locked(struct ixgbe_adapter *adapter); | 791 | void ixgbe_reinit_locked(struct ixgbe_adapter *adapter); |
792 | extern void ixgbe_reset(struct ixgbe_adapter *adapter); | 792 | void ixgbe_reset(struct ixgbe_adapter *adapter); |
793 | extern void ixgbe_set_ethtool_ops(struct net_device *netdev); | 793 | void ixgbe_set_ethtool_ops(struct net_device *netdev); |
794 | extern int ixgbe_setup_rx_resources(struct ixgbe_ring *); | 794 | int ixgbe_setup_rx_resources(struct ixgbe_ring *); |
795 | extern int ixgbe_setup_tx_resources(struct ixgbe_ring *); | 795 | int ixgbe_setup_tx_resources(struct ixgbe_ring *); |
796 | extern void ixgbe_free_rx_resources(struct ixgbe_ring *); | 796 | void ixgbe_free_rx_resources(struct ixgbe_ring *); |
797 | extern void ixgbe_free_tx_resources(struct ixgbe_ring *); | 797 | void ixgbe_free_tx_resources(struct ixgbe_ring *); |
798 | extern void ixgbe_configure_rx_ring(struct ixgbe_adapter *,struct ixgbe_ring *); | 798 | void ixgbe_configure_rx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); |
799 | extern void ixgbe_configure_tx_ring(struct ixgbe_adapter *,struct ixgbe_ring *); | 799 | void ixgbe_configure_tx_ring(struct ixgbe_adapter *, struct ixgbe_ring *); |
800 | extern void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, | 800 | void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_ring *); |
801 | struct ixgbe_ring *); | 801 | void ixgbe_update_stats(struct ixgbe_adapter *adapter); |
802 | extern void ixgbe_update_stats(struct ixgbe_adapter *adapter); | 802 | int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); |
803 | extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter); | 803 | int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, |
804 | extern int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id, | ||
805 | u16 subdevice_id); | 804 | u16 subdevice_id); |
806 | extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); | 805 | void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter); |
807 | extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, | 806 | netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *, struct ixgbe_adapter *, |
808 | struct ixgbe_adapter *, | 807 | struct ixgbe_ring *); |
809 | struct ixgbe_ring *); | 808 | void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *, |
810 | extern void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *, | 809 | struct ixgbe_tx_buffer *); |
811 | struct ixgbe_tx_buffer *); | 810 | void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16); |
812 | extern void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16); | 811 | void ixgbe_write_eitr(struct ixgbe_q_vector *); |
813 | extern void ixgbe_write_eitr(struct ixgbe_q_vector *); | 812 | int ixgbe_poll(struct napi_struct *napi, int budget); |
814 | extern int ixgbe_poll(struct napi_struct *napi, int budget); | 813 | int ethtool_ioctl(struct ifreq *ifr); |
815 | extern int ethtool_ioctl(struct ifreq *ifr); | 814 | s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw); |
816 | extern s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw); | 815 | s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl); |
817 | extern s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl); | 816 | s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl); |
818 | extern s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl); | 817 | s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, |
819 | extern s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, | 818 | union ixgbe_atr_hash_dword input, |
820 | union ixgbe_atr_hash_dword input, | 819 | union ixgbe_atr_hash_dword common, |
821 | union ixgbe_atr_hash_dword common, | 820 | u8 queue); |
822 | u8 queue); | 821 | s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, |
823 | extern s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, | 822 | union ixgbe_atr_input *input_mask); |
824 | union ixgbe_atr_input *input_mask); | 823 | s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, |
825 | extern s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, | 824 | union ixgbe_atr_input *input, |
826 | union ixgbe_atr_input *input, | 825 | u16 soft_id, u8 queue); |
827 | u16 soft_id, u8 queue); | 826 | s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, |
828 | extern s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, | 827 | union ixgbe_atr_input *input, |
829 | union ixgbe_atr_input *input, | 828 | u16 soft_id); |
830 | u16 soft_id); | 829 | void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, |
831 | extern void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, | 830 | union ixgbe_atr_input *mask); |
832 | union ixgbe_atr_input *mask); | 831 | bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw); |
833 | extern bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw); | 832 | void ixgbe_set_rx_mode(struct net_device *netdev); |
834 | extern void ixgbe_set_rx_mode(struct net_device *netdev); | ||
835 | #ifdef CONFIG_IXGBE_DCB | 833 | #ifdef CONFIG_IXGBE_DCB |
836 | extern void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter); | 834 | void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter); |
837 | #endif | 835 | #endif |
838 | extern int ixgbe_setup_tc(struct net_device *dev, u8 tc); | 836 | int ixgbe_setup_tc(struct net_device *dev, u8 tc); |
839 | extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); | 837 | void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); |
840 | extern void ixgbe_do_reset(struct net_device *netdev); | 838 | void ixgbe_do_reset(struct net_device *netdev); |
841 | #ifdef CONFIG_IXGBE_HWMON | 839 | #ifdef CONFIG_IXGBE_HWMON |
842 | extern void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); | 840 | void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); |
843 | extern int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); | 841 | int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); |
844 | #endif /* CONFIG_IXGBE_HWMON */ | 842 | #endif /* CONFIG_IXGBE_HWMON */ |
845 | #ifdef IXGBE_FCOE | 843 | #ifdef IXGBE_FCOE |
846 | extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); | 844 | void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); |
847 | extern int ixgbe_fso(struct ixgbe_ring *tx_ring, | 845 | int ixgbe_fso(struct ixgbe_ring *tx_ring, struct ixgbe_tx_buffer *first, |
848 | struct ixgbe_tx_buffer *first, | 846 | u8 *hdr_len); |
849 | u8 *hdr_len); | 847 | int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, |
850 | extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | 848 | union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb); |
851 | union ixgbe_adv_rx_desc *rx_desc, | 849 | int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, |
852 | struct sk_buff *skb); | 850 | struct scatterlist *sgl, unsigned int sgc); |
853 | extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, | 851 | int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid, |
854 | struct scatterlist *sgl, unsigned int sgc); | 852 | struct scatterlist *sgl, unsigned int sgc); |
855 | extern int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid, | 853 | int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); |
856 | struct scatterlist *sgl, unsigned int sgc); | 854 | int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter); |
857 | extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); | 855 | void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter); |
858 | extern int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter); | 856 | int ixgbe_fcoe_enable(struct net_device *netdev); |
859 | extern void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter); | 857 | int ixgbe_fcoe_disable(struct net_device *netdev); |
860 | extern int ixgbe_fcoe_enable(struct net_device *netdev); | ||
861 | extern int ixgbe_fcoe_disable(struct net_device *netdev); | ||
862 | #ifdef CONFIG_IXGBE_DCB | 858 | #ifdef CONFIG_IXGBE_DCB |
863 | extern u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter); | 859 | u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter); |
864 | extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); | 860 | u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); |
865 | #endif /* CONFIG_IXGBE_DCB */ | 861 | #endif /* CONFIG_IXGBE_DCB */ |
866 | extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); | 862 | int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); |
867 | extern int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, | 863 | int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, |
868 | struct netdev_fcoe_hbainfo *info); | 864 | struct netdev_fcoe_hbainfo *info); |
869 | extern u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter); | 865 | u8 ixgbe_fcoe_get_tc(struct ixgbe_adapter *adapter); |
870 | #endif /* IXGBE_FCOE */ | 866 | #endif /* IXGBE_FCOE */ |
871 | #ifdef CONFIG_DEBUG_FS | 867 | #ifdef CONFIG_DEBUG_FS |
872 | extern void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter); | 868 | void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter); |
873 | extern void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter); | 869 | void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter); |
874 | extern void ixgbe_dbg_init(void); | 870 | void ixgbe_dbg_init(void); |
875 | extern void ixgbe_dbg_exit(void); | 871 | void ixgbe_dbg_exit(void); |
876 | #else | 872 | #else |
877 | static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {} | 873 | static inline void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter) {} |
878 | static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {} | 874 | static inline void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter) {} |
@@ -884,12 +880,12 @@ static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring) | |||
884 | return netdev_get_tx_queue(ring->netdev, ring->queue_index); | 880 | return netdev_get_tx_queue(ring->netdev, ring->queue_index); |
885 | } | 881 | } |
886 | 882 | ||
887 | extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter); | 883 | void ixgbe_ptp_init(struct ixgbe_adapter *adapter); |
888 | extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); | 884 | void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); |
889 | extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); | 885 | void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); |
890 | extern void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); | 886 | void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); |
891 | extern void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | 887 | void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, |
892 | struct sk_buff *skb); | 888 | struct sk_buff *skb); |
893 | static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, | 889 | static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, |
894 | union ixgbe_adv_rx_desc *rx_desc, | 890 | union ixgbe_adv_rx_desc *rx_desc, |
895 | struct sk_buff *skb) | 891 | struct sk_buff *skb) |
@@ -906,11 +902,11 @@ static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, | |||
906 | rx_ring->last_rx_timestamp = jiffies; | 902 | rx_ring->last_rx_timestamp = jiffies; |
907 | } | 903 | } |
908 | 904 | ||
909 | extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | 905 | int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, struct ifreq *ifr, |
910 | struct ifreq *ifr, int cmd); | 906 | int cmd); |
911 | extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); | 907 | void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); |
912 | extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter); | 908 | void ixgbe_ptp_reset(struct ixgbe_adapter *adapter); |
913 | extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr); | 909 | void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr); |
914 | #ifdef CONFIG_PCI_IOV | 910 | #ifdef CONFIG_PCI_IOV |
915 | void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter); | 911 | void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter); |
916 | #endif | 912 | #endif |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index e8649abf97c0..90aac31b3551 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -442,7 +442,7 @@ static void ixgbe_set_msglevel(struct net_device *netdev, u32 data) | |||
442 | 442 | ||
443 | static int ixgbe_get_regs_len(struct net_device *netdev) | 443 | static int ixgbe_get_regs_len(struct net_device *netdev) |
444 | { | 444 | { |
445 | #define IXGBE_REGS_LEN 1129 | 445 | #define IXGBE_REGS_LEN 1139 |
446 | return IXGBE_REGS_LEN * sizeof(u32); | 446 | return IXGBE_REGS_LEN * sizeof(u32); |
447 | } | 447 | } |
448 | 448 | ||
@@ -602,22 +602,53 @@ static void ixgbe_get_regs(struct net_device *netdev, | |||
602 | regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT(0)); | 602 | regs_buff[828] = IXGBE_READ_REG(hw, IXGBE_FHFT(0)); |
603 | 603 | ||
604 | /* DCB */ | 604 | /* DCB */ |
605 | regs_buff[829] = IXGBE_READ_REG(hw, IXGBE_RMCS); | 605 | regs_buff[829] = IXGBE_READ_REG(hw, IXGBE_RMCS); /* same as FCCFG */ |
606 | regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_DPMCS); | 606 | regs_buff[831] = IXGBE_READ_REG(hw, IXGBE_PDPMCS); /* same as RTTPCS */ |
607 | regs_buff[831] = IXGBE_READ_REG(hw, IXGBE_PDPMCS); | 607 | |
608 | regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RUPPBMR); | 608 | switch (hw->mac.type) { |
609 | for (i = 0; i < 8; i++) | 609 | case ixgbe_mac_82598EB: |
610 | regs_buff[833 + i] = IXGBE_READ_REG(hw, IXGBE_RT2CR(i)); | 610 | regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_DPMCS); |
611 | for (i = 0; i < 8; i++) | 611 | regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RUPPBMR); |
612 | regs_buff[841 + i] = IXGBE_READ_REG(hw, IXGBE_RT2SR(i)); | 612 | for (i = 0; i < 8; i++) |
613 | for (i = 0; i < 8; i++) | 613 | regs_buff[833 + i] = |
614 | regs_buff[849 + i] = IXGBE_READ_REG(hw, IXGBE_TDTQ2TCCR(i)); | 614 | IXGBE_READ_REG(hw, IXGBE_RT2CR(i)); |
615 | for (i = 0; i < 8; i++) | 615 | for (i = 0; i < 8; i++) |
616 | regs_buff[857 + i] = IXGBE_READ_REG(hw, IXGBE_TDTQ2TCSR(i)); | 616 | regs_buff[841 + i] = |
617 | IXGBE_READ_REG(hw, IXGBE_RT2SR(i)); | ||
618 | for (i = 0; i < 8; i++) | ||
619 | regs_buff[849 + i] = | ||
620 | IXGBE_READ_REG(hw, IXGBE_TDTQ2TCCR(i)); | ||
621 | for (i = 0; i < 8; i++) | ||
622 | regs_buff[857 + i] = | ||
623 | IXGBE_READ_REG(hw, IXGBE_TDTQ2TCSR(i)); | ||
624 | break; | ||
625 | case ixgbe_mac_82599EB: | ||
626 | case ixgbe_mac_X540: | ||
627 | regs_buff[830] = IXGBE_READ_REG(hw, IXGBE_RTTDCS); | ||
628 | regs_buff[832] = IXGBE_READ_REG(hw, IXGBE_RTRPCS); | ||
629 | for (i = 0; i < 8; i++) | ||
630 | regs_buff[833 + i] = | ||
631 | IXGBE_READ_REG(hw, IXGBE_RTRPT4C(i)); | ||
632 | for (i = 0; i < 8; i++) | ||
633 | regs_buff[841 + i] = | ||
634 | IXGBE_READ_REG(hw, IXGBE_RTRPT4S(i)); | ||
635 | for (i = 0; i < 8; i++) | ||
636 | regs_buff[849 + i] = | ||
637 | IXGBE_READ_REG(hw, IXGBE_RTTDT2C(i)); | ||
638 | for (i = 0; i < 8; i++) | ||
639 | regs_buff[857 + i] = | ||
640 | IXGBE_READ_REG(hw, IXGBE_RTTDT2S(i)); | ||
641 | break; | ||
642 | default: | ||
643 | break; | ||
644 | } | ||
645 | |||
617 | for (i = 0; i < 8; i++) | 646 | for (i = 0; i < 8; i++) |
618 | regs_buff[865 + i] = IXGBE_READ_REG(hw, IXGBE_TDPT2TCCR(i)); | 647 | regs_buff[865 + i] = |
648 | IXGBE_READ_REG(hw, IXGBE_TDPT2TCCR(i)); /* same as RTTPT2C */ | ||
619 | for (i = 0; i < 8; i++) | 649 | for (i = 0; i < 8; i++) |
620 | regs_buff[873 + i] = IXGBE_READ_REG(hw, IXGBE_TDPT2TCSR(i)); | 650 | regs_buff[873 + i] = |
651 | IXGBE_READ_REG(hw, IXGBE_TDPT2TCSR(i)); /* same as RTTPT2S */ | ||
621 | 652 | ||
622 | /* Statistics */ | 653 | /* Statistics */ |
623 | regs_buff[881] = IXGBE_GET_STAT(adapter, crcerrs); | 654 | regs_buff[881] = IXGBE_GET_STAT(adapter, crcerrs); |
@@ -757,6 +788,20 @@ static void ixgbe_get_regs(struct net_device *netdev, | |||
757 | 788 | ||
758 | /* 82599 X540 specific registers */ | 789 | /* 82599 X540 specific registers */ |
759 | regs_buff[1128] = IXGBE_READ_REG(hw, IXGBE_MFLCN); | 790 | regs_buff[1128] = IXGBE_READ_REG(hw, IXGBE_MFLCN); |
791 | |||
792 | /* 82599 X540 specific DCB registers */ | ||
793 | regs_buff[1129] = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC); | ||
794 | regs_buff[1130] = IXGBE_READ_REG(hw, IXGBE_RTTUP2TC); | ||
795 | for (i = 0; i < 4; i++) | ||
796 | regs_buff[1131 + i] = IXGBE_READ_REG(hw, IXGBE_TXLLQ(i)); | ||
797 | regs_buff[1135] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRM); | ||
798 | /* same as RTTQCNRM */ | ||
799 | regs_buff[1136] = IXGBE_READ_REG(hw, IXGBE_RTTBCNRD); | ||
800 | /* same as RTTQCNRR */ | ||
801 | |||
802 | /* X540 specific DCB registers */ | ||
803 | regs_buff[1137] = IXGBE_READ_REG(hw, IXGBE_RTTQCNCR); | ||
804 | regs_buff[1138] = IXGBE_READ_REG(hw, IXGBE_RTTQCNTG); | ||
760 | } | 805 | } |
761 | 806 | ||
762 | static int ixgbe_get_eeprom_len(struct net_device *netdev) | 807 | static int ixgbe_get_eeprom_len(struct net_device *netdev) |
@@ -1072,7 +1117,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
1072 | data[i] = 0; | 1117 | data[i] = 0; |
1073 | data[i+1] = 0; | 1118 | data[i+1] = 0; |
1074 | i += 2; | 1119 | i += 2; |
1075 | #ifdef LL_EXTENDED_STATS | 1120 | #ifdef BP_EXTENDED_STATS |
1076 | data[i] = 0; | 1121 | data[i] = 0; |
1077 | data[i+1] = 0; | 1122 | data[i+1] = 0; |
1078 | data[i+2] = 0; | 1123 | data[i+2] = 0; |
@@ -1087,7 +1132,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
1087 | data[i+1] = ring->stats.bytes; | 1132 | data[i+1] = ring->stats.bytes; |
1088 | } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); | 1133 | } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); |
1089 | i += 2; | 1134 | i += 2; |
1090 | #ifdef LL_EXTENDED_STATS | 1135 | #ifdef BP_EXTENDED_STATS |
1091 | data[i] = ring->stats.yields; | 1136 | data[i] = ring->stats.yields; |
1092 | data[i+1] = ring->stats.misses; | 1137 | data[i+1] = ring->stats.misses; |
1093 | data[i+2] = ring->stats.cleaned; | 1138 | data[i+2] = ring->stats.cleaned; |
@@ -1100,7 +1145,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
1100 | data[i] = 0; | 1145 | data[i] = 0; |
1101 | data[i+1] = 0; | 1146 | data[i+1] = 0; |
1102 | i += 2; | 1147 | i += 2; |
1103 | #ifdef LL_EXTENDED_STATS | 1148 | #ifdef BP_EXTENDED_STATS |
1104 | data[i] = 0; | 1149 | data[i] = 0; |
1105 | data[i+1] = 0; | 1150 | data[i+1] = 0; |
1106 | data[i+2] = 0; | 1151 | data[i+2] = 0; |
@@ -1115,7 +1160,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
1115 | data[i+1] = ring->stats.bytes; | 1160 | data[i+1] = ring->stats.bytes; |
1116 | } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); | 1161 | } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); |
1117 | i += 2; | 1162 | i += 2; |
1118 | #ifdef LL_EXTENDED_STATS | 1163 | #ifdef BP_EXTENDED_STATS |
1119 | data[i] = ring->stats.yields; | 1164 | data[i] = ring->stats.yields; |
1120 | data[i+1] = ring->stats.misses; | 1165 | data[i+1] = ring->stats.misses; |
1121 | data[i+2] = ring->stats.cleaned; | 1166 | data[i+2] = ring->stats.cleaned; |
@@ -1157,28 +1202,28 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, | |||
1157 | p += ETH_GSTRING_LEN; | 1202 | p += ETH_GSTRING_LEN; |
1158 | sprintf(p, "tx_queue_%u_bytes", i); | 1203 | sprintf(p, "tx_queue_%u_bytes", i); |
1159 | p += ETH_GSTRING_LEN; | 1204 | p += ETH_GSTRING_LEN; |
1160 | #ifdef LL_EXTENDED_STATS | 1205 | #ifdef BP_EXTENDED_STATS |
1161 | sprintf(p, "tx_queue_%u_ll_napi_yield", i); | 1206 | sprintf(p, "tx_queue_%u_bp_napi_yield", i); |
1162 | p += ETH_GSTRING_LEN; | 1207 | p += ETH_GSTRING_LEN; |
1163 | sprintf(p, "tx_queue_%u_ll_misses", i); | 1208 | sprintf(p, "tx_queue_%u_bp_misses", i); |
1164 | p += ETH_GSTRING_LEN; | 1209 | p += ETH_GSTRING_LEN; |
1165 | sprintf(p, "tx_queue_%u_ll_cleaned", i); | 1210 | sprintf(p, "tx_queue_%u_bp_cleaned", i); |
1166 | p += ETH_GSTRING_LEN; | 1211 | p += ETH_GSTRING_LEN; |
1167 | #endif /* LL_EXTENDED_STATS */ | 1212 | #endif /* BP_EXTENDED_STATS */ |
1168 | } | 1213 | } |
1169 | for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) { | 1214 | for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) { |
1170 | sprintf(p, "rx_queue_%u_packets", i); | 1215 | sprintf(p, "rx_queue_%u_packets", i); |
1171 | p += ETH_GSTRING_LEN; | 1216 | p += ETH_GSTRING_LEN; |
1172 | sprintf(p, "rx_queue_%u_bytes", i); | 1217 | sprintf(p, "rx_queue_%u_bytes", i); |
1173 | p += ETH_GSTRING_LEN; | 1218 | p += ETH_GSTRING_LEN; |
1174 | #ifdef LL_EXTENDED_STATS | 1219 | #ifdef BP_EXTENDED_STATS |
1175 | sprintf(p, "rx_queue_%u_ll_poll_yield", i); | 1220 | sprintf(p, "rx_queue_%u_bp_poll_yield", i); |
1176 | p += ETH_GSTRING_LEN; | 1221 | p += ETH_GSTRING_LEN; |
1177 | sprintf(p, "rx_queue_%u_ll_misses", i); | 1222 | sprintf(p, "rx_queue_%u_bp_misses", i); |
1178 | p += ETH_GSTRING_LEN; | 1223 | p += ETH_GSTRING_LEN; |
1179 | sprintf(p, "rx_queue_%u_ll_cleaned", i); | 1224 | sprintf(p, "rx_queue_%u_bp_cleaned", i); |
1180 | p += ETH_GSTRING_LEN; | 1225 | p += ETH_GSTRING_LEN; |
1181 | #endif /* LL_EXTENDED_STATS */ | 1226 | #endif /* BP_EXTENDED_STATS */ |
1182 | } | 1227 | } |
1183 | for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) { | 1228 | for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) { |
1184 | sprintf(p, "tx_pb_%u_pxon", i); | 1229 | sprintf(p, "tx_pb_%u_pxon", i); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 0ade0cd5ef53..43b777aad288 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -1585,7 +1585,7 @@ static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, | |||
1585 | { | 1585 | { |
1586 | struct ixgbe_adapter *adapter = q_vector->adapter; | 1586 | struct ixgbe_adapter *adapter = q_vector->adapter; |
1587 | 1587 | ||
1588 | if (ixgbe_qv_ll_polling(q_vector)) | 1588 | if (ixgbe_qv_busy_polling(q_vector)) |
1589 | netif_receive_skb(skb); | 1589 | netif_receive_skb(skb); |
1590 | else if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) | 1590 | else if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) |
1591 | napi_gro_receive(&q_vector->napi, skb); | 1591 | napi_gro_receive(&q_vector->napi, skb); |
@@ -2097,7 +2097,7 @@ static int ixgbe_low_latency_recv(struct napi_struct *napi) | |||
2097 | 2097 | ||
2098 | ixgbe_for_each_ring(ring, q_vector->rx) { | 2098 | ixgbe_for_each_ring(ring, q_vector->rx) { |
2099 | found = ixgbe_clean_rx_irq(q_vector, ring, 4); | 2099 | found = ixgbe_clean_rx_irq(q_vector, ring, 4); |
2100 | #ifdef LL_EXTENDED_STATS | 2100 | #ifdef BP_EXTENDED_STATS |
2101 | if (found) | 2101 | if (found) |
2102 | ring->stats.cleaned += found; | 2102 | ring->stats.cleaned += found; |
2103 | else | 2103 | else |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h index 24af12e3719e..aae900a256da 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | |||
@@ -57,28 +57,28 @@ | |||
57 | #define IXGBE_SFF_QSFP_DEVICE_TECH 0x93 | 57 | #define IXGBE_SFF_QSFP_DEVICE_TECH 0x93 |
58 | 58 | ||
59 | /* Bitmasks */ | 59 | /* Bitmasks */ |
60 | #define IXGBE_SFF_DA_PASSIVE_CABLE 0x4 | 60 | #define IXGBE_SFF_DA_PASSIVE_CABLE 0x4 |
61 | #define IXGBE_SFF_DA_ACTIVE_CABLE 0x8 | 61 | #define IXGBE_SFF_DA_ACTIVE_CABLE 0x8 |
62 | #define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 | 62 | #define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 |
63 | #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 | 63 | #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 |
64 | #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 | 64 | #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 |
65 | #define IXGBE_SFF_1GBASET_CAPABLE 0x8 | 65 | #define IXGBE_SFF_1GBASET_CAPABLE 0x8 |
66 | #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 | 66 | #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 |
67 | #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 | 67 | #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 |
68 | #define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8 | 68 | #define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8 |
69 | #define IXGBE_SFF_SOFT_RS_SELECT_10G 0x8 | 69 | #define IXGBE_SFF_SOFT_RS_SELECT_10G 0x8 |
70 | #define IXGBE_SFF_SOFT_RS_SELECT_1G 0x0 | 70 | #define IXGBE_SFF_SOFT_RS_SELECT_1G 0x0 |
71 | #define IXGBE_SFF_ADDRESSING_MODE 0x4 | 71 | #define IXGBE_SFF_ADDRESSING_MODE 0x4 |
72 | #define IXGBE_SFF_QSFP_DA_ACTIVE_CABLE 0x1 | 72 | #define IXGBE_SFF_QSFP_DA_ACTIVE_CABLE 0x1 |
73 | #define IXGBE_SFF_QSFP_DA_PASSIVE_CABLE 0x8 | 73 | #define IXGBE_SFF_QSFP_DA_PASSIVE_CABLE 0x8 |
74 | #define IXGBE_SFF_QSFP_CONNECTOR_NOT_SEPARABLE 0x23 | 74 | #define IXGBE_SFF_QSFP_CONNECTOR_NOT_SEPARABLE 0x23 |
75 | #define IXGBE_SFF_QSFP_TRANSMITER_850NM_VCSEL 0x0 | 75 | #define IXGBE_SFF_QSFP_TRANSMITER_850NM_VCSEL 0x0 |
76 | #define IXGBE_I2C_EEPROM_READ_MASK 0x100 | 76 | #define IXGBE_I2C_EEPROM_READ_MASK 0x100 |
77 | #define IXGBE_I2C_EEPROM_STATUS_MASK 0x3 | 77 | #define IXGBE_I2C_EEPROM_STATUS_MASK 0x3 |
78 | #define IXGBE_I2C_EEPROM_STATUS_NO_OPERATION 0x0 | 78 | #define IXGBE_I2C_EEPROM_STATUS_NO_OPERATION 0x0 |
79 | #define IXGBE_I2C_EEPROM_STATUS_PASS 0x1 | 79 | #define IXGBE_I2C_EEPROM_STATUS_PASS 0x1 |
80 | #define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2 | 80 | #define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2 |
81 | #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 | 81 | #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 |
82 | 82 | ||
83 | /* Flow control defines */ | 83 | /* Flow control defines */ |
84 | #define IXGBE_TAF_SYM_PAUSE 0x400 | 84 | #define IXGBE_TAF_SYM_PAUSE 0x400 |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index 10775cb9b6d8..7c19e969576f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | |||
@@ -561,6 +561,10 @@ struct ixgbe_thermal_sensor_data { | |||
561 | #define IXGBE_RTTDQSEL 0x04904 | 561 | #define IXGBE_RTTDQSEL 0x04904 |
562 | #define IXGBE_RTTDT1C 0x04908 | 562 | #define IXGBE_RTTDT1C 0x04908 |
563 | #define IXGBE_RTTDT1S 0x0490C | 563 | #define IXGBE_RTTDT1S 0x0490C |
564 | #define IXGBE_RTTQCNCR 0x08B00 | ||
565 | #define IXGBE_RTTQCNTG 0x04A90 | ||
566 | #define IXGBE_RTTBCNRD 0x0498C | ||
567 | #define IXGBE_RTTQCNRR 0x0498C | ||
564 | #define IXGBE_RTTDTECC 0x04990 | 568 | #define IXGBE_RTTDTECC 0x04990 |
565 | #define IXGBE_RTTDTECC_NO_BCN 0x00000100 | 569 | #define IXGBE_RTTDTECC_NO_BCN 0x00000100 |
566 | #define IXGBE_RTTBCNRC 0x04984 | 570 | #define IXGBE_RTTBCNRC 0x04984 |
@@ -570,6 +574,7 @@ struct ixgbe_thermal_sensor_data { | |||
570 | #define IXGBE_RTTBCNRC_RF_INT_MASK \ | 574 | #define IXGBE_RTTBCNRC_RF_INT_MASK \ |
571 | (IXGBE_RTTBCNRC_RF_DEC_MASK << IXGBE_RTTBCNRC_RF_INT_SHIFT) | 575 | (IXGBE_RTTBCNRC_RF_DEC_MASK << IXGBE_RTTBCNRC_RF_INT_SHIFT) |
572 | #define IXGBE_RTTBCNRM 0x04980 | 576 | #define IXGBE_RTTBCNRM 0x04980 |
577 | #define IXGBE_RTTQCNRM 0x04980 | ||
573 | 578 | ||
574 | /* FCoE DMA Context Registers */ | 579 | /* FCoE DMA Context Registers */ |
575 | #define IXGBE_FCPTRL 0x02410 /* FC User Desc. PTR Low */ | 580 | #define IXGBE_FCPTRL 0x02410 /* FC User Desc. PTR Low */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c index 389324f5929a..24b80a6cfca4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | |||
@@ -32,12 +32,12 @@ | |||
32 | #include "ixgbe.h" | 32 | #include "ixgbe.h" |
33 | #include "ixgbe_phy.h" | 33 | #include "ixgbe_phy.h" |
34 | 34 | ||
35 | #define IXGBE_X540_MAX_TX_QUEUES 128 | 35 | #define IXGBE_X540_MAX_TX_QUEUES 128 |
36 | #define IXGBE_X540_MAX_RX_QUEUES 128 | 36 | #define IXGBE_X540_MAX_RX_QUEUES 128 |
37 | #define IXGBE_X540_RAR_ENTRIES 128 | 37 | #define IXGBE_X540_RAR_ENTRIES 128 |
38 | #define IXGBE_X540_MC_TBL_SIZE 128 | 38 | #define IXGBE_X540_MC_TBL_SIZE 128 |
39 | #define IXGBE_X540_VFT_TBL_SIZE 128 | 39 | #define IXGBE_X540_VFT_TBL_SIZE 128 |
40 | #define IXGBE_X540_RX_PB_SIZE 384 | 40 | #define IXGBE_X540_RX_PB_SIZE 384 |
41 | 41 | ||
42 | static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw); | 42 | static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw); |
43 | static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw); | 43 | static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw); |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c index c9d0c12d6f04..84329b0d567a 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c | |||
@@ -140,58 +140,10 @@ static void ixgbevf_set_msglevel(struct net_device *netdev, u32 data) | |||
140 | 140 | ||
141 | #define IXGBE_GET_STAT(_A_, _R_) (_A_->stats._R_) | 141 | #define IXGBE_GET_STAT(_A_, _R_) (_A_->stats._R_) |
142 | 142 | ||
143 | static char *ixgbevf_reg_names[] = { | ||
144 | "IXGBE_VFCTRL", | ||
145 | "IXGBE_VFSTATUS", | ||
146 | "IXGBE_VFLINKS", | ||
147 | "IXGBE_VFRXMEMWRAP", | ||
148 | "IXGBE_VFFRTIMER", | ||
149 | "IXGBE_VTEICR", | ||
150 | "IXGBE_VTEICS", | ||
151 | "IXGBE_VTEIMS", | ||
152 | "IXGBE_VTEIMC", | ||
153 | "IXGBE_VTEIAC", | ||
154 | "IXGBE_VTEIAM", | ||
155 | "IXGBE_VTEITR", | ||
156 | "IXGBE_VTIVAR", | ||
157 | "IXGBE_VTIVAR_MISC", | ||
158 | "IXGBE_VFRDBAL0", | ||
159 | "IXGBE_VFRDBAL1", | ||
160 | "IXGBE_VFRDBAH0", | ||
161 | "IXGBE_VFRDBAH1", | ||
162 | "IXGBE_VFRDLEN0", | ||
163 | "IXGBE_VFRDLEN1", | ||
164 | "IXGBE_VFRDH0", | ||
165 | "IXGBE_VFRDH1", | ||
166 | "IXGBE_VFRDT0", | ||
167 | "IXGBE_VFRDT1", | ||
168 | "IXGBE_VFRXDCTL0", | ||
169 | "IXGBE_VFRXDCTL1", | ||
170 | "IXGBE_VFSRRCTL0", | ||
171 | "IXGBE_VFSRRCTL1", | ||
172 | "IXGBE_VFPSRTYPE", | ||
173 | "IXGBE_VFTDBAL0", | ||
174 | "IXGBE_VFTDBAL1", | ||
175 | "IXGBE_VFTDBAH0", | ||
176 | "IXGBE_VFTDBAH1", | ||
177 | "IXGBE_VFTDLEN0", | ||
178 | "IXGBE_VFTDLEN1", | ||
179 | "IXGBE_VFTDH0", | ||
180 | "IXGBE_VFTDH1", | ||
181 | "IXGBE_VFTDT0", | ||
182 | "IXGBE_VFTDT1", | ||
183 | "IXGBE_VFTXDCTL0", | ||
184 | "IXGBE_VFTXDCTL1", | ||
185 | "IXGBE_VFTDWBAL0", | ||
186 | "IXGBE_VFTDWBAL1", | ||
187 | "IXGBE_VFTDWBAH0", | ||
188 | "IXGBE_VFTDWBAH1" | ||
189 | }; | ||
190 | |||
191 | |||
192 | static int ixgbevf_get_regs_len(struct net_device *netdev) | 143 | static int ixgbevf_get_regs_len(struct net_device *netdev) |
193 | { | 144 | { |
194 | return (ARRAY_SIZE(ixgbevf_reg_names)) * sizeof(u32); | 145 | #define IXGBE_REGS_LEN 45 |
146 | return IXGBE_REGS_LEN * sizeof(u32); | ||
195 | } | 147 | } |
196 | 148 | ||
197 | static void ixgbevf_get_regs(struct net_device *netdev, | 149 | static void ixgbevf_get_regs(struct net_device *netdev, |
@@ -264,9 +216,6 @@ static void ixgbevf_get_regs(struct net_device *netdev, | |||
264 | regs_buff[41 + i] = IXGBE_READ_REG(hw, IXGBE_VFTDWBAL(i)); | 216 | regs_buff[41 + i] = IXGBE_READ_REG(hw, IXGBE_VFTDWBAL(i)); |
265 | for (i = 0; i < 2; i++) | 217 | for (i = 0; i < 2; i++) |
266 | regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_VFTDWBAH(i)); | 218 | regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_VFTDWBAH(i)); |
267 | |||
268 | for (i = 0; i < ARRAY_SIZE(ixgbevf_reg_names); i++) | ||
269 | hw_dbg(hw, "%s\t%8.8x\n", ixgbevf_reg_names[i], regs_buff[i]); | ||
270 | } | 219 | } |
271 | 220 | ||
272 | static void ixgbevf_get_drvinfo(struct net_device *netdev, | 221 | static void ixgbevf_get_drvinfo(struct net_device *netdev, |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h index fff0d9867529..64a2b912e73c 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | |||
@@ -281,27 +281,23 @@ extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops; | |||
281 | extern const char ixgbevf_driver_name[]; | 281 | extern const char ixgbevf_driver_name[]; |
282 | extern const char ixgbevf_driver_version[]; | 282 | extern const char ixgbevf_driver_version[]; |
283 | 283 | ||
284 | extern void ixgbevf_up(struct ixgbevf_adapter *adapter); | 284 | void ixgbevf_up(struct ixgbevf_adapter *adapter); |
285 | extern void ixgbevf_down(struct ixgbevf_adapter *adapter); | 285 | void ixgbevf_down(struct ixgbevf_adapter *adapter); |
286 | extern void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter); | 286 | void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter); |
287 | extern void ixgbevf_reset(struct ixgbevf_adapter *adapter); | 287 | void ixgbevf_reset(struct ixgbevf_adapter *adapter); |
288 | extern void ixgbevf_set_ethtool_ops(struct net_device *netdev); | 288 | void ixgbevf_set_ethtool_ops(struct net_device *netdev); |
289 | extern int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *, | 289 | int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *, struct ixgbevf_ring *); |
290 | struct ixgbevf_ring *); | 290 | int ixgbevf_setup_tx_resources(struct ixgbevf_adapter *, struct ixgbevf_ring *); |
291 | extern int ixgbevf_setup_tx_resources(struct ixgbevf_adapter *, | 291 | void ixgbevf_free_rx_resources(struct ixgbevf_adapter *, struct ixgbevf_ring *); |
292 | struct ixgbevf_ring *); | 292 | void ixgbevf_free_tx_resources(struct ixgbevf_adapter *, struct ixgbevf_ring *); |
293 | extern void ixgbevf_free_rx_resources(struct ixgbevf_adapter *, | 293 | void ixgbevf_update_stats(struct ixgbevf_adapter *adapter); |
294 | struct ixgbevf_ring *); | 294 | int ethtool_ioctl(struct ifreq *ifr); |
295 | extern void ixgbevf_free_tx_resources(struct ixgbevf_adapter *, | 295 | |
296 | struct ixgbevf_ring *); | 296 | void ixgbe_napi_add_all(struct ixgbevf_adapter *adapter); |
297 | extern void ixgbevf_update_stats(struct ixgbevf_adapter *adapter); | 297 | void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter); |
298 | extern int ethtool_ioctl(struct ifreq *ifr); | ||
299 | |||
300 | extern void ixgbe_napi_add_all(struct ixgbevf_adapter *adapter); | ||
301 | extern void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter); | ||
302 | 298 | ||
303 | #ifdef DEBUG | 299 | #ifdef DEBUG |
304 | extern char *ixgbevf_get_hw_dev_name(struct ixgbe_hw *hw); | 300 | char *ixgbevf_get_hw_dev_name(struct ixgbe_hw *hw); |
305 | #define hw_dbg(hw, format, arg...) \ | 301 | #define hw_dbg(hw, format, arg...) \ |
306 | printk(KERN_DEBUG "%s: " format, ixgbevf_get_hw_dev_name(hw), ##arg) | 302 | printk(KERN_DEBUG "%s: " format, ixgbevf_get_hw_dev_name(hw), ##arg) |
307 | #else | 303 | #else |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 59a62bbfb371..ce27d62f9c8e 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -756,37 +756,12 @@ static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector) | |||
756 | static irqreturn_t ixgbevf_msix_other(int irq, void *data) | 756 | static irqreturn_t ixgbevf_msix_other(int irq, void *data) |
757 | { | 757 | { |
758 | struct ixgbevf_adapter *adapter = data; | 758 | struct ixgbevf_adapter *adapter = data; |
759 | struct pci_dev *pdev = adapter->pdev; | ||
760 | struct ixgbe_hw *hw = &adapter->hw; | 759 | struct ixgbe_hw *hw = &adapter->hw; |
761 | u32 msg; | ||
762 | bool got_ack = false; | ||
763 | 760 | ||
764 | hw->mac.get_link_status = 1; | 761 | hw->mac.get_link_status = 1; |
765 | if (!hw->mbx.ops.check_for_ack(hw)) | ||
766 | got_ack = true; | ||
767 | |||
768 | if (!hw->mbx.ops.check_for_msg(hw)) { | ||
769 | hw->mbx.ops.read(hw, &msg, 1); | ||
770 | |||
771 | if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG) { | ||
772 | mod_timer(&adapter->watchdog_timer, | ||
773 | round_jiffies(jiffies + 1)); | ||
774 | adapter->link_up = false; | ||
775 | } | ||
776 | 762 | ||
777 | if (msg & IXGBE_VT_MSGTYPE_NACK) | 763 | if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) |
778 | dev_info(&pdev->dev, | 764 | mod_timer(&adapter->watchdog_timer, jiffies); |
779 | "Last Request of type %2.2x to PF Nacked\n", | ||
780 | msg & 0xFF); | ||
781 | hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFSTS; | ||
782 | } | ||
783 | |||
784 | /* checking for the ack clears the PFACK bit. Place | ||
785 | * it back in the v2p_mailbox cache so that anyone | ||
786 | * polling for an ack will not miss it | ||
787 | */ | ||
788 | if (got_ack) | ||
789 | hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFACK; | ||
790 | 765 | ||
791 | IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, adapter->eims_other); | 766 | IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, adapter->eims_other); |
792 | 767 | ||
@@ -1327,27 +1302,51 @@ static void ixgbevf_configure(struct ixgbevf_adapter *adapter) | |||
1327 | } | 1302 | } |
1328 | } | 1303 | } |
1329 | 1304 | ||
1330 | #define IXGBE_MAX_RX_DESC_POLL 10 | 1305 | #define IXGBEVF_MAX_RX_DESC_POLL 10 |
1331 | static inline void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, | 1306 | static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, |
1332 | int rxr) | 1307 | int rxr) |
1333 | { | 1308 | { |
1334 | struct ixgbe_hw *hw = &adapter->hw; | 1309 | struct ixgbe_hw *hw = &adapter->hw; |
1310 | int wait_loop = IXGBEVF_MAX_RX_DESC_POLL; | ||
1311 | u32 rxdctl; | ||
1335 | int j = adapter->rx_ring[rxr].reg_idx; | 1312 | int j = adapter->rx_ring[rxr].reg_idx; |
1336 | int k; | ||
1337 | 1313 | ||
1338 | for (k = 0; k < IXGBE_MAX_RX_DESC_POLL; k++) { | 1314 | do { |
1339 | if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)) & IXGBE_RXDCTL_ENABLE) | 1315 | usleep_range(1000, 2000); |
1340 | break; | 1316 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); |
1341 | else | 1317 | } while (--wait_loop && !(rxdctl & IXGBE_RXDCTL_ENABLE)); |
1342 | msleep(1); | 1318 | |
1343 | } | 1319 | if (!wait_loop) |
1344 | if (k >= IXGBE_MAX_RX_DESC_POLL) { | 1320 | hw_dbg(hw, "RXDCTL.ENABLE queue %d not set while polling\n", |
1345 | hw_dbg(hw, "RXDCTL.ENABLE on Rx queue %d " | 1321 | rxr); |
1346 | "not set within the polling period\n", rxr); | 1322 | |
1347 | } | 1323 | ixgbevf_release_rx_desc(&adapter->hw, &adapter->rx_ring[rxr], |
1324 | (adapter->rx_ring[rxr].count - 1)); | ||
1325 | } | ||
1326 | |||
1327 | static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter, | ||
1328 | struct ixgbevf_ring *ring) | ||
1329 | { | ||
1330 | struct ixgbe_hw *hw = &adapter->hw; | ||
1331 | int wait_loop = IXGBEVF_MAX_RX_DESC_POLL; | ||
1332 | u32 rxdctl; | ||
1333 | u8 reg_idx = ring->reg_idx; | ||
1348 | 1334 | ||
1349 | ixgbevf_release_rx_desc(hw, &adapter->rx_ring[rxr], | 1335 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); |
1350 | adapter->rx_ring[rxr].count - 1); | 1336 | rxdctl &= ~IXGBE_RXDCTL_ENABLE; |
1337 | |||
1338 | /* write value back with RXDCTL.ENABLE bit cleared */ | ||
1339 | IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(reg_idx), rxdctl); | ||
1340 | |||
1341 | /* the hardware may take up to 100us to really disable the rx queue */ | ||
1342 | do { | ||
1343 | udelay(10); | ||
1344 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); | ||
1345 | } while (--wait_loop && (rxdctl & IXGBE_RXDCTL_ENABLE)); | ||
1346 | |||
1347 | if (!wait_loop) | ||
1348 | hw_dbg(hw, "RXDCTL.ENABLE queue %d not cleared while polling\n", | ||
1349 | reg_idx); | ||
1351 | } | 1350 | } |
1352 | 1351 | ||
1353 | static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter) | 1352 | static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter) |
@@ -1545,8 +1544,6 @@ void ixgbevf_up(struct ixgbevf_adapter *adapter) | |||
1545 | { | 1544 | { |
1546 | struct ixgbe_hw *hw = &adapter->hw; | 1545 | struct ixgbe_hw *hw = &adapter->hw; |
1547 | 1546 | ||
1548 | ixgbevf_negotiate_api(adapter); | ||
1549 | |||
1550 | ixgbevf_reset_queues(adapter); | 1547 | ixgbevf_reset_queues(adapter); |
1551 | 1548 | ||
1552 | ixgbevf_configure(adapter); | 1549 | ixgbevf_configure(adapter); |
@@ -1679,7 +1676,10 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter) | |||
1679 | 1676 | ||
1680 | /* signal that we are down to the interrupt handler */ | 1677 | /* signal that we are down to the interrupt handler */ |
1681 | set_bit(__IXGBEVF_DOWN, &adapter->state); | 1678 | set_bit(__IXGBEVF_DOWN, &adapter->state); |
1682 | /* disable receives */ | 1679 | |
1680 | /* disable all enabled rx queues */ | ||
1681 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
1682 | ixgbevf_disable_rx_queue(adapter, &adapter->rx_ring[i]); | ||
1683 | 1683 | ||
1684 | netif_tx_disable(netdev); | 1684 | netif_tx_disable(netdev); |
1685 | 1685 | ||
@@ -1733,10 +1733,12 @@ void ixgbevf_reset(struct ixgbevf_adapter *adapter) | |||
1733 | struct ixgbe_hw *hw = &adapter->hw; | 1733 | struct ixgbe_hw *hw = &adapter->hw; |
1734 | struct net_device *netdev = adapter->netdev; | 1734 | struct net_device *netdev = adapter->netdev; |
1735 | 1735 | ||
1736 | if (hw->mac.ops.reset_hw(hw)) | 1736 | if (hw->mac.ops.reset_hw(hw)) { |
1737 | hw_dbg(hw, "PF still resetting\n"); | 1737 | hw_dbg(hw, "PF still resetting\n"); |
1738 | else | 1738 | } else { |
1739 | hw->mac.ops.init_hw(hw); | 1739 | hw->mac.ops.init_hw(hw); |
1740 | ixgbevf_negotiate_api(adapter); | ||
1741 | } | ||
1740 | 1742 | ||
1741 | if (is_valid_ether_addr(adapter->hw.mac.addr)) { | 1743 | if (is_valid_ether_addr(adapter->hw.mac.addr)) { |
1742 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, | 1744 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, |
@@ -2072,6 +2074,9 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter) | |||
2072 | hw->mac.max_tx_queues = 2; | 2074 | hw->mac.max_tx_queues = 2; |
2073 | hw->mac.max_rx_queues = 2; | 2075 | hw->mac.max_rx_queues = 2; |
2074 | 2076 | ||
2077 | /* lock to protect mailbox accesses */ | ||
2078 | spin_lock_init(&adapter->mbx_lock); | ||
2079 | |||
2075 | err = hw->mac.ops.reset_hw(hw); | 2080 | err = hw->mac.ops.reset_hw(hw); |
2076 | if (err) { | 2081 | if (err) { |
2077 | dev_info(&pdev->dev, | 2082 | dev_info(&pdev->dev, |
@@ -2082,6 +2087,7 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter) | |||
2082 | pr_err("init_shared_code failed: %d\n", err); | 2087 | pr_err("init_shared_code failed: %d\n", err); |
2083 | goto out; | 2088 | goto out; |
2084 | } | 2089 | } |
2090 | ixgbevf_negotiate_api(adapter); | ||
2085 | err = hw->mac.ops.get_mac_addr(hw, hw->mac.addr); | 2091 | err = hw->mac.ops.get_mac_addr(hw, hw->mac.addr); |
2086 | if (err) | 2092 | if (err) |
2087 | dev_info(&pdev->dev, "Error reading MAC address\n"); | 2093 | dev_info(&pdev->dev, "Error reading MAC address\n"); |
@@ -2097,9 +2103,6 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter) | |||
2097 | memcpy(hw->mac.addr, netdev->dev_addr, netdev->addr_len); | 2103 | memcpy(hw->mac.addr, netdev->dev_addr, netdev->addr_len); |
2098 | } | 2104 | } |
2099 | 2105 | ||
2100 | /* lock to protect mailbox accesses */ | ||
2101 | spin_lock_init(&adapter->mbx_lock); | ||
2102 | |||
2103 | /* Enable dynamic interrupt throttling rates */ | 2106 | /* Enable dynamic interrupt throttling rates */ |
2104 | adapter->rx_itr_setting = 1; | 2107 | adapter->rx_itr_setting = 1; |
2105 | adapter->tx_itr_setting = 1; | 2108 | adapter->tx_itr_setting = 1; |
@@ -2620,8 +2623,6 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2620 | } | 2623 | } |
2621 | } | 2624 | } |
2622 | 2625 | ||
2623 | ixgbevf_negotiate_api(adapter); | ||
2624 | |||
2625 | /* setup queue reg_idx and Rx queue count */ | 2626 | /* setup queue reg_idx and Rx queue count */ |
2626 | err = ixgbevf_setup_queues(adapter); | 2627 | err = ixgbevf_setup_queues(adapter); |
2627 | if (err) | 2628 | if (err) |
@@ -3216,6 +3217,8 @@ static int ixgbevf_resume(struct pci_dev *pdev) | |||
3216 | } | 3217 | } |
3217 | pci_set_master(pdev); | 3218 | pci_set_master(pdev); |
3218 | 3219 | ||
3220 | ixgbevf_reset(adapter); | ||
3221 | |||
3219 | rtnl_lock(); | 3222 | rtnl_lock(); |
3220 | err = ixgbevf_init_interrupt_scheme(adapter); | 3223 | err = ixgbevf_init_interrupt_scheme(adapter); |
3221 | rtnl_unlock(); | 3224 | rtnl_unlock(); |
@@ -3224,8 +3227,6 @@ static int ixgbevf_resume(struct pci_dev *pdev) | |||
3224 | return err; | 3227 | return err; |
3225 | } | 3228 | } |
3226 | 3229 | ||
3227 | ixgbevf_reset(adapter); | ||
3228 | |||
3229 | if (netif_running(netdev)) { | 3230 | if (netif_running(netdev)) { |
3230 | err = ixgbevf_open(netdev); | 3231 | err = ixgbevf_open(netdev); |
3231 | if (err) | 3232 | if (err) |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h index 6797b1075874..2a9003071d51 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | |||
@@ -653,38 +653,38 @@ struct pch_gbe_adapter { | |||
653 | extern const char pch_driver_version[]; | 653 | extern const char pch_driver_version[]; |
654 | 654 | ||
655 | /* pch_gbe_main.c */ | 655 | /* pch_gbe_main.c */ |
656 | extern int pch_gbe_up(struct pch_gbe_adapter *adapter); | 656 | int pch_gbe_up(struct pch_gbe_adapter *adapter); |
657 | extern void pch_gbe_down(struct pch_gbe_adapter *adapter); | 657 | void pch_gbe_down(struct pch_gbe_adapter *adapter); |
658 | extern void pch_gbe_reinit_locked(struct pch_gbe_adapter *adapter); | 658 | void pch_gbe_reinit_locked(struct pch_gbe_adapter *adapter); |
659 | extern void pch_gbe_reset(struct pch_gbe_adapter *adapter); | 659 | void pch_gbe_reset(struct pch_gbe_adapter *adapter); |
660 | extern int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter, | 660 | int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter, |
661 | struct pch_gbe_tx_ring *txdr); | 661 | struct pch_gbe_tx_ring *txdr); |
662 | extern int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter, | 662 | int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter, |
663 | struct pch_gbe_rx_ring *rxdr); | 663 | struct pch_gbe_rx_ring *rxdr); |
664 | extern void pch_gbe_free_tx_resources(struct pch_gbe_adapter *adapter, | 664 | void pch_gbe_free_tx_resources(struct pch_gbe_adapter *adapter, |
665 | struct pch_gbe_tx_ring *tx_ring); | 665 | struct pch_gbe_tx_ring *tx_ring); |
666 | extern void pch_gbe_free_rx_resources(struct pch_gbe_adapter *adapter, | 666 | void pch_gbe_free_rx_resources(struct pch_gbe_adapter *adapter, |
667 | struct pch_gbe_rx_ring *rx_ring); | 667 | struct pch_gbe_rx_ring *rx_ring); |
668 | extern void pch_gbe_update_stats(struct pch_gbe_adapter *adapter); | 668 | void pch_gbe_update_stats(struct pch_gbe_adapter *adapter); |
669 | extern u32 pch_ch_control_read(struct pci_dev *pdev); | 669 | u32 pch_ch_control_read(struct pci_dev *pdev); |
670 | extern void pch_ch_control_write(struct pci_dev *pdev, u32 val); | 670 | void pch_ch_control_write(struct pci_dev *pdev, u32 val); |
671 | extern u32 pch_ch_event_read(struct pci_dev *pdev); | 671 | u32 pch_ch_event_read(struct pci_dev *pdev); |
672 | extern void pch_ch_event_write(struct pci_dev *pdev, u32 val); | 672 | void pch_ch_event_write(struct pci_dev *pdev, u32 val); |
673 | extern u32 pch_src_uuid_lo_read(struct pci_dev *pdev); | 673 | u32 pch_src_uuid_lo_read(struct pci_dev *pdev); |
674 | extern u32 pch_src_uuid_hi_read(struct pci_dev *pdev); | 674 | u32 pch_src_uuid_hi_read(struct pci_dev *pdev); |
675 | extern u64 pch_rx_snap_read(struct pci_dev *pdev); | 675 | u64 pch_rx_snap_read(struct pci_dev *pdev); |
676 | extern u64 pch_tx_snap_read(struct pci_dev *pdev); | 676 | u64 pch_tx_snap_read(struct pci_dev *pdev); |
677 | extern int pch_set_station_address(u8 *addr, struct pci_dev *pdev); | 677 | int pch_set_station_address(u8 *addr, struct pci_dev *pdev); |
678 | 678 | ||
679 | /* pch_gbe_param.c */ | 679 | /* pch_gbe_param.c */ |
680 | extern void pch_gbe_check_options(struct pch_gbe_adapter *adapter); | 680 | void pch_gbe_check_options(struct pch_gbe_adapter *adapter); |
681 | 681 | ||
682 | /* pch_gbe_ethtool.c */ | 682 | /* pch_gbe_ethtool.c */ |
683 | extern void pch_gbe_set_ethtool_ops(struct net_device *netdev); | 683 | void pch_gbe_set_ethtool_ops(struct net_device *netdev); |
684 | 684 | ||
685 | /* pch_gbe_mac.c */ | 685 | /* pch_gbe_mac.c */ |
686 | extern s32 pch_gbe_mac_force_mac_fc(struct pch_gbe_hw *hw); | 686 | s32 pch_gbe_mac_force_mac_fc(struct pch_gbe_hw *hw); |
687 | extern s32 pch_gbe_mac_read_mac_addr(struct pch_gbe_hw *hw); | 687 | s32 pch_gbe_mac_read_mac_addr(struct pch_gbe_hw *hw); |
688 | extern u16 pch_gbe_mac_ctrl_miim(struct pch_gbe_hw *hw, | 688 | u16 pch_gbe_mac_ctrl_miim(struct pch_gbe_hw *hw, u32 addr, u32 dir, u32 reg, |
689 | u32 addr, u32 dir, u32 reg, u16 data); | 689 | u16 data); |
690 | #endif /* _PCH_GBE_H_ */ | 690 | #endif /* _PCH_GBE_H_ */ |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h index 32675e16021e..9adcdbb49476 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h | |||
@@ -53,8 +53,8 @@ | |||
53 | 53 | ||
54 | #define _NETXEN_NIC_LINUX_MAJOR 4 | 54 | #define _NETXEN_NIC_LINUX_MAJOR 4 |
55 | #define _NETXEN_NIC_LINUX_MINOR 0 | 55 | #define _NETXEN_NIC_LINUX_MINOR 0 |
56 | #define _NETXEN_NIC_LINUX_SUBVERSION 81 | 56 | #define _NETXEN_NIC_LINUX_SUBVERSION 82 |
57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.81" | 57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.82" |
58 | 58 | ||
59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) | 59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
60 | #define _major(v) (((v) >> 24) & 0xff) | 60 | #define _major(v) (((v) >> 24) & 0xff) |
@@ -1883,9 +1883,8 @@ static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring) | |||
1883 | 1883 | ||
1884 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 *mac); | 1884 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 *mac); |
1885 | int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, u64 *mac); | 1885 | int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, u64 *mac); |
1886 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); | 1886 | void netxen_change_ringparam(struct netxen_adapter *adapter); |
1887 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, | 1887 | int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp); |
1888 | int *valp); | ||
1889 | 1888 | ||
1890 | extern const struct ethtool_ops netxen_nic_ethtool_ops; | 1889 | extern const struct ethtool_ops netxen_nic_ethtool_ops; |
1891 | 1890 | ||
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h index 32c790659f9c..0c64c82b9acf 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h | |||
@@ -958,6 +958,7 @@ enum { | |||
958 | #define NETXEN_PEG_HALT_STATUS2 (NETXEN_CAM_RAM(0xac)) | 958 | #define NETXEN_PEG_HALT_STATUS2 (NETXEN_CAM_RAM(0xac)) |
959 | #define NX_CRB_DEV_REF_COUNT (NETXEN_CAM_RAM(0x138)) | 959 | #define NX_CRB_DEV_REF_COUNT (NETXEN_CAM_RAM(0x138)) |
960 | #define NX_CRB_DEV_STATE (NETXEN_CAM_RAM(0x140)) | 960 | #define NX_CRB_DEV_STATE (NETXEN_CAM_RAM(0x140)) |
961 | #define NETXEN_ULA_KEY (NETXEN_CAM_RAM(0x178)) | ||
961 | 962 | ||
962 | /* MiniDIMM related macros */ | 963 | /* MiniDIMM related macros */ |
963 | #define NETXEN_DIMM_CAPABILITY (NETXEN_CAM_RAM(0x258)) | 964 | #define NETXEN_DIMM_CAPABILITY (NETXEN_CAM_RAM(0x258)) |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index cbd75f97ffb3..5ec21c50373c 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -1415,6 +1415,32 @@ netxen_setup_netdev(struct netxen_adapter *adapter, | |||
1415 | return 0; | 1415 | return 0; |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | #define NETXEN_ULA_ADAPTER_KEY (0xdaddad01) | ||
1419 | #define NETXEN_NON_ULA_ADAPTER_KEY (0xdaddad00) | ||
1420 | |||
1421 | static void netxen_read_ula_info(struct netxen_adapter *adapter) | ||
1422 | { | ||
1423 | u32 temp; | ||
1424 | |||
1425 | /* Print ULA info only once for an adapter */ | ||
1426 | if (adapter->portnum != 0) | ||
1427 | return; | ||
1428 | |||
1429 | temp = NXRD32(adapter, NETXEN_ULA_KEY); | ||
1430 | switch (temp) { | ||
1431 | case NETXEN_ULA_ADAPTER_KEY: | ||
1432 | dev_info(&adapter->pdev->dev, "ULA adapter"); | ||
1433 | break; | ||
1434 | case NETXEN_NON_ULA_ADAPTER_KEY: | ||
1435 | dev_info(&adapter->pdev->dev, "non ULA adapter"); | ||
1436 | break; | ||
1437 | default: | ||
1438 | break; | ||
1439 | } | ||
1440 | |||
1441 | return; | ||
1442 | } | ||
1443 | |||
1418 | #ifdef CONFIG_PCIEAER | 1444 | #ifdef CONFIG_PCIEAER |
1419 | static void netxen_mask_aer_correctable(struct netxen_adapter *adapter) | 1445 | static void netxen_mask_aer_correctable(struct netxen_adapter *adapter) |
1420 | { | 1446 | { |
@@ -1561,6 +1587,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1561 | goto err_out_disable_msi; | 1587 | goto err_out_disable_msi; |
1562 | } | 1588 | } |
1563 | 1589 | ||
1590 | netxen_read_ula_info(adapter); | ||
1591 | |||
1564 | err = netxen_setup_netdev(adapter, netdev); | 1592 | err = netxen_setup_netdev(adapter, netdev); |
1565 | if (err) | 1593 | if (err) |
1566 | goto err_out_disable_msi; | 1594 | goto err_out_disable_msi; |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index 899433778466..0c9c4e895595 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #define DRV_NAME "qlge" | 19 | #define DRV_NAME "qlge" |
20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " | 20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " |
21 | #define DRV_VERSION "v1.00.00.32" | 21 | #define DRV_VERSION "1.00.00.33" |
22 | 22 | ||
23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ | 23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ |
24 | 24 | ||
@@ -2206,14 +2206,14 @@ extern char qlge_driver_name[]; | |||
2206 | extern const char qlge_driver_version[]; | 2206 | extern const char qlge_driver_version[]; |
2207 | extern const struct ethtool_ops qlge_ethtool_ops; | 2207 | extern const struct ethtool_ops qlge_ethtool_ops; |
2208 | 2208 | ||
2209 | extern int ql_sem_spinlock(struct ql_adapter *qdev, u32 sem_mask); | 2209 | int ql_sem_spinlock(struct ql_adapter *qdev, u32 sem_mask); |
2210 | extern void ql_sem_unlock(struct ql_adapter *qdev, u32 sem_mask); | 2210 | void ql_sem_unlock(struct ql_adapter *qdev, u32 sem_mask); |
2211 | extern int ql_read_xgmac_reg(struct ql_adapter *qdev, u32 reg, u32 *data); | 2211 | int ql_read_xgmac_reg(struct ql_adapter *qdev, u32 reg, u32 *data); |
2212 | extern int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index, | 2212 | int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index, |
2213 | u32 *value); | 2213 | u32 *value); |
2214 | extern int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value); | 2214 | int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value); |
2215 | extern int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | 2215 | int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, |
2216 | u16 q_id); | 2216 | u16 q_id); |
2217 | void ql_queue_fw_error(struct ql_adapter *qdev); | 2217 | void ql_queue_fw_error(struct ql_adapter *qdev); |
2218 | void ql_mpi_work(struct work_struct *work); | 2218 | void ql_mpi_work(struct work_struct *work); |
2219 | void ql_mpi_reset_work(struct work_struct *work); | 2219 | void ql_mpi_reset_work(struct work_struct *work); |
@@ -2233,10 +2233,9 @@ int ql_unpause_mpi_risc(struct ql_adapter *qdev); | |||
2233 | int ql_pause_mpi_risc(struct ql_adapter *qdev); | 2233 | int ql_pause_mpi_risc(struct ql_adapter *qdev); |
2234 | int ql_hard_reset_mpi_risc(struct ql_adapter *qdev); | 2234 | int ql_hard_reset_mpi_risc(struct ql_adapter *qdev); |
2235 | int ql_soft_reset_mpi_risc(struct ql_adapter *qdev); | 2235 | int ql_soft_reset_mpi_risc(struct ql_adapter *qdev); |
2236 | int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf, | 2236 | int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf, u32 ram_addr, |
2237 | u32 ram_addr, int word_count); | 2237 | int word_count); |
2238 | int ql_core_dump(struct ql_adapter *qdev, | 2238 | int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump); |
2239 | struct ql_mpi_coredump *mpi_coredump); | ||
2240 | int ql_mb_about_fw(struct ql_adapter *qdev); | 2239 | int ql_mb_about_fw(struct ql_adapter *qdev); |
2241 | int ql_mb_wol_set_magic(struct ql_adapter *qdev, u32 enable_wol); | 2240 | int ql_mb_wol_set_magic(struct ql_adapter *qdev, u32 enable_wol); |
2242 | int ql_mb_wol_mode(struct ql_adapter *qdev, u32 wol); | 2241 | int ql_mb_wol_mode(struct ql_adapter *qdev, u32 wol); |
@@ -2249,8 +2248,7 @@ int ql_mb_get_port_cfg(struct ql_adapter *qdev); | |||
2249 | int ql_mb_set_port_cfg(struct ql_adapter *qdev); | 2248 | int ql_mb_set_port_cfg(struct ql_adapter *qdev); |
2250 | int ql_wait_fifo_empty(struct ql_adapter *qdev); | 2249 | int ql_wait_fifo_empty(struct ql_adapter *qdev); |
2251 | void ql_get_dump(struct ql_adapter *qdev, void *buff); | 2250 | void ql_get_dump(struct ql_adapter *qdev, void *buff); |
2252 | void ql_gen_reg_dump(struct ql_adapter *qdev, | 2251 | void ql_gen_reg_dump(struct ql_adapter *qdev, struct ql_reg_dump *mpi_coredump); |
2253 | struct ql_reg_dump *mpi_coredump); | ||
2254 | netdev_tx_t ql_lb_send(struct sk_buff *skb, struct net_device *ndev); | 2252 | netdev_tx_t ql_lb_send(struct sk_buff *skb, struct net_device *ndev); |
2255 | void ql_check_lb_frame(struct ql_adapter *, struct sk_buff *); | 2253 | void ql_check_lb_frame(struct ql_adapter *, struct sk_buff *); |
2256 | int ql_own_firmware(struct ql_adapter *qdev); | 2254 | int ql_own_firmware(struct ql_adapter *qdev); |
@@ -2264,9 +2262,9 @@ int ql_clean_lb_rx_ring(struct rx_ring *rx_ring, int budget); | |||
2264 | /* #define QL_OB_DUMP */ | 2262 | /* #define QL_OB_DUMP */ |
2265 | 2263 | ||
2266 | #ifdef QL_REG_DUMP | 2264 | #ifdef QL_REG_DUMP |
2267 | extern void ql_dump_xgmac_control_regs(struct ql_adapter *qdev); | 2265 | void ql_dump_xgmac_control_regs(struct ql_adapter *qdev); |
2268 | extern void ql_dump_routing_entries(struct ql_adapter *qdev); | 2266 | void ql_dump_routing_entries(struct ql_adapter *qdev); |
2269 | extern void ql_dump_regs(struct ql_adapter *qdev); | 2267 | void ql_dump_regs(struct ql_adapter *qdev); |
2270 | #define QL_DUMP_REGS(qdev) ql_dump_regs(qdev) | 2268 | #define QL_DUMP_REGS(qdev) ql_dump_regs(qdev) |
2271 | #define QL_DUMP_ROUTE(qdev) ql_dump_routing_entries(qdev) | 2269 | #define QL_DUMP_ROUTE(qdev) ql_dump_routing_entries(qdev) |
2272 | #define QL_DUMP_XGMAC_CONTROL_REGS(qdev) ql_dump_xgmac_control_regs(qdev) | 2270 | #define QL_DUMP_XGMAC_CONTROL_REGS(qdev) ql_dump_xgmac_control_regs(qdev) |
@@ -2277,26 +2275,26 @@ extern void ql_dump_regs(struct ql_adapter *qdev); | |||
2277 | #endif | 2275 | #endif |
2278 | 2276 | ||
2279 | #ifdef QL_STAT_DUMP | 2277 | #ifdef QL_STAT_DUMP |
2280 | extern void ql_dump_stat(struct ql_adapter *qdev); | 2278 | void ql_dump_stat(struct ql_adapter *qdev); |
2281 | #define QL_DUMP_STAT(qdev) ql_dump_stat(qdev) | 2279 | #define QL_DUMP_STAT(qdev) ql_dump_stat(qdev) |
2282 | #else | 2280 | #else |
2283 | #define QL_DUMP_STAT(qdev) | 2281 | #define QL_DUMP_STAT(qdev) |
2284 | #endif | 2282 | #endif |
2285 | 2283 | ||
2286 | #ifdef QL_DEV_DUMP | 2284 | #ifdef QL_DEV_DUMP |
2287 | extern void ql_dump_qdev(struct ql_adapter *qdev); | 2285 | void ql_dump_qdev(struct ql_adapter *qdev); |
2288 | #define QL_DUMP_QDEV(qdev) ql_dump_qdev(qdev) | 2286 | #define QL_DUMP_QDEV(qdev) ql_dump_qdev(qdev) |
2289 | #else | 2287 | #else |
2290 | #define QL_DUMP_QDEV(qdev) | 2288 | #define QL_DUMP_QDEV(qdev) |
2291 | #endif | 2289 | #endif |
2292 | 2290 | ||
2293 | #ifdef QL_CB_DUMP | 2291 | #ifdef QL_CB_DUMP |
2294 | extern void ql_dump_wqicb(struct wqicb *wqicb); | 2292 | void ql_dump_wqicb(struct wqicb *wqicb); |
2295 | extern void ql_dump_tx_ring(struct tx_ring *tx_ring); | 2293 | void ql_dump_tx_ring(struct tx_ring *tx_ring); |
2296 | extern void ql_dump_ricb(struct ricb *ricb); | 2294 | void ql_dump_ricb(struct ricb *ricb); |
2297 | extern void ql_dump_cqicb(struct cqicb *cqicb); | 2295 | void ql_dump_cqicb(struct cqicb *cqicb); |
2298 | extern void ql_dump_rx_ring(struct rx_ring *rx_ring); | 2296 | void ql_dump_rx_ring(struct rx_ring *rx_ring); |
2299 | extern void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id); | 2297 | void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id); |
2300 | #define QL_DUMP_RICB(ricb) ql_dump_ricb(ricb) | 2298 | #define QL_DUMP_RICB(ricb) ql_dump_ricb(ricb) |
2301 | #define QL_DUMP_WQICB(wqicb) ql_dump_wqicb(wqicb) | 2299 | #define QL_DUMP_WQICB(wqicb) ql_dump_wqicb(wqicb) |
2302 | #define QL_DUMP_TX_RING(tx_ring) ql_dump_tx_ring(tx_ring) | 2300 | #define QL_DUMP_TX_RING(tx_ring) ql_dump_tx_ring(tx_ring) |
@@ -2314,9 +2312,9 @@ extern void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id); | |||
2314 | #endif | 2312 | #endif |
2315 | 2313 | ||
2316 | #ifdef QL_OB_DUMP | 2314 | #ifdef QL_OB_DUMP |
2317 | extern void ql_dump_tx_desc(struct tx_buf_desc *tbd); | 2315 | void ql_dump_tx_desc(struct tx_buf_desc *tbd); |
2318 | extern void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb); | 2316 | void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb); |
2319 | extern void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp); | 2317 | void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp); |
2320 | #define QL_DUMP_OB_MAC_IOCB(ob_mac_iocb) ql_dump_ob_mac_iocb(ob_mac_iocb) | 2318 | #define QL_DUMP_OB_MAC_IOCB(ob_mac_iocb) ql_dump_ob_mac_iocb(ob_mac_iocb) |
2321 | #define QL_DUMP_OB_MAC_RSP(ob_mac_rsp) ql_dump_ob_mac_rsp(ob_mac_rsp) | 2319 | #define QL_DUMP_OB_MAC_RSP(ob_mac_rsp) ql_dump_ob_mac_rsp(ob_mac_rsp) |
2322 | #else | 2320 | #else |
@@ -2325,14 +2323,14 @@ extern void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp); | |||
2325 | #endif | 2323 | #endif |
2326 | 2324 | ||
2327 | #ifdef QL_IB_DUMP | 2325 | #ifdef QL_IB_DUMP |
2328 | extern void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp); | 2326 | void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp); |
2329 | #define QL_DUMP_IB_MAC_RSP(ib_mac_rsp) ql_dump_ib_mac_rsp(ib_mac_rsp) | 2327 | #define QL_DUMP_IB_MAC_RSP(ib_mac_rsp) ql_dump_ib_mac_rsp(ib_mac_rsp) |
2330 | #else | 2328 | #else |
2331 | #define QL_DUMP_IB_MAC_RSP(ib_mac_rsp) | 2329 | #define QL_DUMP_IB_MAC_RSP(ib_mac_rsp) |
2332 | #endif | 2330 | #endif |
2333 | 2331 | ||
2334 | #ifdef QL_ALL_DUMP | 2332 | #ifdef QL_ALL_DUMP |
2335 | extern void ql_dump_all(struct ql_adapter *qdev); | 2333 | void ql_dump_all(struct ql_adapter *qdev); |
2336 | #define QL_DUMP_ALL(qdev) ql_dump_all(qdev) | 2334 | #define QL_DUMP_ALL(qdev) ql_dump_all(qdev) |
2337 | #else | 2335 | #else |
2338 | #define QL_DUMP_ALL(qdev) | 2336 | #define QL_DUMP_ALL(qdev) |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 2553cf4503b9..64f94098bc02 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -96,8 +96,10 @@ static DEFINE_PCI_DEVICE_TABLE(qlge_pci_tbl) = { | |||
96 | 96 | ||
97 | MODULE_DEVICE_TABLE(pci, qlge_pci_tbl); | 97 | MODULE_DEVICE_TABLE(pci, qlge_pci_tbl); |
98 | 98 | ||
99 | static int ql_wol(struct ql_adapter *qdev); | 99 | static int ql_wol(struct ql_adapter *); |
100 | static void qlge_set_multicast_list(struct net_device *ndev); | 100 | static void qlge_set_multicast_list(struct net_device *); |
101 | static int ql_adapter_down(struct ql_adapter *); | ||
102 | static int ql_adapter_up(struct ql_adapter *); | ||
101 | 103 | ||
102 | /* This hardware semaphore causes exclusive access to | 104 | /* This hardware semaphore causes exclusive access to |
103 | * resources shared between the NIC driver, MPI firmware, | 105 | * resources shared between the NIC driver, MPI firmware, |
@@ -1464,6 +1466,29 @@ static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err, | |||
1464 | } | 1466 | } |
1465 | } | 1467 | } |
1466 | 1468 | ||
1469 | /** | ||
1470 | * ql_update_mac_hdr_len - helper routine to update the mac header length | ||
1471 | * based on vlan tags if present | ||
1472 | */ | ||
1473 | static void ql_update_mac_hdr_len(struct ql_adapter *qdev, | ||
1474 | struct ib_mac_iocb_rsp *ib_mac_rsp, | ||
1475 | void *page, size_t *len) | ||
1476 | { | ||
1477 | u16 *tags; | ||
1478 | |||
1479 | if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) | ||
1480 | return; | ||
1481 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) { | ||
1482 | tags = (u16 *)page; | ||
1483 | /* Look for stacked vlan tags in ethertype field */ | ||
1484 | if (tags[6] == ETH_P_8021Q && | ||
1485 | tags[8] == ETH_P_8021Q) | ||
1486 | *len += 2 * VLAN_HLEN; | ||
1487 | else | ||
1488 | *len += VLAN_HLEN; | ||
1489 | } | ||
1490 | } | ||
1491 | |||
1467 | /* Process an inbound completion from an rx ring. */ | 1492 | /* Process an inbound completion from an rx ring. */ |
1468 | static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, | 1493 | static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, |
1469 | struct rx_ring *rx_ring, | 1494 | struct rx_ring *rx_ring, |
@@ -1523,6 +1548,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, | |||
1523 | void *addr; | 1548 | void *addr; |
1524 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); | 1549 | struct bq_desc *lbq_desc = ql_get_curr_lchunk(qdev, rx_ring); |
1525 | struct napi_struct *napi = &rx_ring->napi; | 1550 | struct napi_struct *napi = &rx_ring->napi; |
1551 | size_t hlen = ETH_HLEN; | ||
1526 | 1552 | ||
1527 | skb = netdev_alloc_skb(ndev, length); | 1553 | skb = netdev_alloc_skb(ndev, length); |
1528 | if (!skb) { | 1554 | if (!skb) { |
@@ -1540,25 +1566,28 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, | |||
1540 | goto err_out; | 1566 | goto err_out; |
1541 | } | 1567 | } |
1542 | 1568 | ||
1569 | /* Update the MAC header length*/ | ||
1570 | ql_update_mac_hdr_len(qdev, ib_mac_rsp, addr, &hlen); | ||
1571 | |||
1543 | /* The max framesize filter on this chip is set higher than | 1572 | /* The max framesize filter on this chip is set higher than |
1544 | * MTU since FCoE uses 2k frames. | 1573 | * MTU since FCoE uses 2k frames. |
1545 | */ | 1574 | */ |
1546 | if (skb->len > ndev->mtu + ETH_HLEN) { | 1575 | if (skb->len > ndev->mtu + hlen) { |
1547 | netif_err(qdev, drv, qdev->ndev, | 1576 | netif_err(qdev, drv, qdev->ndev, |
1548 | "Segment too small, dropping.\n"); | 1577 | "Segment too small, dropping.\n"); |
1549 | rx_ring->rx_dropped++; | 1578 | rx_ring->rx_dropped++; |
1550 | goto err_out; | 1579 | goto err_out; |
1551 | } | 1580 | } |
1552 | memcpy(skb_put(skb, ETH_HLEN), addr, ETH_HLEN); | 1581 | memcpy(skb_put(skb, hlen), addr, hlen); |
1553 | netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, | 1582 | netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, |
1554 | "%d bytes of headers and data in large. Chain page to new skb and pull tail.\n", | 1583 | "%d bytes of headers and data in large. Chain page to new skb and pull tail.\n", |
1555 | length); | 1584 | length); |
1556 | skb_fill_page_desc(skb, 0, lbq_desc->p.pg_chunk.page, | 1585 | skb_fill_page_desc(skb, 0, lbq_desc->p.pg_chunk.page, |
1557 | lbq_desc->p.pg_chunk.offset+ETH_HLEN, | 1586 | lbq_desc->p.pg_chunk.offset + hlen, |
1558 | length-ETH_HLEN); | 1587 | length - hlen); |
1559 | skb->len += length-ETH_HLEN; | 1588 | skb->len += length - hlen; |
1560 | skb->data_len += length-ETH_HLEN; | 1589 | skb->data_len += length - hlen; |
1561 | skb->truesize += length-ETH_HLEN; | 1590 | skb->truesize += length - hlen; |
1562 | 1591 | ||
1563 | rx_ring->rx_packets++; | 1592 | rx_ring->rx_packets++; |
1564 | rx_ring->rx_bytes += skb->len; | 1593 | rx_ring->rx_bytes += skb->len; |
@@ -1576,7 +1605,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, | |||
1576 | (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_V4)) { | 1605 | (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_V4)) { |
1577 | /* Unfragmented ipv4 UDP frame. */ | 1606 | /* Unfragmented ipv4 UDP frame. */ |
1578 | struct iphdr *iph = | 1607 | struct iphdr *iph = |
1579 | (struct iphdr *) ((u8 *)addr + ETH_HLEN); | 1608 | (struct iphdr *)((u8 *)addr + hlen); |
1580 | if (!(iph->frag_off & | 1609 | if (!(iph->frag_off & |
1581 | htons(IP_MF|IP_OFFSET))) { | 1610 | htons(IP_MF|IP_OFFSET))) { |
1582 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1611 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1726,7 +1755,8 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev, | |||
1726 | struct bq_desc *sbq_desc; | 1755 | struct bq_desc *sbq_desc; |
1727 | struct sk_buff *skb = NULL; | 1756 | struct sk_buff *skb = NULL; |
1728 | u32 length = le32_to_cpu(ib_mac_rsp->data_len); | 1757 | u32 length = le32_to_cpu(ib_mac_rsp->data_len); |
1729 | u32 hdr_len = le32_to_cpu(ib_mac_rsp->hdr_len); | 1758 | u32 hdr_len = le32_to_cpu(ib_mac_rsp->hdr_len); |
1759 | size_t hlen = ETH_HLEN; | ||
1730 | 1760 | ||
1731 | /* | 1761 | /* |
1732 | * Handle the header buffer if present. | 1762 | * Handle the header buffer if present. |
@@ -1853,9 +1883,10 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev, | |||
1853 | skb->data_len += length; | 1883 | skb->data_len += length; |
1854 | skb->truesize += length; | 1884 | skb->truesize += length; |
1855 | length -= length; | 1885 | length -= length; |
1856 | __pskb_pull_tail(skb, | 1886 | ql_update_mac_hdr_len(qdev, ib_mac_rsp, |
1857 | (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) ? | 1887 | lbq_desc->p.pg_chunk.va, |
1858 | VLAN_ETH_HLEN : ETH_HLEN); | 1888 | &hlen); |
1889 | __pskb_pull_tail(skb, hlen); | ||
1859 | } | 1890 | } |
1860 | } else { | 1891 | } else { |
1861 | /* | 1892 | /* |
@@ -1910,8 +1941,9 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev, | |||
1910 | length -= size; | 1941 | length -= size; |
1911 | i++; | 1942 | i++; |
1912 | } | 1943 | } |
1913 | __pskb_pull_tail(skb, (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) ? | 1944 | ql_update_mac_hdr_len(qdev, ib_mac_rsp, lbq_desc->p.pg_chunk.va, |
1914 | VLAN_ETH_HLEN : ETH_HLEN); | 1945 | &hlen); |
1946 | __pskb_pull_tail(skb, hlen); | ||
1915 | } | 1947 | } |
1916 | return skb; | 1948 | return skb; |
1917 | } | 1949 | } |
@@ -2003,7 +2035,7 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, | |||
2003 | rx_ring->rx_packets++; | 2035 | rx_ring->rx_packets++; |
2004 | rx_ring->rx_bytes += skb->len; | 2036 | rx_ring->rx_bytes += skb->len; |
2005 | skb_record_rx_queue(skb, rx_ring->cq_id); | 2037 | skb_record_rx_queue(skb, rx_ring->cq_id); |
2006 | if ((ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) && (vlan_id != 0)) | 2038 | if (vlan_id != 0xffff) |
2007 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id); | 2039 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id); |
2008 | if (skb->ip_summed == CHECKSUM_UNNECESSARY) | 2040 | if (skb->ip_summed == CHECKSUM_UNNECESSARY) |
2009 | napi_gro_receive(&rx_ring->napi, skb); | 2041 | napi_gro_receive(&rx_ring->napi, skb); |
@@ -2017,7 +2049,8 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, | |||
2017 | struct ib_mac_iocb_rsp *ib_mac_rsp) | 2049 | struct ib_mac_iocb_rsp *ib_mac_rsp) |
2018 | { | 2050 | { |
2019 | u32 length = le32_to_cpu(ib_mac_rsp->data_len); | 2051 | u32 length = le32_to_cpu(ib_mac_rsp->data_len); |
2020 | u16 vlan_id = (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) ? | 2052 | u16 vlan_id = ((ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) && |
2053 | (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX)) ? | ||
2021 | ((le16_to_cpu(ib_mac_rsp->vlan_id) & | 2054 | ((le16_to_cpu(ib_mac_rsp->vlan_id) & |
2022 | IB_MAC_IOCB_RSP_VLAN_MASK)) : 0xffff; | 2055 | IB_MAC_IOCB_RSP_VLAN_MASK)) : 0xffff; |
2023 | 2056 | ||
@@ -2310,9 +2343,39 @@ static void qlge_vlan_mode(struct net_device *ndev, netdev_features_t features) | |||
2310 | } | 2343 | } |
2311 | } | 2344 | } |
2312 | 2345 | ||
2346 | /** | ||
2347 | * qlge_update_hw_vlan_features - helper routine to reinitialize the adapter | ||
2348 | * based on the features to enable/disable hardware vlan accel | ||
2349 | */ | ||
2350 | static int qlge_update_hw_vlan_features(struct net_device *ndev, | ||
2351 | netdev_features_t features) | ||
2352 | { | ||
2353 | struct ql_adapter *qdev = netdev_priv(ndev); | ||
2354 | int status = 0; | ||
2355 | |||
2356 | status = ql_adapter_down(qdev); | ||
2357 | if (status) { | ||
2358 | netif_err(qdev, link, qdev->ndev, | ||
2359 | "Failed to bring down the adapter\n"); | ||
2360 | return status; | ||
2361 | } | ||
2362 | |||
2363 | /* update the features with resent change */ | ||
2364 | ndev->features = features; | ||
2365 | |||
2366 | status = ql_adapter_up(qdev); | ||
2367 | if (status) { | ||
2368 | netif_err(qdev, link, qdev->ndev, | ||
2369 | "Failed to bring up the adapter\n"); | ||
2370 | return status; | ||
2371 | } | ||
2372 | return status; | ||
2373 | } | ||
2374 | |||
2313 | static netdev_features_t qlge_fix_features(struct net_device *ndev, | 2375 | static netdev_features_t qlge_fix_features(struct net_device *ndev, |
2314 | netdev_features_t features) | 2376 | netdev_features_t features) |
2315 | { | 2377 | { |
2378 | int err; | ||
2316 | /* | 2379 | /* |
2317 | * Since there is no support for separate rx/tx vlan accel | 2380 | * Since there is no support for separate rx/tx vlan accel |
2318 | * enable/disable make sure tx flag is always in same state as rx. | 2381 | * enable/disable make sure tx flag is always in same state as rx. |
@@ -2322,6 +2385,11 @@ static netdev_features_t qlge_fix_features(struct net_device *ndev, | |||
2322 | else | 2385 | else |
2323 | features &= ~NETIF_F_HW_VLAN_CTAG_TX; | 2386 | features &= ~NETIF_F_HW_VLAN_CTAG_TX; |
2324 | 2387 | ||
2388 | /* Update the behavior of vlan accel in the adapter */ | ||
2389 | err = qlge_update_hw_vlan_features(ndev, features); | ||
2390 | if (err) | ||
2391 | return err; | ||
2392 | |||
2325 | return features; | 2393 | return features; |
2326 | } | 2394 | } |
2327 | 2395 | ||
@@ -3704,8 +3772,12 @@ static int ql_adapter_initialize(struct ql_adapter *qdev) | |||
3704 | ql_write32(qdev, SYS, mask | value); | 3772 | ql_write32(qdev, SYS, mask | value); |
3705 | 3773 | ||
3706 | /* Set the default queue, and VLAN behavior. */ | 3774 | /* Set the default queue, and VLAN behavior. */ |
3707 | value = NIC_RCV_CFG_DFQ | NIC_RCV_CFG_RV; | 3775 | value = NIC_RCV_CFG_DFQ; |
3708 | mask = NIC_RCV_CFG_DFQ_MASK | (NIC_RCV_CFG_RV << 16); | 3776 | mask = NIC_RCV_CFG_DFQ_MASK; |
3777 | if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX) { | ||
3778 | value |= NIC_RCV_CFG_RV; | ||
3779 | mask |= (NIC_RCV_CFG_RV << 16); | ||
3780 | } | ||
3709 | ql_write32(qdev, NIC_RCV_CFG, (mask | value)); | 3781 | ql_write32(qdev, NIC_RCV_CFG, (mask | value)); |
3710 | 3782 | ||
3711 | /* Set the MPI interrupt to enabled. */ | 3783 | /* Set the MPI interrupt to enabled. */ |
@@ -4692,11 +4764,15 @@ static int qlge_probe(struct pci_dev *pdev, | |||
4692 | 4764 | ||
4693 | qdev = netdev_priv(ndev); | 4765 | qdev = netdev_priv(ndev); |
4694 | SET_NETDEV_DEV(ndev, &pdev->dev); | 4766 | SET_NETDEV_DEV(ndev, &pdev->dev); |
4695 | ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | | 4767 | ndev->hw_features = NETIF_F_SG | |
4696 | NETIF_F_TSO | NETIF_F_TSO_ECN | | 4768 | NETIF_F_IP_CSUM | |
4697 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXCSUM; | 4769 | NETIF_F_TSO | |
4698 | ndev->features = ndev->hw_features | | 4770 | NETIF_F_TSO_ECN | |
4699 | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; | 4771 | NETIF_F_HW_VLAN_CTAG_TX | |
4772 | NETIF_F_HW_VLAN_CTAG_RX | | ||
4773 | NETIF_F_HW_VLAN_CTAG_FILTER | | ||
4774 | NETIF_F_RXCSUM; | ||
4775 | ndev->features = ndev->hw_features; | ||
4700 | ndev->vlan_features = ndev->hw_features; | 4776 | ndev->vlan_features = ndev->hw_features; |
4701 | 4777 | ||
4702 | if (test_bit(QL_DMA64, &qdev->flags)) | 4778 | if (test_bit(QL_DMA64, &qdev->flags)) |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 9f18ae984f9e..844ee7539d33 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -285,6 +285,181 @@ static int efx_ef10_free_vis(struct efx_nic *efx) | |||
285 | return rc; | 285 | return rc; |
286 | } | 286 | } |
287 | 287 | ||
288 | #ifdef EFX_USE_PIO | ||
289 | |||
290 | static void efx_ef10_free_piobufs(struct efx_nic *efx) | ||
291 | { | ||
292 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | ||
293 | MCDI_DECLARE_BUF(inbuf, MC_CMD_FREE_PIOBUF_IN_LEN); | ||
294 | unsigned int i; | ||
295 | int rc; | ||
296 | |||
297 | BUILD_BUG_ON(MC_CMD_FREE_PIOBUF_OUT_LEN != 0); | ||
298 | |||
299 | for (i = 0; i < nic_data->n_piobufs; i++) { | ||
300 | MCDI_SET_DWORD(inbuf, FREE_PIOBUF_IN_PIOBUF_HANDLE, | ||
301 | nic_data->piobuf_handle[i]); | ||
302 | rc = efx_mcdi_rpc(efx, MC_CMD_FREE_PIOBUF, inbuf, sizeof(inbuf), | ||
303 | NULL, 0, NULL); | ||
304 | WARN_ON(rc); | ||
305 | } | ||
306 | |||
307 | nic_data->n_piobufs = 0; | ||
308 | } | ||
309 | |||
310 | static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) | ||
311 | { | ||
312 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | ||
313 | MCDI_DECLARE_BUF(outbuf, MC_CMD_ALLOC_PIOBUF_OUT_LEN); | ||
314 | unsigned int i; | ||
315 | size_t outlen; | ||
316 | int rc = 0; | ||
317 | |||
318 | BUILD_BUG_ON(MC_CMD_ALLOC_PIOBUF_IN_LEN != 0); | ||
319 | |||
320 | for (i = 0; i < n; i++) { | ||
321 | rc = efx_mcdi_rpc(efx, MC_CMD_ALLOC_PIOBUF, NULL, 0, | ||
322 | outbuf, sizeof(outbuf), &outlen); | ||
323 | if (rc) | ||
324 | break; | ||
325 | if (outlen < MC_CMD_ALLOC_PIOBUF_OUT_LEN) { | ||
326 | rc = -EIO; | ||
327 | break; | ||
328 | } | ||
329 | nic_data->piobuf_handle[i] = | ||
330 | MCDI_DWORD(outbuf, ALLOC_PIOBUF_OUT_PIOBUF_HANDLE); | ||
331 | netif_dbg(efx, probe, efx->net_dev, | ||
332 | "allocated PIO buffer %u handle %x\n", i, | ||
333 | nic_data->piobuf_handle[i]); | ||
334 | } | ||
335 | |||
336 | nic_data->n_piobufs = i; | ||
337 | if (rc) | ||
338 | efx_ef10_free_piobufs(efx); | ||
339 | return rc; | ||
340 | } | ||
341 | |||
342 | static int efx_ef10_link_piobufs(struct efx_nic *efx) | ||
343 | { | ||
344 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | ||
345 | MCDI_DECLARE_BUF(inbuf, | ||
346 | max(MC_CMD_LINK_PIOBUF_IN_LEN, | ||
347 | MC_CMD_UNLINK_PIOBUF_IN_LEN)); | ||
348 | struct efx_channel *channel; | ||
349 | struct efx_tx_queue *tx_queue; | ||
350 | unsigned int offset, index; | ||
351 | int rc; | ||
352 | |||
353 | BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_OUT_LEN != 0); | ||
354 | BUILD_BUG_ON(MC_CMD_UNLINK_PIOBUF_OUT_LEN != 0); | ||
355 | |||
356 | /* Link a buffer to each VI in the write-combining mapping */ | ||
357 | for (index = 0; index < nic_data->n_piobufs; ++index) { | ||
358 | MCDI_SET_DWORD(inbuf, LINK_PIOBUF_IN_PIOBUF_HANDLE, | ||
359 | nic_data->piobuf_handle[index]); | ||
360 | MCDI_SET_DWORD(inbuf, LINK_PIOBUF_IN_TXQ_INSTANCE, | ||
361 | nic_data->pio_write_vi_base + index); | ||
362 | rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, | ||
363 | inbuf, MC_CMD_LINK_PIOBUF_IN_LEN, | ||
364 | NULL, 0, NULL); | ||
365 | if (rc) { | ||
366 | netif_err(efx, drv, efx->net_dev, | ||
367 | "failed to link VI %u to PIO buffer %u (%d)\n", | ||
368 | nic_data->pio_write_vi_base + index, index, | ||
369 | rc); | ||
370 | goto fail; | ||
371 | } | ||
372 | netif_dbg(efx, probe, efx->net_dev, | ||
373 | "linked VI %u to PIO buffer %u\n", | ||
374 | nic_data->pio_write_vi_base + index, index); | ||
375 | } | ||
376 | |||
377 | /* Link a buffer to each TX queue */ | ||
378 | efx_for_each_channel(channel, efx) { | ||
379 | efx_for_each_channel_tx_queue(tx_queue, channel) { | ||
380 | /* We assign the PIO buffers to queues in | ||
381 | * reverse order to allow for the following | ||
382 | * special case. | ||
383 | */ | ||
384 | offset = ((efx->tx_channel_offset + efx->n_tx_channels - | ||
385 | tx_queue->channel->channel - 1) * | ||
386 | efx_piobuf_size); | ||
387 | index = offset / ER_DZ_TX_PIOBUF_SIZE; | ||
388 | offset = offset % ER_DZ_TX_PIOBUF_SIZE; | ||
389 | |||
390 | /* When the host page size is 4K, the first | ||
391 | * host page in the WC mapping may be within | ||
392 | * the same VI page as the last TX queue. We | ||
393 | * can only link one buffer to each VI. | ||
394 | */ | ||
395 | if (tx_queue->queue == nic_data->pio_write_vi_base) { | ||
396 | BUG_ON(index != 0); | ||
397 | rc = 0; | ||
398 | } else { | ||
399 | MCDI_SET_DWORD(inbuf, | ||
400 | LINK_PIOBUF_IN_PIOBUF_HANDLE, | ||
401 | nic_data->piobuf_handle[index]); | ||
402 | MCDI_SET_DWORD(inbuf, | ||
403 | LINK_PIOBUF_IN_TXQ_INSTANCE, | ||
404 | tx_queue->queue); | ||
405 | rc = efx_mcdi_rpc(efx, MC_CMD_LINK_PIOBUF, | ||
406 | inbuf, MC_CMD_LINK_PIOBUF_IN_LEN, | ||
407 | NULL, 0, NULL); | ||
408 | } | ||
409 | |||
410 | if (rc) { | ||
411 | /* This is non-fatal; the TX path just | ||
412 | * won't use PIO for this queue | ||
413 | */ | ||
414 | netif_err(efx, drv, efx->net_dev, | ||
415 | "failed to link VI %u to PIO buffer %u (%d)\n", | ||
416 | tx_queue->queue, index, rc); | ||
417 | tx_queue->piobuf = NULL; | ||
418 | } else { | ||
419 | tx_queue->piobuf = | ||
420 | nic_data->pio_write_base + | ||
421 | index * EFX_VI_PAGE_SIZE + offset; | ||
422 | tx_queue->piobuf_offset = offset; | ||
423 | netif_dbg(efx, probe, efx->net_dev, | ||
424 | "linked VI %u to PIO buffer %u offset %x addr %p\n", | ||
425 | tx_queue->queue, index, | ||
426 | tx_queue->piobuf_offset, | ||
427 | tx_queue->piobuf); | ||
428 | } | ||
429 | } | ||
430 | } | ||
431 | |||
432 | return 0; | ||
433 | |||
434 | fail: | ||
435 | while (index--) { | ||
436 | MCDI_SET_DWORD(inbuf, UNLINK_PIOBUF_IN_TXQ_INSTANCE, | ||
437 | nic_data->pio_write_vi_base + index); | ||
438 | efx_mcdi_rpc(efx, MC_CMD_UNLINK_PIOBUF, | ||
439 | inbuf, MC_CMD_UNLINK_PIOBUF_IN_LEN, | ||
440 | NULL, 0, NULL); | ||
441 | } | ||
442 | return rc; | ||
443 | } | ||
444 | |||
445 | #else /* !EFX_USE_PIO */ | ||
446 | |||
447 | static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) | ||
448 | { | ||
449 | return n == 0 ? 0 : -ENOBUFS; | ||
450 | } | ||
451 | |||
452 | static int efx_ef10_link_piobufs(struct efx_nic *efx) | ||
453 | { | ||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | static void efx_ef10_free_piobufs(struct efx_nic *efx) | ||
458 | { | ||
459 | } | ||
460 | |||
461 | #endif /* EFX_USE_PIO */ | ||
462 | |||
288 | static void efx_ef10_remove(struct efx_nic *efx) | 463 | static void efx_ef10_remove(struct efx_nic *efx) |
289 | { | 464 | { |
290 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 465 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
@@ -295,9 +470,15 @@ static void efx_ef10_remove(struct efx_nic *efx) | |||
295 | /* This needs to be after efx_ptp_remove_channel() with no filters */ | 470 | /* This needs to be after efx_ptp_remove_channel() with no filters */ |
296 | efx_ef10_rx_free_indir_table(efx); | 471 | efx_ef10_rx_free_indir_table(efx); |
297 | 472 | ||
473 | if (nic_data->wc_membase) | ||
474 | iounmap(nic_data->wc_membase); | ||
475 | |||
298 | rc = efx_ef10_free_vis(efx); | 476 | rc = efx_ef10_free_vis(efx); |
299 | WARN_ON(rc != 0); | 477 | WARN_ON(rc != 0); |
300 | 478 | ||
479 | if (!nic_data->must_restore_piobufs) | ||
480 | efx_ef10_free_piobufs(efx); | ||
481 | |||
301 | efx_mcdi_fini(efx); | 482 | efx_mcdi_fini(efx); |
302 | efx_nic_free_buffer(efx, &nic_data->mcdi_buf); | 483 | efx_nic_free_buffer(efx, &nic_data->mcdi_buf); |
303 | kfree(nic_data); | 484 | kfree(nic_data); |
@@ -330,12 +511,126 @@ static int efx_ef10_alloc_vis(struct efx_nic *efx, | |||
330 | return 0; | 511 | return 0; |
331 | } | 512 | } |
332 | 513 | ||
514 | /* Note that the failure path of this function does not free | ||
515 | * resources, as this will be done by efx_ef10_remove(). | ||
516 | */ | ||
333 | static int efx_ef10_dimension_resources(struct efx_nic *efx) | 517 | static int efx_ef10_dimension_resources(struct efx_nic *efx) |
334 | { | 518 | { |
335 | unsigned int n_vis = | 519 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
336 | max(efx->n_channels, efx->n_tx_channels * EFX_TXQ_TYPES); | 520 | unsigned int uc_mem_map_size, wc_mem_map_size; |
521 | unsigned int min_vis, pio_write_vi_base, max_vis; | ||
522 | void __iomem *membase; | ||
523 | int rc; | ||
524 | |||
525 | min_vis = max(efx->n_channels, efx->n_tx_channels * EFX_TXQ_TYPES); | ||
526 | |||
527 | #ifdef EFX_USE_PIO | ||
528 | /* Try to allocate PIO buffers if wanted and if the full | ||
529 | * number of PIO buffers would be sufficient to allocate one | ||
530 | * copy-buffer per TX channel. Failure is non-fatal, as there | ||
531 | * are only a small number of PIO buffers shared between all | ||
532 | * functions of the controller. | ||
533 | */ | ||
534 | if (efx_piobuf_size != 0 && | ||
535 | ER_DZ_TX_PIOBUF_SIZE / efx_piobuf_size * EF10_TX_PIOBUF_COUNT >= | ||
536 | efx->n_tx_channels) { | ||
537 | unsigned int n_piobufs = | ||
538 | DIV_ROUND_UP(efx->n_tx_channels, | ||
539 | ER_DZ_TX_PIOBUF_SIZE / efx_piobuf_size); | ||
540 | |||
541 | rc = efx_ef10_alloc_piobufs(efx, n_piobufs); | ||
542 | if (rc) | ||
543 | netif_err(efx, probe, efx->net_dev, | ||
544 | "failed to allocate PIO buffers (%d)\n", rc); | ||
545 | else | ||
546 | netif_dbg(efx, probe, efx->net_dev, | ||
547 | "allocated %u PIO buffers\n", n_piobufs); | ||
548 | } | ||
549 | #else | ||
550 | nic_data->n_piobufs = 0; | ||
551 | #endif | ||
337 | 552 | ||
338 | return efx_ef10_alloc_vis(efx, n_vis, n_vis); | 553 | /* PIO buffers should be mapped with write-combining enabled, |
554 | * and we want to make single UC and WC mappings rather than | ||
555 | * several of each (in fact that's the only option if host | ||
556 | * page size is >4K). So we may allocate some extra VIs just | ||
557 | * for writing PIO buffers through. | ||
558 | */ | ||
559 | uc_mem_map_size = PAGE_ALIGN((min_vis - 1) * EFX_VI_PAGE_SIZE + | ||
560 | ER_DZ_TX_PIOBUF); | ||
561 | if (nic_data->n_piobufs) { | ||
562 | pio_write_vi_base = uc_mem_map_size / EFX_VI_PAGE_SIZE; | ||
563 | wc_mem_map_size = (PAGE_ALIGN((pio_write_vi_base + | ||
564 | nic_data->n_piobufs) * | ||
565 | EFX_VI_PAGE_SIZE) - | ||
566 | uc_mem_map_size); | ||
567 | max_vis = pio_write_vi_base + nic_data->n_piobufs; | ||
568 | } else { | ||
569 | pio_write_vi_base = 0; | ||
570 | wc_mem_map_size = 0; | ||
571 | max_vis = min_vis; | ||
572 | } | ||
573 | |||
574 | /* In case the last attached driver failed to free VIs, do it now */ | ||
575 | rc = efx_ef10_free_vis(efx); | ||
576 | if (rc != 0) | ||
577 | return rc; | ||
578 | |||
579 | rc = efx_ef10_alloc_vis(efx, min_vis, max_vis); | ||
580 | if (rc != 0) | ||
581 | return rc; | ||
582 | |||
583 | /* If we didn't get enough VIs to map all the PIO buffers, free the | ||
584 | * PIO buffers | ||
585 | */ | ||
586 | if (nic_data->n_piobufs && | ||
587 | nic_data->n_allocated_vis < | ||
588 | pio_write_vi_base + nic_data->n_piobufs) { | ||
589 | netif_dbg(efx, probe, efx->net_dev, | ||
590 | "%u VIs are not sufficient to map %u PIO buffers\n", | ||
591 | nic_data->n_allocated_vis, nic_data->n_piobufs); | ||
592 | efx_ef10_free_piobufs(efx); | ||
593 | } | ||
594 | |||
595 | /* Shrink the original UC mapping of the memory BAR */ | ||
596 | membase = ioremap_nocache(efx->membase_phys, uc_mem_map_size); | ||
597 | if (!membase) { | ||
598 | netif_err(efx, probe, efx->net_dev, | ||
599 | "could not shrink memory BAR to %x\n", | ||
600 | uc_mem_map_size); | ||
601 | return -ENOMEM; | ||
602 | } | ||
603 | iounmap(efx->membase); | ||
604 | efx->membase = membase; | ||
605 | |||
606 | /* Set up the WC mapping if needed */ | ||
607 | if (wc_mem_map_size) { | ||
608 | nic_data->wc_membase = ioremap_wc(efx->membase_phys + | ||
609 | uc_mem_map_size, | ||
610 | wc_mem_map_size); | ||
611 | if (!nic_data->wc_membase) { | ||
612 | netif_err(efx, probe, efx->net_dev, | ||
613 | "could not allocate WC mapping of size %x\n", | ||
614 | wc_mem_map_size); | ||
615 | return -ENOMEM; | ||
616 | } | ||
617 | nic_data->pio_write_vi_base = pio_write_vi_base; | ||
618 | nic_data->pio_write_base = | ||
619 | nic_data->wc_membase + | ||
620 | (pio_write_vi_base * EFX_VI_PAGE_SIZE + ER_DZ_TX_PIOBUF - | ||
621 | uc_mem_map_size); | ||
622 | |||
623 | rc = efx_ef10_link_piobufs(efx); | ||
624 | if (rc) | ||
625 | efx_ef10_free_piobufs(efx); | ||
626 | } | ||
627 | |||
628 | netif_dbg(efx, probe, efx->net_dev, | ||
629 | "memory BAR at %pa (virtual %p+%x UC, %p+%x WC)\n", | ||
630 | &efx->membase_phys, efx->membase, uc_mem_map_size, | ||
631 | nic_data->wc_membase, wc_mem_map_size); | ||
632 | |||
633 | return 0; | ||
339 | } | 634 | } |
340 | 635 | ||
341 | static int efx_ef10_init_nic(struct efx_nic *efx) | 636 | static int efx_ef10_init_nic(struct efx_nic *efx) |
@@ -359,6 +654,21 @@ static int efx_ef10_init_nic(struct efx_nic *efx) | |||
359 | nic_data->must_realloc_vis = false; | 654 | nic_data->must_realloc_vis = false; |
360 | } | 655 | } |
361 | 656 | ||
657 | if (nic_data->must_restore_piobufs && nic_data->n_piobufs) { | ||
658 | rc = efx_ef10_alloc_piobufs(efx, nic_data->n_piobufs); | ||
659 | if (rc == 0) { | ||
660 | rc = efx_ef10_link_piobufs(efx); | ||
661 | if (rc) | ||
662 | efx_ef10_free_piobufs(efx); | ||
663 | } | ||
664 | |||
665 | /* Log an error on failure, but this is non-fatal */ | ||
666 | if (rc) | ||
667 | netif_err(efx, drv, efx->net_dev, | ||
668 | "failed to restore PIO buffers (%d)\n", rc); | ||
669 | nic_data->must_restore_piobufs = false; | ||
670 | } | ||
671 | |||
362 | efx_ef10_rx_push_indir_table(efx); | 672 | efx_ef10_rx_push_indir_table(efx); |
363 | return 0; | 673 | return 0; |
364 | } | 674 | } |
@@ -716,6 +1026,7 @@ static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) | |||
716 | /* All our allocations have been reset */ | 1026 | /* All our allocations have been reset */ |
717 | nic_data->must_realloc_vis = true; | 1027 | nic_data->must_realloc_vis = true; |
718 | nic_data->must_restore_filters = true; | 1028 | nic_data->must_restore_filters = true; |
1029 | nic_data->must_restore_piobufs = true; | ||
719 | nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; | 1030 | nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; |
720 | 1031 | ||
721 | /* The datapath firmware might have been changed */ | 1032 | /* The datapath firmware might have been changed */ |
@@ -2137,7 +2448,7 @@ out_unlock: | |||
2137 | return rc; | 2448 | return rc; |
2138 | } | 2449 | } |
2139 | 2450 | ||
2140 | void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx) | 2451 | static void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx) |
2141 | { | 2452 | { |
2142 | /* no need to do anything here on EF10 */ | 2453 | /* no need to do anything here on EF10 */ |
2143 | } | 2454 | } |
diff --git a/drivers/net/ethernet/sfc/ef10_regs.h b/drivers/net/ethernet/sfc/ef10_regs.h index b3f4e3755fd9..207ac9a1e3de 100644 --- a/drivers/net/ethernet/sfc/ef10_regs.h +++ b/drivers/net/ethernet/sfc/ef10_regs.h | |||
@@ -315,6 +315,7 @@ | |||
315 | #define ESF_DZ_TX_PIO_TYPE_WIDTH 1 | 315 | #define ESF_DZ_TX_PIO_TYPE_WIDTH 1 |
316 | #define ESF_DZ_TX_PIO_OPT_LBN 60 | 316 | #define ESF_DZ_TX_PIO_OPT_LBN 60 |
317 | #define ESF_DZ_TX_PIO_OPT_WIDTH 3 | 317 | #define ESF_DZ_TX_PIO_OPT_WIDTH 3 |
318 | #define ESE_DZ_TX_OPTION_DESC_PIO 1 | ||
318 | #define ESF_DZ_TX_PIO_CONT_LBN 59 | 319 | #define ESF_DZ_TX_PIO_CONT_LBN 59 |
319 | #define ESF_DZ_TX_PIO_CONT_WIDTH 1 | 320 | #define ESF_DZ_TX_PIO_CONT_WIDTH 1 |
320 | #define ESF_DZ_TX_PIO_BYTE_CNT_LBN 32 | 321 | #define ESF_DZ_TX_PIO_BYTE_CNT_LBN 32 |
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h index 34d00f5771fe..b8235ee5d7d7 100644 --- a/drivers/net/ethernet/sfc/efx.h +++ b/drivers/net/ethernet/sfc/efx.h | |||
@@ -18,37 +18,36 @@ | |||
18 | #define EFX_MEM_BAR 2 | 18 | #define EFX_MEM_BAR 2 |
19 | 19 | ||
20 | /* TX */ | 20 | /* TX */ |
21 | extern int efx_probe_tx_queue(struct efx_tx_queue *tx_queue); | 21 | int efx_probe_tx_queue(struct efx_tx_queue *tx_queue); |
22 | extern void efx_remove_tx_queue(struct efx_tx_queue *tx_queue); | 22 | void efx_remove_tx_queue(struct efx_tx_queue *tx_queue); |
23 | extern void efx_init_tx_queue(struct efx_tx_queue *tx_queue); | 23 | void efx_init_tx_queue(struct efx_tx_queue *tx_queue); |
24 | extern void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue); | 24 | void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue); |
25 | extern void efx_fini_tx_queue(struct efx_tx_queue *tx_queue); | 25 | void efx_fini_tx_queue(struct efx_tx_queue *tx_queue); |
26 | extern netdev_tx_t | 26 | netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, |
27 | efx_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev); | 27 | struct net_device *net_dev); |
28 | extern netdev_tx_t | 28 | netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); |
29 | efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); | 29 | void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); |
30 | extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); | 30 | int efx_setup_tc(struct net_device *net_dev, u8 num_tc); |
31 | extern int efx_setup_tc(struct net_device *net_dev, u8 num_tc); | 31 | unsigned int efx_tx_max_skb_descs(struct efx_nic *efx); |
32 | extern unsigned int efx_tx_max_skb_descs(struct efx_nic *efx); | 32 | extern unsigned int efx_piobuf_size; |
33 | 33 | ||
34 | /* RX */ | 34 | /* RX */ |
35 | extern void efx_rx_config_page_split(struct efx_nic *efx); | 35 | void efx_rx_config_page_split(struct efx_nic *efx); |
36 | extern int efx_probe_rx_queue(struct efx_rx_queue *rx_queue); | 36 | int efx_probe_rx_queue(struct efx_rx_queue *rx_queue); |
37 | extern void efx_remove_rx_queue(struct efx_rx_queue *rx_queue); | 37 | void efx_remove_rx_queue(struct efx_rx_queue *rx_queue); |
38 | extern void efx_init_rx_queue(struct efx_rx_queue *rx_queue); | 38 | void efx_init_rx_queue(struct efx_rx_queue *rx_queue); |
39 | extern void efx_fini_rx_queue(struct efx_rx_queue *rx_queue); | 39 | void efx_fini_rx_queue(struct efx_rx_queue *rx_queue); |
40 | extern void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue); | 40 | void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue); |
41 | extern void efx_rx_slow_fill(unsigned long context); | 41 | void efx_rx_slow_fill(unsigned long context); |
42 | extern void __efx_rx_packet(struct efx_channel *channel); | 42 | void __efx_rx_packet(struct efx_channel *channel); |
43 | extern void efx_rx_packet(struct efx_rx_queue *rx_queue, | 43 | void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, |
44 | unsigned int index, unsigned int n_frags, | 44 | unsigned int n_frags, unsigned int len, u16 flags); |
45 | unsigned int len, u16 flags); | ||
46 | static inline void efx_rx_flush_packet(struct efx_channel *channel) | 45 | static inline void efx_rx_flush_packet(struct efx_channel *channel) |
47 | { | 46 | { |
48 | if (channel->rx_pkt_n_frags) | 47 | if (channel->rx_pkt_n_frags) |
49 | __efx_rx_packet(channel); | 48 | __efx_rx_packet(channel); |
50 | } | 49 | } |
51 | extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); | 50 | void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); |
52 | 51 | ||
53 | #define EFX_MAX_DMAQ_SIZE 4096UL | 52 | #define EFX_MAX_DMAQ_SIZE 4096UL |
54 | #define EFX_DEFAULT_DMAQ_SIZE 1024UL | 53 | #define EFX_DEFAULT_DMAQ_SIZE 1024UL |
@@ -162,9 +161,9 @@ static inline s32 efx_filter_get_rx_ids(struct efx_nic *efx, | |||
162 | return efx->type->filter_get_rx_ids(efx, priority, buf, size); | 161 | return efx->type->filter_get_rx_ids(efx, priority, buf, size); |
163 | } | 162 | } |
164 | #ifdef CONFIG_RFS_ACCEL | 163 | #ifdef CONFIG_RFS_ACCEL |
165 | extern int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | 164 | int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, |
166 | u16 rxq_index, u32 flow_id); | 165 | u16 rxq_index, u32 flow_id); |
167 | extern bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned quota); | 166 | bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned quota); |
168 | static inline void efx_filter_rfs_expire(struct efx_channel *channel) | 167 | static inline void efx_filter_rfs_expire(struct efx_channel *channel) |
169 | { | 168 | { |
170 | if (channel->rfs_filters_added >= 60 && | 169 | if (channel->rfs_filters_added >= 60 && |
@@ -176,50 +175,48 @@ static inline void efx_filter_rfs_expire(struct efx_channel *channel) | |||
176 | static inline void efx_filter_rfs_expire(struct efx_channel *channel) {} | 175 | static inline void efx_filter_rfs_expire(struct efx_channel *channel) {} |
177 | #define efx_filter_rfs_enabled() 0 | 176 | #define efx_filter_rfs_enabled() 0 |
178 | #endif | 177 | #endif |
179 | extern bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); | 178 | bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); |
180 | 179 | ||
181 | /* Channels */ | 180 | /* Channels */ |
182 | extern int efx_channel_dummy_op_int(struct efx_channel *channel); | 181 | int efx_channel_dummy_op_int(struct efx_channel *channel); |
183 | extern void efx_channel_dummy_op_void(struct efx_channel *channel); | 182 | void efx_channel_dummy_op_void(struct efx_channel *channel); |
184 | extern int | 183 | int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries); |
185 | efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries); | ||
186 | 184 | ||
187 | /* Ports */ | 185 | /* Ports */ |
188 | extern int efx_reconfigure_port(struct efx_nic *efx); | 186 | int efx_reconfigure_port(struct efx_nic *efx); |
189 | extern int __efx_reconfigure_port(struct efx_nic *efx); | 187 | int __efx_reconfigure_port(struct efx_nic *efx); |
190 | 188 | ||
191 | /* Ethtool support */ | 189 | /* Ethtool support */ |
192 | extern const struct ethtool_ops efx_ethtool_ops; | 190 | extern const struct ethtool_ops efx_ethtool_ops; |
193 | 191 | ||
194 | /* Reset handling */ | 192 | /* Reset handling */ |
195 | extern int efx_reset(struct efx_nic *efx, enum reset_type method); | 193 | int efx_reset(struct efx_nic *efx, enum reset_type method); |
196 | extern void efx_reset_down(struct efx_nic *efx, enum reset_type method); | 194 | void efx_reset_down(struct efx_nic *efx, enum reset_type method); |
197 | extern int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); | 195 | int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); |
198 | extern int efx_try_recovery(struct efx_nic *efx); | 196 | int efx_try_recovery(struct efx_nic *efx); |
199 | 197 | ||
200 | /* Global */ | 198 | /* Global */ |
201 | extern void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); | 199 | void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); |
202 | extern int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, | 200 | int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, |
203 | unsigned int rx_usecs, bool rx_adaptive, | 201 | unsigned int rx_usecs, bool rx_adaptive, |
204 | bool rx_may_override_tx); | 202 | bool rx_may_override_tx); |
205 | extern void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, | 203 | void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, |
206 | unsigned int *rx_usecs, bool *rx_adaptive); | 204 | unsigned int *rx_usecs, bool *rx_adaptive); |
207 | 205 | ||
208 | /* Dummy PHY ops for PHY drivers */ | 206 | /* Dummy PHY ops for PHY drivers */ |
209 | extern int efx_port_dummy_op_int(struct efx_nic *efx); | 207 | int efx_port_dummy_op_int(struct efx_nic *efx); |
210 | extern void efx_port_dummy_op_void(struct efx_nic *efx); | 208 | void efx_port_dummy_op_void(struct efx_nic *efx); |
211 | |||
212 | 209 | ||
213 | /* MTD */ | 210 | /* MTD */ |
214 | #ifdef CONFIG_SFC_MTD | 211 | #ifdef CONFIG_SFC_MTD |
215 | extern int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, | 212 | int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, |
216 | size_t n_parts, size_t sizeof_part); | 213 | size_t n_parts, size_t sizeof_part); |
217 | static inline int efx_mtd_probe(struct efx_nic *efx) | 214 | static inline int efx_mtd_probe(struct efx_nic *efx) |
218 | { | 215 | { |
219 | return efx->type->mtd_probe(efx); | 216 | return efx->type->mtd_probe(efx); |
220 | } | 217 | } |
221 | extern void efx_mtd_rename(struct efx_nic *efx); | 218 | void efx_mtd_rename(struct efx_nic *efx); |
222 | extern void efx_mtd_remove(struct efx_nic *efx); | 219 | void efx_mtd_remove(struct efx_nic *efx); |
223 | #else | 220 | #else |
224 | static inline int efx_mtd_probe(struct efx_nic *efx) { return 0; } | 221 | static inline int efx_mtd_probe(struct efx_nic *efx) { return 0; } |
225 | static inline void efx_mtd_rename(struct efx_nic *efx) {} | 222 | static inline void efx_mtd_rename(struct efx_nic *efx) {} |
@@ -241,9 +238,9 @@ static inline void efx_schedule_channel_irq(struct efx_channel *channel) | |||
241 | efx_schedule_channel(channel); | 238 | efx_schedule_channel(channel); |
242 | } | 239 | } |
243 | 240 | ||
244 | extern void efx_link_status_changed(struct efx_nic *efx); | 241 | void efx_link_status_changed(struct efx_nic *efx); |
245 | extern void efx_link_set_advertising(struct efx_nic *efx, u32); | 242 | void efx_link_set_advertising(struct efx_nic *efx, u32); |
246 | extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8); | 243 | void efx_link_set_wanted_fc(struct efx_nic *efx, u8); |
247 | 244 | ||
248 | static inline void efx_device_detach_sync(struct efx_nic *efx) | 245 | static inline void efx_device_detach_sync(struct efx_nic *efx) |
249 | { | 246 | { |
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index 5b471cf5c323..1f529fa2edb1 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c | |||
@@ -70,6 +70,7 @@ static const struct efx_sw_stat_desc efx_sw_stat_desc[] = { | |||
70 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers), | 70 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers), |
71 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets), | 71 | EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets), |
72 | EFX_ETHTOOL_UINT_TXQ_STAT(pushes), | 72 | EFX_ETHTOOL_UINT_TXQ_STAT(pushes), |
73 | EFX_ETHTOOL_UINT_TXQ_STAT(pio_packets), | ||
73 | EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset), | 74 | EFX_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset), |
74 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc), | 75 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc), |
75 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err), | 76 | EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err), |
@@ -1035,8 +1036,8 @@ static int efx_ethtool_set_rxfh_indir(struct net_device *net_dev, | |||
1035 | return 0; | 1036 | return 0; |
1036 | } | 1037 | } |
1037 | 1038 | ||
1038 | int efx_ethtool_get_ts_info(struct net_device *net_dev, | 1039 | static int efx_ethtool_get_ts_info(struct net_device *net_dev, |
1039 | struct ethtool_ts_info *ts_info) | 1040 | struct ethtool_ts_info *ts_info) |
1040 | { | 1041 | { |
1041 | struct efx_nic *efx = netdev_priv(net_dev); | 1042 | struct efx_nic *efx = netdev_priv(net_dev); |
1042 | 1043 | ||
diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h index 96ce507d8602..4d3f119b67b3 100644 --- a/drivers/net/ethernet/sfc/io.h +++ b/drivers/net/ethernet/sfc/io.h | |||
@@ -66,6 +66,11 @@ | |||
66 | #define EFX_USE_QWORD_IO 1 | 66 | #define EFX_USE_QWORD_IO 1 |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | /* PIO is a win only if write-combining is possible */ | ||
70 | #ifdef ARCH_HAS_IOREMAP_WC | ||
71 | #define EFX_USE_PIO 1 | ||
72 | #endif | ||
73 | |||
69 | #ifdef EFX_USE_QWORD_IO | 74 | #ifdef EFX_USE_QWORD_IO |
70 | static inline void _efx_writeq(struct efx_nic *efx, __le64 value, | 75 | static inline void _efx_writeq(struct efx_nic *efx, __le64 value, |
71 | unsigned int reg) | 76 | unsigned int reg) |
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h index c34d0d4e10ee..656a3277c2b2 100644 --- a/drivers/net/ethernet/sfc/mcdi.h +++ b/drivers/net/ethernet/sfc/mcdi.h | |||
@@ -108,38 +108,35 @@ static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx) | |||
108 | } | 108 | } |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | extern int efx_mcdi_init(struct efx_nic *efx); | 111 | int efx_mcdi_init(struct efx_nic *efx); |
112 | extern void efx_mcdi_fini(struct efx_nic *efx); | 112 | void efx_mcdi_fini(struct efx_nic *efx); |
113 | 113 | ||
114 | extern int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, | 114 | int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const efx_dword_t *inbuf, |
115 | const efx_dword_t *inbuf, size_t inlen, | 115 | size_t inlen, efx_dword_t *outbuf, size_t outlen, |
116 | size_t *outlen_actual); | ||
117 | |||
118 | int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, | ||
119 | const efx_dword_t *inbuf, size_t inlen); | ||
120 | int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, | ||
116 | efx_dword_t *outbuf, size_t outlen, | 121 | efx_dword_t *outbuf, size_t outlen, |
117 | size_t *outlen_actual); | 122 | size_t *outlen_actual); |
118 | 123 | ||
119 | extern int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, | ||
120 | const efx_dword_t *inbuf, size_t inlen); | ||
121 | extern int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, | ||
122 | efx_dword_t *outbuf, size_t outlen, | ||
123 | size_t *outlen_actual); | ||
124 | |||
125 | typedef void efx_mcdi_async_completer(struct efx_nic *efx, | 124 | typedef void efx_mcdi_async_completer(struct efx_nic *efx, |
126 | unsigned long cookie, int rc, | 125 | unsigned long cookie, int rc, |
127 | efx_dword_t *outbuf, | 126 | efx_dword_t *outbuf, |
128 | size_t outlen_actual); | 127 | size_t outlen_actual); |
129 | extern int efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, | 128 | int efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd, |
130 | const efx_dword_t *inbuf, size_t inlen, | 129 | const efx_dword_t *inbuf, size_t inlen, size_t outlen, |
131 | size_t outlen, | 130 | efx_mcdi_async_completer *complete, |
132 | efx_mcdi_async_completer *complete, | 131 | unsigned long cookie); |
133 | unsigned long cookie); | ||
134 | 132 | ||
135 | extern int efx_mcdi_poll_reboot(struct efx_nic *efx); | 133 | int efx_mcdi_poll_reboot(struct efx_nic *efx); |
136 | extern void efx_mcdi_mode_poll(struct efx_nic *efx); | 134 | void efx_mcdi_mode_poll(struct efx_nic *efx); |
137 | extern void efx_mcdi_mode_event(struct efx_nic *efx); | 135 | void efx_mcdi_mode_event(struct efx_nic *efx); |
138 | extern void efx_mcdi_flush_async(struct efx_nic *efx); | 136 | void efx_mcdi_flush_async(struct efx_nic *efx); |
139 | 137 | ||
140 | extern void efx_mcdi_process_event(struct efx_channel *channel, | 138 | void efx_mcdi_process_event(struct efx_channel *channel, efx_qword_t *event); |
141 | efx_qword_t *event); | 139 | void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); |
142 | extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); | ||
143 | 140 | ||
144 | /* We expect that 16- and 32-bit fields in MCDI requests and responses | 141 | /* We expect that 16- and 32-bit fields in MCDI requests and responses |
145 | * are appropriately aligned, but 64-bit fields are only | 142 | * are appropriately aligned, but 64-bit fields are only |
@@ -275,55 +272,54 @@ extern void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev); | |||
275 | #define MCDI_EVENT_FIELD(_ev, _field) \ | 272 | #define MCDI_EVENT_FIELD(_ev, _field) \ |
276 | EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) | 273 | EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field) |
277 | 274 | ||
278 | extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); | 275 | void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len); |
279 | extern int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, | 276 | int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, |
280 | u16 *fw_subtype_list, u32 *capabilities); | 277 | u16 *fw_subtype_list, u32 *capabilities); |
281 | extern int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, | 278 | int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq); |
282 | u32 dest_evq); | 279 | int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out); |
283 | extern int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out); | 280 | int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, |
284 | extern int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, | 281 | size_t *size_out, size_t *erase_size_out, |
285 | size_t *size_out, size_t *erase_size_out, | 282 | bool *protected_out); |
286 | bool *protected_out); | 283 | int efx_mcdi_nvram_test_all(struct efx_nic *efx); |
287 | extern int efx_mcdi_nvram_test_all(struct efx_nic *efx); | 284 | int efx_mcdi_handle_assertion(struct efx_nic *efx); |
288 | extern int efx_mcdi_handle_assertion(struct efx_nic *efx); | 285 | void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); |
289 | extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); | 286 | int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, const u8 *mac, |
290 | extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, | 287 | int *id_out); |
291 | const u8 *mac, int *id_out); | 288 | int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); |
292 | extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); | 289 | int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); |
293 | extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); | 290 | int efx_mcdi_wol_filter_reset(struct efx_nic *efx); |
294 | extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx); | 291 | int efx_mcdi_flush_rxqs(struct efx_nic *efx); |
295 | extern int efx_mcdi_flush_rxqs(struct efx_nic *efx); | 292 | int efx_mcdi_port_probe(struct efx_nic *efx); |
296 | extern int efx_mcdi_port_probe(struct efx_nic *efx); | 293 | void efx_mcdi_port_remove(struct efx_nic *efx); |
297 | extern void efx_mcdi_port_remove(struct efx_nic *efx); | 294 | int efx_mcdi_port_reconfigure(struct efx_nic *efx); |
298 | extern int efx_mcdi_port_reconfigure(struct efx_nic *efx); | 295 | int efx_mcdi_port_get_number(struct efx_nic *efx); |
299 | extern int efx_mcdi_port_get_number(struct efx_nic *efx); | 296 | u32 efx_mcdi_phy_get_caps(struct efx_nic *efx); |
300 | extern u32 efx_mcdi_phy_get_caps(struct efx_nic *efx); | 297 | void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); |
301 | extern void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev); | 298 | int efx_mcdi_set_mac(struct efx_nic *efx); |
302 | extern int efx_mcdi_set_mac(struct efx_nic *efx); | ||
303 | #define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1)) | 299 | #define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1)) |
304 | extern void efx_mcdi_mac_start_stats(struct efx_nic *efx); | 300 | void efx_mcdi_mac_start_stats(struct efx_nic *efx); |
305 | extern void efx_mcdi_mac_stop_stats(struct efx_nic *efx); | 301 | void efx_mcdi_mac_stop_stats(struct efx_nic *efx); |
306 | extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx); | 302 | bool efx_mcdi_mac_check_fault(struct efx_nic *efx); |
307 | extern enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason); | 303 | enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason); |
308 | extern int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method); | 304 | int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method); |
309 | extern int efx_mcdi_set_workaround(struct efx_nic *efx, u32 type, bool enabled); | 305 | int efx_mcdi_set_workaround(struct efx_nic *efx, u32 type, bool enabled); |
310 | 306 | ||
311 | #ifdef CONFIG_SFC_MCDI_MON | 307 | #ifdef CONFIG_SFC_MCDI_MON |
312 | extern int efx_mcdi_mon_probe(struct efx_nic *efx); | 308 | int efx_mcdi_mon_probe(struct efx_nic *efx); |
313 | extern void efx_mcdi_mon_remove(struct efx_nic *efx); | 309 | void efx_mcdi_mon_remove(struct efx_nic *efx); |
314 | #else | 310 | #else |
315 | static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; } | 311 | static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; } |
316 | static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {} | 312 | static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {} |
317 | #endif | 313 | #endif |
318 | 314 | ||
319 | #ifdef CONFIG_SFC_MTD | 315 | #ifdef CONFIG_SFC_MTD |
320 | extern int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, | 316 | int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, size_t len, |
321 | size_t len, size_t *retlen, u8 *buffer); | 317 | size_t *retlen, u8 *buffer); |
322 | extern int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len); | 318 | int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len); |
323 | extern int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, | 319 | int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, size_t len, |
324 | size_t len, size_t *retlen, const u8 *buffer); | 320 | size_t *retlen, const u8 *buffer); |
325 | extern int efx_mcdi_mtd_sync(struct mtd_info *mtd); | 321 | int efx_mcdi_mtd_sync(struct mtd_info *mtd); |
326 | extern void efx_mcdi_mtd_rename(struct efx_mtd_partition *part); | 322 | void efx_mcdi_mtd_rename(struct efx_mtd_partition *part); |
327 | #endif | 323 | #endif |
328 | 324 | ||
329 | #endif /* EFX_MCDI_H */ | 325 | #endif /* EFX_MCDI_H */ |
diff --git a/drivers/net/ethernet/sfc/mdio_10g.h b/drivers/net/ethernet/sfc/mdio_10g.h index 16824fecc5ee..4a2dc4c281b7 100644 --- a/drivers/net/ethernet/sfc/mdio_10g.h +++ b/drivers/net/ethernet/sfc/mdio_10g.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | static inline unsigned efx_mdio_id_rev(u32 id) { return id & 0xf; } | 21 | static inline unsigned efx_mdio_id_rev(u32 id) { return id & 0xf; } |
22 | static inline unsigned efx_mdio_id_model(u32 id) { return (id >> 4) & 0x3f; } | 22 | static inline unsigned efx_mdio_id_model(u32 id) { return (id >> 4) & 0x3f; } |
23 | extern unsigned efx_mdio_id_oui(u32 id); | 23 | unsigned efx_mdio_id_oui(u32 id); |
24 | 24 | ||
25 | static inline int efx_mdio_read(struct efx_nic *efx, int devad, int addr) | 25 | static inline int efx_mdio_read(struct efx_nic *efx, int devad, int addr) |
26 | { | 26 | { |
@@ -56,7 +56,7 @@ static inline bool efx_mdio_phyxgxs_lane_sync(struct efx_nic *efx) | |||
56 | return sync; | 56 | return sync; |
57 | } | 57 | } |
58 | 58 | ||
59 | extern const char *efx_mdio_mmd_name(int mmd); | 59 | const char *efx_mdio_mmd_name(int mmd); |
60 | 60 | ||
61 | /* | 61 | /* |
62 | * Reset a specific MMD and wait for reset to clear. | 62 | * Reset a specific MMD and wait for reset to clear. |
@@ -64,30 +64,29 @@ extern const char *efx_mdio_mmd_name(int mmd); | |||
64 | * | 64 | * |
65 | * This function will sleep | 65 | * This function will sleep |
66 | */ | 66 | */ |
67 | extern int efx_mdio_reset_mmd(struct efx_nic *efx, int mmd, | 67 | int efx_mdio_reset_mmd(struct efx_nic *efx, int mmd, int spins, int spintime); |
68 | int spins, int spintime); | ||
69 | 68 | ||
70 | /* As efx_mdio_check_mmd but for multiple MMDs */ | 69 | /* As efx_mdio_check_mmd but for multiple MMDs */ |
71 | int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask); | 70 | int efx_mdio_check_mmds(struct efx_nic *efx, unsigned int mmd_mask); |
72 | 71 | ||
73 | /* Check the link status of specified mmds in bit mask */ | 72 | /* Check the link status of specified mmds in bit mask */ |
74 | extern bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask); | 73 | bool efx_mdio_links_ok(struct efx_nic *efx, unsigned int mmd_mask); |
75 | 74 | ||
76 | /* Generic transmit disable support though PMAPMD */ | 75 | /* Generic transmit disable support though PMAPMD */ |
77 | extern void efx_mdio_transmit_disable(struct efx_nic *efx); | 76 | void efx_mdio_transmit_disable(struct efx_nic *efx); |
78 | 77 | ||
79 | /* Generic part of reconfigure: set/clear loopback bits */ | 78 | /* Generic part of reconfigure: set/clear loopback bits */ |
80 | extern void efx_mdio_phy_reconfigure(struct efx_nic *efx); | 79 | void efx_mdio_phy_reconfigure(struct efx_nic *efx); |
81 | 80 | ||
82 | /* Set the power state of the specified MMDs */ | 81 | /* Set the power state of the specified MMDs */ |
83 | extern void efx_mdio_set_mmds_lpower(struct efx_nic *efx, | 82 | void efx_mdio_set_mmds_lpower(struct efx_nic *efx, int low_power, |
84 | int low_power, unsigned int mmd_mask); | 83 | unsigned int mmd_mask); |
85 | 84 | ||
86 | /* Set (some of) the PHY settings over MDIO */ | 85 | /* Set (some of) the PHY settings over MDIO */ |
87 | extern int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd); | 86 | int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd); |
88 | 87 | ||
89 | /* Push advertising flags and restart autonegotiation */ | 88 | /* Push advertising flags and restart autonegotiation */ |
90 | extern void efx_mdio_an_reconfigure(struct efx_nic *efx); | 89 | void efx_mdio_an_reconfigure(struct efx_nic *efx); |
91 | 90 | ||
92 | /* Get pause parameters from AN if available (otherwise return | 91 | /* Get pause parameters from AN if available (otherwise return |
93 | * requested pause parameters) | 92 | * requested pause parameters) |
@@ -95,8 +94,7 @@ extern void efx_mdio_an_reconfigure(struct efx_nic *efx); | |||
95 | u8 efx_mdio_get_pause(struct efx_nic *efx); | 94 | u8 efx_mdio_get_pause(struct efx_nic *efx); |
96 | 95 | ||
97 | /* Wait for specified MMDs to exit reset within a timeout */ | 96 | /* Wait for specified MMDs to exit reset within a timeout */ |
98 | extern int efx_mdio_wait_reset_mmds(struct efx_nic *efx, | 97 | int efx_mdio_wait_reset_mmds(struct efx_nic *efx, unsigned int mmd_mask); |
99 | unsigned int mmd_mask); | ||
100 | 98 | ||
101 | /* Set or clear flag, debouncing */ | 99 | /* Set or clear flag, debouncing */ |
102 | static inline void | 100 | static inline void |
@@ -107,6 +105,6 @@ efx_mdio_set_flag(struct efx_nic *efx, int devad, int addr, | |||
107 | } | 105 | } |
108 | 106 | ||
109 | /* Liveness self-test for MDIO PHYs */ | 107 | /* Liveness self-test for MDIO PHYs */ |
110 | extern int efx_mdio_test_alive(struct efx_nic *efx); | 108 | int efx_mdio_test_alive(struct efx_nic *efx); |
111 | 109 | ||
112 | #endif /* EFX_MDIO_10G_H */ | 110 | #endif /* EFX_MDIO_10G_H */ |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index b172ed133055..aac22a1e85b8 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -182,6 +182,9 @@ struct efx_tx_buffer { | |||
182 | * @tsoh_page: Array of pages of TSO header buffers | 182 | * @tsoh_page: Array of pages of TSO header buffers |
183 | * @txd: The hardware descriptor ring | 183 | * @txd: The hardware descriptor ring |
184 | * @ptr_mask: The size of the ring minus 1. | 184 | * @ptr_mask: The size of the ring minus 1. |
185 | * @piobuf: PIO buffer region for this TX queue (shared with its partner). | ||
186 | * Size of the region is efx_piobuf_size. | ||
187 | * @piobuf_offset: Buffer offset to be specified in PIO descriptors | ||
185 | * @initialised: Has hardware queue been initialised? | 188 | * @initialised: Has hardware queue been initialised? |
186 | * @read_count: Current read pointer. | 189 | * @read_count: Current read pointer. |
187 | * This is the number of buffers that have been removed from both rings. | 190 | * This is the number of buffers that have been removed from both rings. |
@@ -209,6 +212,7 @@ struct efx_tx_buffer { | |||
209 | * blocks | 212 | * blocks |
210 | * @tso_packets: Number of packets via the TSO xmit path | 213 | * @tso_packets: Number of packets via the TSO xmit path |
211 | * @pushes: Number of times the TX push feature has been used | 214 | * @pushes: Number of times the TX push feature has been used |
215 | * @pio_packets: Number of times the TX PIO feature has been used | ||
212 | * @empty_read_count: If the completion path has seen the queue as empty | 216 | * @empty_read_count: If the completion path has seen the queue as empty |
213 | * and the transmission path has not yet checked this, the value of | 217 | * and the transmission path has not yet checked this, the value of |
214 | * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. | 218 | * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. |
@@ -223,6 +227,8 @@ struct efx_tx_queue { | |||
223 | struct efx_buffer *tsoh_page; | 227 | struct efx_buffer *tsoh_page; |
224 | struct efx_special_buffer txd; | 228 | struct efx_special_buffer txd; |
225 | unsigned int ptr_mask; | 229 | unsigned int ptr_mask; |
230 | void __iomem *piobuf; | ||
231 | unsigned int piobuf_offset; | ||
226 | bool initialised; | 232 | bool initialised; |
227 | 233 | ||
228 | /* Members used mainly on the completion path */ | 234 | /* Members used mainly on the completion path */ |
@@ -238,6 +244,7 @@ struct efx_tx_queue { | |||
238 | unsigned int tso_long_headers; | 244 | unsigned int tso_long_headers; |
239 | unsigned int tso_packets; | 245 | unsigned int tso_packets; |
240 | unsigned int pushes; | 246 | unsigned int pushes; |
247 | unsigned int pio_packets; | ||
241 | 248 | ||
242 | /* Members shared between paths and sometimes updated */ | 249 | /* Members shared between paths and sometimes updated */ |
243 | unsigned int empty_read_count ____cacheline_aligned_in_smp; | 250 | unsigned int empty_read_count ____cacheline_aligned_in_smp; |
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index e7dbd2dd202e..c75009b8c0d9 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "bitfield.h" | 19 | #include "bitfield.h" |
20 | #include "efx.h" | 20 | #include "efx.h" |
21 | #include "nic.h" | 21 | #include "nic.h" |
22 | #include "ef10_regs.h" | ||
22 | #include "farch_regs.h" | 23 | #include "farch_regs.h" |
23 | #include "io.h" | 24 | #include "io.h" |
24 | #include "workarounds.h" | 25 | #include "workarounds.h" |
@@ -166,26 +167,30 @@ void efx_nic_fini_interrupt(struct efx_nic *efx) | |||
166 | 167 | ||
167 | /* Register dump */ | 168 | /* Register dump */ |
168 | 169 | ||
169 | #define REGISTER_REVISION_A 1 | 170 | #define REGISTER_REVISION_FA 1 |
170 | #define REGISTER_REVISION_B 2 | 171 | #define REGISTER_REVISION_FB 2 |
171 | #define REGISTER_REVISION_C 3 | 172 | #define REGISTER_REVISION_FC 3 |
172 | #define REGISTER_REVISION_Z 3 /* latest revision */ | 173 | #define REGISTER_REVISION_FZ 3 /* last Falcon arch revision */ |
174 | #define REGISTER_REVISION_ED 4 | ||
175 | #define REGISTER_REVISION_EZ 4 /* latest EF10 revision */ | ||
173 | 176 | ||
174 | struct efx_nic_reg { | 177 | struct efx_nic_reg { |
175 | u32 offset:24; | 178 | u32 offset:24; |
176 | u32 min_revision:2, max_revision:2; | 179 | u32 min_revision:3, max_revision:3; |
177 | }; | 180 | }; |
178 | 181 | ||
179 | #define REGISTER(name, min_rev, max_rev) { \ | 182 | #define REGISTER(name, arch, min_rev, max_rev) { \ |
180 | FR_ ## min_rev ## max_rev ## _ ## name, \ | 183 | arch ## R_ ## min_rev ## max_rev ## _ ## name, \ |
181 | REGISTER_REVISION_ ## min_rev, REGISTER_REVISION_ ## max_rev \ | 184 | REGISTER_REVISION_ ## arch ## min_rev, \ |
185 | REGISTER_REVISION_ ## arch ## max_rev \ | ||
182 | } | 186 | } |
183 | #define REGISTER_AA(name) REGISTER(name, A, A) | 187 | #define REGISTER_AA(name) REGISTER(name, F, A, A) |
184 | #define REGISTER_AB(name) REGISTER(name, A, B) | 188 | #define REGISTER_AB(name) REGISTER(name, F, A, B) |
185 | #define REGISTER_AZ(name) REGISTER(name, A, Z) | 189 | #define REGISTER_AZ(name) REGISTER(name, F, A, Z) |
186 | #define REGISTER_BB(name) REGISTER(name, B, B) | 190 | #define REGISTER_BB(name) REGISTER(name, F, B, B) |
187 | #define REGISTER_BZ(name) REGISTER(name, B, Z) | 191 | #define REGISTER_BZ(name) REGISTER(name, F, B, Z) |
188 | #define REGISTER_CZ(name) REGISTER(name, C, Z) | 192 | #define REGISTER_CZ(name) REGISTER(name, F, C, Z) |
193 | #define REGISTER_DZ(name) REGISTER(name, E, D, Z) | ||
189 | 194 | ||
190 | static const struct efx_nic_reg efx_nic_regs[] = { | 195 | static const struct efx_nic_reg efx_nic_regs[] = { |
191 | REGISTER_AZ(ADR_REGION), | 196 | REGISTER_AZ(ADR_REGION), |
@@ -292,37 +297,42 @@ static const struct efx_nic_reg efx_nic_regs[] = { | |||
292 | REGISTER_AB(XX_TXDRV_CTL), | 297 | REGISTER_AB(XX_TXDRV_CTL), |
293 | /* XX_PRBS_CTL, XX_PRBS_CHK and XX_PRBS_ERR are not used */ | 298 | /* XX_PRBS_CTL, XX_PRBS_CHK and XX_PRBS_ERR are not used */ |
294 | /* XX_CORE_STAT is partly RC */ | 299 | /* XX_CORE_STAT is partly RC */ |
300 | REGISTER_DZ(BIU_HW_REV_ID), | ||
301 | REGISTER_DZ(MC_DB_LWRD), | ||
302 | REGISTER_DZ(MC_DB_HWRD), | ||
295 | }; | 303 | }; |
296 | 304 | ||
297 | struct efx_nic_reg_table { | 305 | struct efx_nic_reg_table { |
298 | u32 offset:24; | 306 | u32 offset:24; |
299 | u32 min_revision:2, max_revision:2; | 307 | u32 min_revision:3, max_revision:3; |
300 | u32 step:6, rows:21; | 308 | u32 step:6, rows:21; |
301 | }; | 309 | }; |
302 | 310 | ||
303 | #define REGISTER_TABLE_DIMENSIONS(_, offset, min_rev, max_rev, step, rows) { \ | 311 | #define REGISTER_TABLE_DIMENSIONS(_, offset, arch, min_rev, max_rev, step, rows) { \ |
304 | offset, \ | 312 | offset, \ |
305 | REGISTER_REVISION_ ## min_rev, REGISTER_REVISION_ ## max_rev, \ | 313 | REGISTER_REVISION_ ## arch ## min_rev, \ |
314 | REGISTER_REVISION_ ## arch ## max_rev, \ | ||
306 | step, rows \ | 315 | step, rows \ |
307 | } | 316 | } |
308 | #define REGISTER_TABLE(name, min_rev, max_rev) \ | 317 | #define REGISTER_TABLE(name, arch, min_rev, max_rev) \ |
309 | REGISTER_TABLE_DIMENSIONS( \ | 318 | REGISTER_TABLE_DIMENSIONS( \ |
310 | name, FR_ ## min_rev ## max_rev ## _ ## name, \ | 319 | name, arch ## R_ ## min_rev ## max_rev ## _ ## name, \ |
311 | min_rev, max_rev, \ | 320 | arch, min_rev, max_rev, \ |
312 | FR_ ## min_rev ## max_rev ## _ ## name ## _STEP, \ | 321 | arch ## R_ ## min_rev ## max_rev ## _ ## name ## _STEP, \ |
313 | FR_ ## min_rev ## max_rev ## _ ## name ## _ROWS) | 322 | arch ## R_ ## min_rev ## max_rev ## _ ## name ## _ROWS) |
314 | #define REGISTER_TABLE_AA(name) REGISTER_TABLE(name, A, A) | 323 | #define REGISTER_TABLE_AA(name) REGISTER_TABLE(name, F, A, A) |
315 | #define REGISTER_TABLE_AZ(name) REGISTER_TABLE(name, A, Z) | 324 | #define REGISTER_TABLE_AZ(name) REGISTER_TABLE(name, F, A, Z) |
316 | #define REGISTER_TABLE_BB(name) REGISTER_TABLE(name, B, B) | 325 | #define REGISTER_TABLE_BB(name) REGISTER_TABLE(name, F, B, B) |
317 | #define REGISTER_TABLE_BZ(name) REGISTER_TABLE(name, B, Z) | 326 | #define REGISTER_TABLE_BZ(name) REGISTER_TABLE(name, F, B, Z) |
318 | #define REGISTER_TABLE_BB_CZ(name) \ | 327 | #define REGISTER_TABLE_BB_CZ(name) \ |
319 | REGISTER_TABLE_DIMENSIONS(name, FR_BZ_ ## name, B, B, \ | 328 | REGISTER_TABLE_DIMENSIONS(name, FR_BZ_ ## name, F, B, B, \ |
320 | FR_BZ_ ## name ## _STEP, \ | 329 | FR_BZ_ ## name ## _STEP, \ |
321 | FR_BB_ ## name ## _ROWS), \ | 330 | FR_BB_ ## name ## _ROWS), \ |
322 | REGISTER_TABLE_DIMENSIONS(name, FR_BZ_ ## name, C, Z, \ | 331 | REGISTER_TABLE_DIMENSIONS(name, FR_BZ_ ## name, F, C, Z, \ |
323 | FR_BZ_ ## name ## _STEP, \ | 332 | FR_BZ_ ## name ## _STEP, \ |
324 | FR_CZ_ ## name ## _ROWS) | 333 | FR_CZ_ ## name ## _ROWS) |
325 | #define REGISTER_TABLE_CZ(name) REGISTER_TABLE(name, C, Z) | 334 | #define REGISTER_TABLE_CZ(name) REGISTER_TABLE(name, F, C, Z) |
335 | #define REGISTER_TABLE_DZ(name) REGISTER_TABLE(name, E, D, Z) | ||
326 | 336 | ||
327 | static const struct efx_nic_reg_table efx_nic_reg_tables[] = { | 337 | static const struct efx_nic_reg_table efx_nic_reg_tables[] = { |
328 | /* DRIVER is not used */ | 338 | /* DRIVER is not used */ |
@@ -340,9 +350,9 @@ static const struct efx_nic_reg_table efx_nic_reg_tables[] = { | |||
340 | * 1K entries allows for some expansion of queue count and | 350 | * 1K entries allows for some expansion of queue count and |
341 | * size before we need to change the version. */ | 351 | * size before we need to change the version. */ |
342 | REGISTER_TABLE_DIMENSIONS(BUF_FULL_TBL_KER, FR_AA_BUF_FULL_TBL_KER, | 352 | REGISTER_TABLE_DIMENSIONS(BUF_FULL_TBL_KER, FR_AA_BUF_FULL_TBL_KER, |
343 | A, A, 8, 1024), | 353 | F, A, A, 8, 1024), |
344 | REGISTER_TABLE_DIMENSIONS(BUF_FULL_TBL, FR_BZ_BUF_FULL_TBL, | 354 | REGISTER_TABLE_DIMENSIONS(BUF_FULL_TBL, FR_BZ_BUF_FULL_TBL, |
345 | B, Z, 8, 1024), | 355 | F, B, Z, 8, 1024), |
346 | REGISTER_TABLE_CZ(RX_MAC_FILTER_TBL0), | 356 | REGISTER_TABLE_CZ(RX_MAC_FILTER_TBL0), |
347 | REGISTER_TABLE_BB_CZ(TIMER_TBL), | 357 | REGISTER_TABLE_BB_CZ(TIMER_TBL), |
348 | REGISTER_TABLE_BB_CZ(TX_PACE_TBL), | 358 | REGISTER_TABLE_BB_CZ(TX_PACE_TBL), |
@@ -353,6 +363,7 @@ static const struct efx_nic_reg_table efx_nic_reg_tables[] = { | |||
353 | /* MSIX_PBA_TABLE is not mapped */ | 363 | /* MSIX_PBA_TABLE is not mapped */ |
354 | /* SRM_DBG is not mapped (and is redundant with BUF_FLL_TBL) */ | 364 | /* SRM_DBG is not mapped (and is redundant with BUF_FLL_TBL) */ |
355 | REGISTER_TABLE_BZ(RX_FILTER_TBL0), | 365 | REGISTER_TABLE_BZ(RX_FILTER_TBL0), |
366 | REGISTER_TABLE_DZ(BIU_MC_SFT_STATUS), | ||
356 | }; | 367 | }; |
357 | 368 | ||
358 | size_t efx_nic_get_regs_len(struct efx_nic *efx) | 369 | size_t efx_nic_get_regs_len(struct efx_nic *efx) |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index fda29d39032f..08883c8edf0e 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -30,7 +30,7 @@ static inline int efx_nic_rev(struct efx_nic *efx) | |||
30 | return efx->type->revision; | 30 | return efx->type->revision; |
31 | } | 31 | } |
32 | 32 | ||
33 | extern u32 efx_farch_fpga_ver(struct efx_nic *efx); | 33 | u32 efx_farch_fpga_ver(struct efx_nic *efx); |
34 | 34 | ||
35 | /* NIC has two interlinked PCI functions for the same port. */ | 35 | /* NIC has two interlinked PCI functions for the same port. */ |
36 | static inline bool efx_nic_is_dual_func(struct efx_nic *efx) | 36 | static inline bool efx_nic_is_dual_func(struct efx_nic *efx) |
@@ -71,6 +71,26 @@ efx_tx_desc(struct efx_tx_queue *tx_queue, unsigned int index) | |||
71 | return ((efx_qword_t *) (tx_queue->txd.buf.addr)) + index; | 71 | return ((efx_qword_t *) (tx_queue->txd.buf.addr)) + index; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* Report whether the NIC considers this TX queue empty, given the | ||
75 | * write_count used for the last doorbell push. May return false | ||
76 | * negative. | ||
77 | */ | ||
78 | static inline bool __efx_nic_tx_is_empty(struct efx_tx_queue *tx_queue, | ||
79 | unsigned int write_count) | ||
80 | { | ||
81 | unsigned int empty_read_count = ACCESS_ONCE(tx_queue->empty_read_count); | ||
82 | |||
83 | if (empty_read_count == 0) | ||
84 | return false; | ||
85 | |||
86 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; | ||
87 | } | ||
88 | |||
89 | static inline bool efx_nic_tx_is_empty(struct efx_tx_queue *tx_queue) | ||
90 | { | ||
91 | return __efx_nic_tx_is_empty(tx_queue, tx_queue->write_count); | ||
92 | } | ||
93 | |||
74 | /* Decide whether to push a TX descriptor to the NIC vs merely writing | 94 | /* Decide whether to push a TX descriptor to the NIC vs merely writing |
75 | * the doorbell. This can reduce latency when we are adding a single | 95 | * the doorbell. This can reduce latency when we are adding a single |
76 | * descriptor to an empty queue, but is otherwise pointless. Further, | 96 | * descriptor to an empty queue, but is otherwise pointless. Further, |
@@ -80,14 +100,10 @@ efx_tx_desc(struct efx_tx_queue *tx_queue, unsigned int index) | |||
80 | static inline bool efx_nic_may_push_tx_desc(struct efx_tx_queue *tx_queue, | 100 | static inline bool efx_nic_may_push_tx_desc(struct efx_tx_queue *tx_queue, |
81 | unsigned int write_count) | 101 | unsigned int write_count) |
82 | { | 102 | { |
83 | unsigned empty_read_count = ACCESS_ONCE(tx_queue->empty_read_count); | 103 | bool was_empty = __efx_nic_tx_is_empty(tx_queue, write_count); |
84 | |||
85 | if (empty_read_count == 0) | ||
86 | return false; | ||
87 | 104 | ||
88 | tx_queue->empty_read_count = 0; | 105 | tx_queue->empty_read_count = 0; |
89 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 | 106 | return was_empty && tx_queue->write_count - write_count == 1; |
90 | && tx_queue->write_count - write_count == 1; | ||
91 | } | 107 | } |
92 | 108 | ||
93 | /* Returns a pointer to the specified descriptor in the RX descriptor queue */ | 109 | /* Returns a pointer to the specified descriptor in the RX descriptor queue */ |
@@ -389,6 +405,12 @@ enum { | |||
389 | EF10_STAT_COUNT | 405 | EF10_STAT_COUNT |
390 | }; | 406 | }; |
391 | 407 | ||
408 | /* Maximum number of TX PIO buffers we may allocate to a function. | ||
409 | * This matches the total number of buffers on each SFC9100-family | ||
410 | * controller. | ||
411 | */ | ||
412 | #define EF10_TX_PIOBUF_COUNT 16 | ||
413 | |||
392 | /** | 414 | /** |
393 | * struct efx_ef10_nic_data - EF10 architecture NIC state | 415 | * struct efx_ef10_nic_data - EF10 architecture NIC state |
394 | * @mcdi_buf: DMA buffer for MCDI | 416 | * @mcdi_buf: DMA buffer for MCDI |
@@ -397,6 +419,13 @@ enum { | |||
397 | * @n_allocated_vis: Number of VIs allocated to this function | 419 | * @n_allocated_vis: Number of VIs allocated to this function |
398 | * @must_realloc_vis: Flag: VIs have yet to be reallocated after MC reboot | 420 | * @must_realloc_vis: Flag: VIs have yet to be reallocated after MC reboot |
399 | * @must_restore_filters: Flag: filters have yet to be restored after MC reboot | 421 | * @must_restore_filters: Flag: filters have yet to be restored after MC reboot |
422 | * @n_piobufs: Number of PIO buffers allocated to this function | ||
423 | * @wc_membase: Base address of write-combining mapping of the memory BAR | ||
424 | * @pio_write_base: Base address for writing PIO buffers | ||
425 | * @pio_write_vi_base: Relative VI number for @pio_write_base | ||
426 | * @piobuf_handle: Handle of each PIO buffer allocated | ||
427 | * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC | ||
428 | * reboot | ||
400 | * @rx_rss_context: Firmware handle for our RSS context | 429 | * @rx_rss_context: Firmware handle for our RSS context |
401 | * @stats: Hardware statistics | 430 | * @stats: Hardware statistics |
402 | * @workaround_35388: Flag: firmware supports workaround for bug 35388 | 431 | * @workaround_35388: Flag: firmware supports workaround for bug 35388 |
@@ -412,6 +441,11 @@ struct efx_ef10_nic_data { | |||
412 | unsigned int n_allocated_vis; | 441 | unsigned int n_allocated_vis; |
413 | bool must_realloc_vis; | 442 | bool must_realloc_vis; |
414 | bool must_restore_filters; | 443 | bool must_restore_filters; |
444 | unsigned int n_piobufs; | ||
445 | void __iomem *wc_membase, *pio_write_base; | ||
446 | unsigned int pio_write_vi_base; | ||
447 | unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT]; | ||
448 | bool must_restore_piobufs; | ||
415 | u32 rx_rss_context; | 449 | u32 rx_rss_context; |
416 | u64 stats[EF10_STAT_COUNT]; | 450 | u64 stats[EF10_STAT_COUNT]; |
417 | bool workaround_35388; | 451 | bool workaround_35388; |
@@ -463,18 +497,18 @@ static inline unsigned int efx_vf_size(struct efx_nic *efx) | |||
463 | return 1 << efx->vi_scale; | 497 | return 1 << efx->vi_scale; |
464 | } | 498 | } |
465 | 499 | ||
466 | extern int efx_init_sriov(void); | 500 | int efx_init_sriov(void); |
467 | extern void efx_sriov_probe(struct efx_nic *efx); | 501 | void efx_sriov_probe(struct efx_nic *efx); |
468 | extern int efx_sriov_init(struct efx_nic *efx); | 502 | int efx_sriov_init(struct efx_nic *efx); |
469 | extern void efx_sriov_mac_address_changed(struct efx_nic *efx); | 503 | void efx_sriov_mac_address_changed(struct efx_nic *efx); |
470 | extern void efx_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event); | 504 | void efx_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event); |
471 | extern void efx_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event); | 505 | void efx_sriov_rx_flush_done(struct efx_nic *efx, efx_qword_t *event); |
472 | extern void efx_sriov_event(struct efx_channel *channel, efx_qword_t *event); | 506 | void efx_sriov_event(struct efx_channel *channel, efx_qword_t *event); |
473 | extern void efx_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq); | 507 | void efx_sriov_desc_fetch_err(struct efx_nic *efx, unsigned dmaq); |
474 | extern void efx_sriov_flr(struct efx_nic *efx, unsigned flr); | 508 | void efx_sriov_flr(struct efx_nic *efx, unsigned flr); |
475 | extern void efx_sriov_reset(struct efx_nic *efx); | 509 | void efx_sriov_reset(struct efx_nic *efx); |
476 | extern void efx_sriov_fini(struct efx_nic *efx); | 510 | void efx_sriov_fini(struct efx_nic *efx); |
477 | extern void efx_fini_sriov(void); | 511 | void efx_fini_sriov(void); |
478 | 512 | ||
479 | #else | 513 | #else |
480 | 514 | ||
@@ -500,22 +534,20 @@ static inline void efx_fini_sriov(void) {} | |||
500 | 534 | ||
501 | #endif | 535 | #endif |
502 | 536 | ||
503 | extern int efx_sriov_set_vf_mac(struct net_device *dev, int vf, u8 *mac); | 537 | int efx_sriov_set_vf_mac(struct net_device *dev, int vf, u8 *mac); |
504 | extern int efx_sriov_set_vf_vlan(struct net_device *dev, int vf, | 538 | int efx_sriov_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos); |
505 | u16 vlan, u8 qos); | 539 | int efx_sriov_get_vf_config(struct net_device *dev, int vf, |
506 | extern int efx_sriov_get_vf_config(struct net_device *dev, int vf, | 540 | struct ifla_vf_info *ivf); |
507 | struct ifla_vf_info *ivf); | 541 | int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf, |
508 | extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf, | 542 | bool spoofchk); |
509 | bool spoofchk); | ||
510 | 543 | ||
511 | struct ethtool_ts_info; | 544 | struct ethtool_ts_info; |
512 | extern void efx_ptp_probe(struct efx_nic *efx); | 545 | void efx_ptp_probe(struct efx_nic *efx); |
513 | extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd); | 546 | int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd); |
514 | extern void efx_ptp_get_ts_info(struct efx_nic *efx, | 547 | void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); |
515 | struct ethtool_ts_info *ts_info); | 548 | bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); |
516 | extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); | 549 | int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); |
517 | extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); | 550 | void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); |
518 | extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); | ||
519 | 551 | ||
520 | extern const struct efx_nic_type falcon_a1_nic_type; | 552 | extern const struct efx_nic_type falcon_a1_nic_type; |
521 | extern const struct efx_nic_type falcon_b0_nic_type; | 553 | extern const struct efx_nic_type falcon_b0_nic_type; |
@@ -529,7 +561,7 @@ extern const struct efx_nic_type efx_hunt_a0_nic_type; | |||
529 | ************************************************************************** | 561 | ************************************************************************** |
530 | */ | 562 | */ |
531 | 563 | ||
532 | extern int falcon_probe_board(struct efx_nic *efx, u16 revision_info); | 564 | int falcon_probe_board(struct efx_nic *efx, u16 revision_info); |
533 | 565 | ||
534 | /* TX data path */ | 566 | /* TX data path */ |
535 | static inline int efx_nic_probe_tx(struct efx_tx_queue *tx_queue) | 567 | static inline int efx_nic_probe_tx(struct efx_tx_queue *tx_queue) |
@@ -597,58 +629,58 @@ static inline void efx_nic_eventq_read_ack(struct efx_channel *channel) | |||
597 | { | 629 | { |
598 | channel->efx->type->ev_read_ack(channel); | 630 | channel->efx->type->ev_read_ack(channel); |
599 | } | 631 | } |
600 | extern void efx_nic_event_test_start(struct efx_channel *channel); | 632 | void efx_nic_event_test_start(struct efx_channel *channel); |
601 | 633 | ||
602 | /* Falcon/Siena queue operations */ | 634 | /* Falcon/Siena queue operations */ |
603 | extern int efx_farch_tx_probe(struct efx_tx_queue *tx_queue); | 635 | int efx_farch_tx_probe(struct efx_tx_queue *tx_queue); |
604 | extern void efx_farch_tx_init(struct efx_tx_queue *tx_queue); | 636 | void efx_farch_tx_init(struct efx_tx_queue *tx_queue); |
605 | extern void efx_farch_tx_fini(struct efx_tx_queue *tx_queue); | 637 | void efx_farch_tx_fini(struct efx_tx_queue *tx_queue); |
606 | extern void efx_farch_tx_remove(struct efx_tx_queue *tx_queue); | 638 | void efx_farch_tx_remove(struct efx_tx_queue *tx_queue); |
607 | extern void efx_farch_tx_write(struct efx_tx_queue *tx_queue); | 639 | void efx_farch_tx_write(struct efx_tx_queue *tx_queue); |
608 | extern int efx_farch_rx_probe(struct efx_rx_queue *rx_queue); | 640 | int efx_farch_rx_probe(struct efx_rx_queue *rx_queue); |
609 | extern void efx_farch_rx_init(struct efx_rx_queue *rx_queue); | 641 | void efx_farch_rx_init(struct efx_rx_queue *rx_queue); |
610 | extern void efx_farch_rx_fini(struct efx_rx_queue *rx_queue); | 642 | void efx_farch_rx_fini(struct efx_rx_queue *rx_queue); |
611 | extern void efx_farch_rx_remove(struct efx_rx_queue *rx_queue); | 643 | void efx_farch_rx_remove(struct efx_rx_queue *rx_queue); |
612 | extern void efx_farch_rx_write(struct efx_rx_queue *rx_queue); | 644 | void efx_farch_rx_write(struct efx_rx_queue *rx_queue); |
613 | extern void efx_farch_rx_defer_refill(struct efx_rx_queue *rx_queue); | 645 | void efx_farch_rx_defer_refill(struct efx_rx_queue *rx_queue); |
614 | extern int efx_farch_ev_probe(struct efx_channel *channel); | 646 | int efx_farch_ev_probe(struct efx_channel *channel); |
615 | extern int efx_farch_ev_init(struct efx_channel *channel); | 647 | int efx_farch_ev_init(struct efx_channel *channel); |
616 | extern void efx_farch_ev_fini(struct efx_channel *channel); | 648 | void efx_farch_ev_fini(struct efx_channel *channel); |
617 | extern void efx_farch_ev_remove(struct efx_channel *channel); | 649 | void efx_farch_ev_remove(struct efx_channel *channel); |
618 | extern int efx_farch_ev_process(struct efx_channel *channel, int quota); | 650 | int efx_farch_ev_process(struct efx_channel *channel, int quota); |
619 | extern void efx_farch_ev_read_ack(struct efx_channel *channel); | 651 | void efx_farch_ev_read_ack(struct efx_channel *channel); |
620 | extern void efx_farch_ev_test_generate(struct efx_channel *channel); | 652 | void efx_farch_ev_test_generate(struct efx_channel *channel); |
621 | 653 | ||
622 | /* Falcon/Siena filter operations */ | 654 | /* Falcon/Siena filter operations */ |
623 | extern int efx_farch_filter_table_probe(struct efx_nic *efx); | 655 | int efx_farch_filter_table_probe(struct efx_nic *efx); |
624 | extern void efx_farch_filter_table_restore(struct efx_nic *efx); | 656 | void efx_farch_filter_table_restore(struct efx_nic *efx); |
625 | extern void efx_farch_filter_table_remove(struct efx_nic *efx); | 657 | void efx_farch_filter_table_remove(struct efx_nic *efx); |
626 | extern void efx_farch_filter_update_rx_scatter(struct efx_nic *efx); | 658 | void efx_farch_filter_update_rx_scatter(struct efx_nic *efx); |
627 | extern s32 efx_farch_filter_insert(struct efx_nic *efx, | 659 | s32 efx_farch_filter_insert(struct efx_nic *efx, struct efx_filter_spec *spec, |
628 | struct efx_filter_spec *spec, bool replace); | 660 | bool replace); |
629 | extern int efx_farch_filter_remove_safe(struct efx_nic *efx, | 661 | int efx_farch_filter_remove_safe(struct efx_nic *efx, |
630 | enum efx_filter_priority priority, | 662 | enum efx_filter_priority priority, |
631 | u32 filter_id); | 663 | u32 filter_id); |
632 | extern int efx_farch_filter_get_safe(struct efx_nic *efx, | 664 | int efx_farch_filter_get_safe(struct efx_nic *efx, |
633 | enum efx_filter_priority priority, | 665 | enum efx_filter_priority priority, u32 filter_id, |
634 | u32 filter_id, struct efx_filter_spec *); | 666 | struct efx_filter_spec *); |
635 | extern void efx_farch_filter_clear_rx(struct efx_nic *efx, | 667 | void efx_farch_filter_clear_rx(struct efx_nic *efx, |
636 | enum efx_filter_priority priority); | 668 | enum efx_filter_priority priority); |
637 | extern u32 efx_farch_filter_count_rx_used(struct efx_nic *efx, | 669 | u32 efx_farch_filter_count_rx_used(struct efx_nic *efx, |
638 | enum efx_filter_priority priority); | 670 | enum efx_filter_priority priority); |
639 | extern u32 efx_farch_filter_get_rx_id_limit(struct efx_nic *efx); | 671 | u32 efx_farch_filter_get_rx_id_limit(struct efx_nic *efx); |
640 | extern s32 efx_farch_filter_get_rx_ids(struct efx_nic *efx, | 672 | s32 efx_farch_filter_get_rx_ids(struct efx_nic *efx, |
641 | enum efx_filter_priority priority, | 673 | enum efx_filter_priority priority, u32 *buf, |
642 | u32 *buf, u32 size); | 674 | u32 size); |
643 | #ifdef CONFIG_RFS_ACCEL | 675 | #ifdef CONFIG_RFS_ACCEL |
644 | extern s32 efx_farch_filter_rfs_insert(struct efx_nic *efx, | 676 | s32 efx_farch_filter_rfs_insert(struct efx_nic *efx, |
645 | struct efx_filter_spec *spec); | 677 | struct efx_filter_spec *spec); |
646 | extern bool efx_farch_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, | 678 | bool efx_farch_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, |
647 | unsigned int index); | 679 | unsigned int index); |
648 | #endif | 680 | #endif |
649 | extern void efx_farch_filter_sync_rx_mode(struct efx_nic *efx); | 681 | void efx_farch_filter_sync_rx_mode(struct efx_nic *efx); |
650 | 682 | ||
651 | extern bool efx_nic_event_present(struct efx_channel *channel); | 683 | bool efx_nic_event_present(struct efx_channel *channel); |
652 | 684 | ||
653 | /* Some statistics are computed as A - B where A and B each increase | 685 | /* Some statistics are computed as A - B where A and B each increase |
654 | * linearly with some hardware counter(s) and the counters are read | 686 | * linearly with some hardware counter(s) and the counters are read |
@@ -669,17 +701,17 @@ static inline void efx_update_diff_stat(u64 *stat, u64 diff) | |||
669 | } | 701 | } |
670 | 702 | ||
671 | /* Interrupts */ | 703 | /* Interrupts */ |
672 | extern int efx_nic_init_interrupt(struct efx_nic *efx); | 704 | int efx_nic_init_interrupt(struct efx_nic *efx); |
673 | extern void efx_nic_irq_test_start(struct efx_nic *efx); | 705 | void efx_nic_irq_test_start(struct efx_nic *efx); |
674 | extern void efx_nic_fini_interrupt(struct efx_nic *efx); | 706 | void efx_nic_fini_interrupt(struct efx_nic *efx); |
675 | 707 | ||
676 | /* Falcon/Siena interrupts */ | 708 | /* Falcon/Siena interrupts */ |
677 | extern void efx_farch_irq_enable_master(struct efx_nic *efx); | 709 | void efx_farch_irq_enable_master(struct efx_nic *efx); |
678 | extern void efx_farch_irq_test_generate(struct efx_nic *efx); | 710 | void efx_farch_irq_test_generate(struct efx_nic *efx); |
679 | extern void efx_farch_irq_disable_master(struct efx_nic *efx); | 711 | void efx_farch_irq_disable_master(struct efx_nic *efx); |
680 | extern irqreturn_t efx_farch_msi_interrupt(int irq, void *dev_id); | 712 | irqreturn_t efx_farch_msi_interrupt(int irq, void *dev_id); |
681 | extern irqreturn_t efx_farch_legacy_interrupt(int irq, void *dev_id); | 713 | irqreturn_t efx_farch_legacy_interrupt(int irq, void *dev_id); |
682 | extern irqreturn_t efx_farch_fatal_interrupt(struct efx_nic *efx); | 714 | irqreturn_t efx_farch_fatal_interrupt(struct efx_nic *efx); |
683 | 715 | ||
684 | static inline int efx_nic_event_test_irq_cpu(struct efx_channel *channel) | 716 | static inline int efx_nic_event_test_irq_cpu(struct efx_channel *channel) |
685 | { | 717 | { |
@@ -691,21 +723,21 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx) | |||
691 | } | 723 | } |
692 | 724 | ||
693 | /* Global Resources */ | 725 | /* Global Resources */ |
694 | extern int efx_nic_flush_queues(struct efx_nic *efx); | 726 | int efx_nic_flush_queues(struct efx_nic *efx); |
695 | extern void siena_prepare_flush(struct efx_nic *efx); | 727 | void siena_prepare_flush(struct efx_nic *efx); |
696 | extern int efx_farch_fini_dmaq(struct efx_nic *efx); | 728 | int efx_farch_fini_dmaq(struct efx_nic *efx); |
697 | extern void siena_finish_flush(struct efx_nic *efx); | 729 | void siena_finish_flush(struct efx_nic *efx); |
698 | extern void falcon_start_nic_stats(struct efx_nic *efx); | 730 | void falcon_start_nic_stats(struct efx_nic *efx); |
699 | extern void falcon_stop_nic_stats(struct efx_nic *efx); | 731 | void falcon_stop_nic_stats(struct efx_nic *efx); |
700 | extern int falcon_reset_xaui(struct efx_nic *efx); | 732 | int falcon_reset_xaui(struct efx_nic *efx); |
701 | extern void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw); | 733 | void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw); |
702 | extern void efx_farch_init_common(struct efx_nic *efx); | 734 | void efx_farch_init_common(struct efx_nic *efx); |
703 | extern void efx_ef10_handle_drain_event(struct efx_nic *efx); | 735 | void efx_ef10_handle_drain_event(struct efx_nic *efx); |
704 | static inline void efx_nic_push_rx_indir_table(struct efx_nic *efx) | 736 | static inline void efx_nic_push_rx_indir_table(struct efx_nic *efx) |
705 | { | 737 | { |
706 | efx->type->rx_push_indir_table(efx); | 738 | efx->type->rx_push_indir_table(efx); |
707 | } | 739 | } |
708 | extern void efx_farch_rx_push_indir_table(struct efx_nic *efx); | 740 | void efx_farch_rx_push_indir_table(struct efx_nic *efx); |
709 | 741 | ||
710 | int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, | 742 | int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, |
711 | unsigned int len, gfp_t gfp_flags); | 743 | unsigned int len, gfp_t gfp_flags); |
@@ -716,24 +748,22 @@ struct efx_farch_register_test { | |||
716 | unsigned address; | 748 | unsigned address; |
717 | efx_oword_t mask; | 749 | efx_oword_t mask; |
718 | }; | 750 | }; |
719 | extern int efx_farch_test_registers(struct efx_nic *efx, | 751 | int efx_farch_test_registers(struct efx_nic *efx, |
720 | const struct efx_farch_register_test *regs, | 752 | const struct efx_farch_register_test *regs, |
721 | size_t n_regs); | 753 | size_t n_regs); |
722 | 754 | ||
723 | extern size_t efx_nic_get_regs_len(struct efx_nic *efx); | 755 | size_t efx_nic_get_regs_len(struct efx_nic *efx); |
724 | extern void efx_nic_get_regs(struct efx_nic *efx, void *buf); | 756 | void efx_nic_get_regs(struct efx_nic *efx, void *buf); |
725 | 757 | ||
726 | extern size_t | 758 | size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, |
727 | efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, | 759 | const unsigned long *mask, u8 *names); |
728 | const unsigned long *mask, u8 *names); | 760 | void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, |
729 | extern void | 761 | const unsigned long *mask, u64 *stats, |
730 | efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, | 762 | const void *dma_buf, bool accumulate); |
731 | const unsigned long *mask, | ||
732 | u64 *stats, const void *dma_buf, bool accumulate); | ||
733 | 763 | ||
734 | #define EFX_MAX_FLUSH_TIME 5000 | 764 | #define EFX_MAX_FLUSH_TIME 5000 |
735 | 765 | ||
736 | extern void efx_farch_generate_event(struct efx_nic *efx, unsigned int evq, | 766 | void efx_farch_generate_event(struct efx_nic *efx, unsigned int evq, |
737 | efx_qword_t *event); | 767 | efx_qword_t *event); |
738 | 768 | ||
739 | #endif /* EFX_NIC_H */ | 769 | #endif /* EFX_NIC_H */ |
diff --git a/drivers/net/ethernet/sfc/phy.h b/drivers/net/ethernet/sfc/phy.h index 45eeb7075156..803bf445c08e 100644 --- a/drivers/net/ethernet/sfc/phy.h +++ b/drivers/net/ethernet/sfc/phy.h | |||
@@ -15,7 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | extern const struct efx_phy_operations falcon_sfx7101_phy_ops; | 16 | extern const struct efx_phy_operations falcon_sfx7101_phy_ops; |
17 | 17 | ||
18 | extern void tenxpress_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); | 18 | void tenxpress_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); |
19 | 19 | ||
20 | /**************************************************************************** | 20 | /**************************************************************************** |
21 | * AMCC/Quake QT202x PHYs | 21 | * AMCC/Quake QT202x PHYs |
@@ -34,7 +34,7 @@ extern const struct efx_phy_operations falcon_qt202x_phy_ops; | |||
34 | #define QUAKE_LED_TXLINK (0) | 34 | #define QUAKE_LED_TXLINK (0) |
35 | #define QUAKE_LED_RXLINK (8) | 35 | #define QUAKE_LED_RXLINK (8) |
36 | 36 | ||
37 | extern void falcon_qt202x_set_led(struct efx_nic *p, int led, int state); | 37 | void falcon_qt202x_set_led(struct efx_nic *p, int led, int state); |
38 | 38 | ||
39 | /**************************************************************************** | 39 | /**************************************************************************** |
40 | * Transwitch CX4 retimer | 40 | * Transwitch CX4 retimer |
@@ -44,7 +44,7 @@ extern const struct efx_phy_operations falcon_txc_phy_ops; | |||
44 | #define TXC_GPIO_DIR_INPUT 0 | 44 | #define TXC_GPIO_DIR_INPUT 0 |
45 | #define TXC_GPIO_DIR_OUTPUT 1 | 45 | #define TXC_GPIO_DIR_OUTPUT 1 |
46 | 46 | ||
47 | extern void falcon_txc_set_gpio_dir(struct efx_nic *efx, int pin, int dir); | 47 | void falcon_txc_set_gpio_dir(struct efx_nic *efx, int pin, int dir); |
48 | extern void falcon_txc_set_gpio_val(struct efx_nic *efx, int pin, int val); | 48 | void falcon_txc_set_gpio_val(struct efx_nic *efx, int pin, int val); |
49 | 49 | ||
50 | #endif | 50 | #endif |
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 4a596725023f..8f09e686fc23 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/in.h> | 12 | #include <linux/in.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/ip.h> | 14 | #include <linux/ip.h> |
15 | #include <linux/ipv6.h> | ||
15 | #include <linux/tcp.h> | 16 | #include <linux/tcp.h> |
16 | #include <linux/udp.h> | 17 | #include <linux/udp.h> |
17 | #include <linux/prefetch.h> | 18 | #include <linux/prefetch.h> |
@@ -818,44 +819,70 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
818 | struct efx_nic *efx = netdev_priv(net_dev); | 819 | struct efx_nic *efx = netdev_priv(net_dev); |
819 | struct efx_channel *channel; | 820 | struct efx_channel *channel; |
820 | struct efx_filter_spec spec; | 821 | struct efx_filter_spec spec; |
821 | const struct iphdr *ip; | ||
822 | const __be16 *ports; | 822 | const __be16 *ports; |
823 | __be16 ether_type; | ||
823 | int nhoff; | 824 | int nhoff; |
824 | int rc; | 825 | int rc; |
825 | 826 | ||
826 | nhoff = skb_network_offset(skb); | 827 | /* The core RPS/RFS code has already parsed and validated |
828 | * VLAN, IP and transport headers. We assume they are in the | ||
829 | * header area. | ||
830 | */ | ||
827 | 831 | ||
828 | if (skb->protocol == htons(ETH_P_8021Q)) { | 832 | if (skb->protocol == htons(ETH_P_8021Q)) { |
829 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < | 833 | const struct vlan_hdr *vh = |
830 | nhoff + sizeof(struct vlan_hdr)); | 834 | (const struct vlan_hdr *)skb->data; |
831 | if (((const struct vlan_hdr *)skb->data + nhoff)-> | ||
832 | h_vlan_encapsulated_proto != htons(ETH_P_IP)) | ||
833 | return -EPROTONOSUPPORT; | ||
834 | 835 | ||
835 | /* This is IP over 802.1q VLAN. We can't filter on the | 836 | /* We can't filter on the IP 5-tuple and the vlan |
836 | * IP 5-tuple and the vlan together, so just strip the | 837 | * together, so just strip the vlan header and filter |
837 | * vlan header and filter on the IP part. | 838 | * on the IP part. |
838 | */ | 839 | */ |
839 | nhoff += sizeof(struct vlan_hdr); | 840 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < sizeof(*vh)); |
840 | } else if (skb->protocol != htons(ETH_P_IP)) { | 841 | ether_type = vh->h_vlan_encapsulated_proto; |
841 | return -EPROTONOSUPPORT; | 842 | nhoff = sizeof(struct vlan_hdr); |
843 | } else { | ||
844 | ether_type = skb->protocol; | ||
845 | nhoff = 0; | ||
842 | } | 846 | } |
843 | 847 | ||
844 | /* RFS must validate the IP header length before calling us */ | 848 | if (ether_type != htons(ETH_P_IP) && ether_type != htons(ETH_P_IPV6)) |
845 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip)); | ||
846 | ip = (const struct iphdr *)(skb->data + nhoff); | ||
847 | if (ip_is_fragment(ip)) | ||
848 | return -EPROTONOSUPPORT; | 849 | return -EPROTONOSUPPORT; |
849 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); | ||
850 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); | ||
851 | 850 | ||
852 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, | 851 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, |
853 | efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0, | 852 | efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0, |
854 | rxq_index); | 853 | rxq_index); |
855 | rc = efx_filter_set_ipv4_full(&spec, ip->protocol, | 854 | spec.match_flags = |
856 | ip->daddr, ports[1], ip->saddr, ports[0]); | 855 | EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO | |
857 | if (rc) | 856 | EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT | |
858 | return rc; | 857 | EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT; |
858 | spec.ether_type = ether_type; | ||
859 | |||
860 | if (ether_type == htons(ETH_P_IP)) { | ||
861 | const struct iphdr *ip = | ||
862 | (const struct iphdr *)(skb->data + nhoff); | ||
863 | |||
864 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip)); | ||
865 | if (ip_is_fragment(ip)) | ||
866 | return -EPROTONOSUPPORT; | ||
867 | spec.ip_proto = ip->protocol; | ||
868 | spec.rem_host[0] = ip->saddr; | ||
869 | spec.loc_host[0] = ip->daddr; | ||
870 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); | ||
871 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); | ||
872 | } else { | ||
873 | const struct ipv6hdr *ip6 = | ||
874 | (const struct ipv6hdr *)(skb->data + nhoff); | ||
875 | |||
876 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < | ||
877 | nhoff + sizeof(*ip6) + 4); | ||
878 | spec.ip_proto = ip6->nexthdr; | ||
879 | memcpy(spec.rem_host, &ip6->saddr, sizeof(ip6->saddr)); | ||
880 | memcpy(spec.loc_host, &ip6->daddr, sizeof(ip6->daddr)); | ||
881 | ports = (const __be16 *)(ip6 + 1); | ||
882 | } | ||
883 | |||
884 | spec.rem_port = ports[0]; | ||
885 | spec.loc_port = ports[1]; | ||
859 | 886 | ||
860 | rc = efx->type->filter_rfs_insert(efx, &spec); | 887 | rc = efx->type->filter_rfs_insert(efx, &spec); |
861 | if (rc < 0) | 888 | if (rc < 0) |
@@ -866,11 +893,18 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
866 | channel = efx_get_channel(efx, skb_get_rx_queue(skb)); | 893 | channel = efx_get_channel(efx, skb_get_rx_queue(skb)); |
867 | ++channel->rfs_filters_added; | 894 | ++channel->rfs_filters_added; |
868 | 895 | ||
869 | netif_info(efx, rx_status, efx->net_dev, | 896 | if (ether_type == htons(ETH_P_IP)) |
870 | "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n", | 897 | netif_info(efx, rx_status, efx->net_dev, |
871 | (ip->protocol == IPPROTO_TCP) ? "TCP" : "UDP", | 898 | "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n", |
872 | &ip->saddr, ntohs(ports[0]), &ip->daddr, ntohs(ports[1]), | 899 | (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", |
873 | rxq_index, flow_id, rc); | 900 | spec.rem_host, ntohs(ports[0]), spec.loc_host, |
901 | ntohs(ports[1]), rxq_index, flow_id, rc); | ||
902 | else | ||
903 | netif_info(efx, rx_status, efx->net_dev, | ||
904 | "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d]\n", | ||
905 | (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", | ||
906 | spec.rem_host, ntohs(ports[0]), spec.loc_host, | ||
907 | ntohs(ports[1]), rxq_index, flow_id, rc); | ||
874 | 908 | ||
875 | return rc; | 909 | return rc; |
876 | } | 910 | } |
diff --git a/drivers/net/ethernet/sfc/selftest.h b/drivers/net/ethernet/sfc/selftest.h index 87698ae0bf75..a2f4a06ffa4e 100644 --- a/drivers/net/ethernet/sfc/selftest.h +++ b/drivers/net/ethernet/sfc/selftest.h | |||
@@ -43,13 +43,12 @@ struct efx_self_tests { | |||
43 | struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1]; | 43 | struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1]; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern void efx_loopback_rx_packet(struct efx_nic *efx, | 46 | void efx_loopback_rx_packet(struct efx_nic *efx, const char *buf_ptr, |
47 | const char *buf_ptr, int pkt_len); | 47 | int pkt_len); |
48 | extern int efx_selftest(struct efx_nic *efx, | 48 | int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, |
49 | struct efx_self_tests *tests, | 49 | unsigned flags); |
50 | unsigned flags); | 50 | void efx_selftest_async_start(struct efx_nic *efx); |
51 | extern void efx_selftest_async_start(struct efx_nic *efx); | 51 | void efx_selftest_async_cancel(struct efx_nic *efx); |
52 | extern void efx_selftest_async_cancel(struct efx_nic *efx); | 52 | void efx_selftest_async_work(struct work_struct *data); |
53 | extern void efx_selftest_async_work(struct work_struct *data); | ||
54 | 53 | ||
55 | #endif /* EFX_SELFTEST_H */ | 54 | #endif /* EFX_SELFTEST_H */ |
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c index 2ac91c5b5eea..282692c48e6b 100644 --- a/drivers/net/ethernet/sfc/tx.c +++ b/drivers/net/ethernet/sfc/tx.c | |||
@@ -17,10 +17,46 @@ | |||
17 | #include <net/ipv6.h> | 17 | #include <net/ipv6.h> |
18 | #include <linux/if_ether.h> | 18 | #include <linux/if_ether.h> |
19 | #include <linux/highmem.h> | 19 | #include <linux/highmem.h> |
20 | #include <linux/cache.h> | ||
20 | #include "net_driver.h" | 21 | #include "net_driver.h" |
21 | #include "efx.h" | 22 | #include "efx.h" |
23 | #include "io.h" | ||
22 | #include "nic.h" | 24 | #include "nic.h" |
23 | #include "workarounds.h" | 25 | #include "workarounds.h" |
26 | #include "ef10_regs.h" | ||
27 | |||
28 | #ifdef EFX_USE_PIO | ||
29 | |||
30 | #define EFX_PIOBUF_SIZE_MAX ER_DZ_TX_PIOBUF_SIZE | ||
31 | #define EFX_PIOBUF_SIZE_DEF ALIGN(256, L1_CACHE_BYTES) | ||
32 | unsigned int efx_piobuf_size __read_mostly = EFX_PIOBUF_SIZE_DEF; | ||
33 | |||
34 | #endif /* EFX_USE_PIO */ | ||
35 | |||
36 | static inline unsigned int | ||
37 | efx_tx_queue_get_insert_index(const struct efx_tx_queue *tx_queue) | ||
38 | { | ||
39 | return tx_queue->insert_count & tx_queue->ptr_mask; | ||
40 | } | ||
41 | |||
42 | static inline struct efx_tx_buffer * | ||
43 | __efx_tx_queue_get_insert_buffer(const struct efx_tx_queue *tx_queue) | ||
44 | { | ||
45 | return &tx_queue->buffer[efx_tx_queue_get_insert_index(tx_queue)]; | ||
46 | } | ||
47 | |||
48 | static inline struct efx_tx_buffer * | ||
49 | efx_tx_queue_get_insert_buffer(const struct efx_tx_queue *tx_queue) | ||
50 | { | ||
51 | struct efx_tx_buffer *buffer = | ||
52 | __efx_tx_queue_get_insert_buffer(tx_queue); | ||
53 | |||
54 | EFX_BUG_ON_PARANOID(buffer->len); | ||
55 | EFX_BUG_ON_PARANOID(buffer->flags); | ||
56 | EFX_BUG_ON_PARANOID(buffer->unmap_len); | ||
57 | |||
58 | return buffer; | ||
59 | } | ||
24 | 60 | ||
25 | static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, | 61 | static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, |
26 | struct efx_tx_buffer *buffer, | 62 | struct efx_tx_buffer *buffer, |
@@ -83,8 +119,10 @@ unsigned int efx_tx_max_skb_descs(struct efx_nic *efx) | |||
83 | */ | 119 | */ |
84 | unsigned int max_descs = EFX_TSO_MAX_SEGS * 2 + MAX_SKB_FRAGS; | 120 | unsigned int max_descs = EFX_TSO_MAX_SEGS * 2 + MAX_SKB_FRAGS; |
85 | 121 | ||
86 | /* Possibly one more per segment for the alignment workaround */ | 122 | /* Possibly one more per segment for the alignment workaround, |
87 | if (EFX_WORKAROUND_5391(efx)) | 123 | * or for option descriptors |
124 | */ | ||
125 | if (EFX_WORKAROUND_5391(efx) || efx_nic_rev(efx) >= EFX_REV_HUNT_A0) | ||
88 | max_descs += EFX_TSO_MAX_SEGS; | 126 | max_descs += EFX_TSO_MAX_SEGS; |
89 | 127 | ||
90 | /* Possibly more for PCIe page boundaries within input fragments */ | 128 | /* Possibly more for PCIe page boundaries within input fragments */ |
@@ -145,6 +183,145 @@ static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1) | |||
145 | } | 183 | } |
146 | } | 184 | } |
147 | 185 | ||
186 | #ifdef EFX_USE_PIO | ||
187 | |||
188 | struct efx_short_copy_buffer { | ||
189 | int used; | ||
190 | u8 buf[L1_CACHE_BYTES]; | ||
191 | }; | ||
192 | |||
193 | /* Copy to PIO, respecting that writes to PIO buffers must be dword aligned. | ||
194 | * Advances piobuf pointer. Leaves additional data in the copy buffer. | ||
195 | */ | ||
196 | static void efx_memcpy_toio_aligned(struct efx_nic *efx, u8 __iomem **piobuf, | ||
197 | u8 *data, int len, | ||
198 | struct efx_short_copy_buffer *copy_buf) | ||
199 | { | ||
200 | int block_len = len & ~(sizeof(copy_buf->buf) - 1); | ||
201 | |||
202 | memcpy_toio(*piobuf, data, block_len); | ||
203 | *piobuf += block_len; | ||
204 | len -= block_len; | ||
205 | |||
206 | if (len) { | ||
207 | data += block_len; | ||
208 | BUG_ON(copy_buf->used); | ||
209 | BUG_ON(len > sizeof(copy_buf->buf)); | ||
210 | memcpy(copy_buf->buf, data, len); | ||
211 | copy_buf->used = len; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | /* Copy to PIO, respecting dword alignment, popping data from copy buffer first. | ||
216 | * Advances piobuf pointer. Leaves additional data in the copy buffer. | ||
217 | */ | ||
218 | static void efx_memcpy_toio_aligned_cb(struct efx_nic *efx, u8 __iomem **piobuf, | ||
219 | u8 *data, int len, | ||
220 | struct efx_short_copy_buffer *copy_buf) | ||
221 | { | ||
222 | if (copy_buf->used) { | ||
223 | /* if the copy buffer is partially full, fill it up and write */ | ||
224 | int copy_to_buf = | ||
225 | min_t(int, sizeof(copy_buf->buf) - copy_buf->used, len); | ||
226 | |||
227 | memcpy(copy_buf->buf + copy_buf->used, data, copy_to_buf); | ||
228 | copy_buf->used += copy_to_buf; | ||
229 | |||
230 | /* if we didn't fill it up then we're done for now */ | ||
231 | if (copy_buf->used < sizeof(copy_buf->buf)) | ||
232 | return; | ||
233 | |||
234 | memcpy_toio(*piobuf, copy_buf->buf, sizeof(copy_buf->buf)); | ||
235 | *piobuf += sizeof(copy_buf->buf); | ||
236 | data += copy_to_buf; | ||
237 | len -= copy_to_buf; | ||
238 | copy_buf->used = 0; | ||
239 | } | ||
240 | |||
241 | efx_memcpy_toio_aligned(efx, piobuf, data, len, copy_buf); | ||
242 | } | ||
243 | |||
244 | static void efx_flush_copy_buffer(struct efx_nic *efx, u8 __iomem *piobuf, | ||
245 | struct efx_short_copy_buffer *copy_buf) | ||
246 | { | ||
247 | /* if there's anything in it, write the whole buffer, including junk */ | ||
248 | if (copy_buf->used) | ||
249 | memcpy_toio(piobuf, copy_buf->buf, sizeof(copy_buf->buf)); | ||
250 | } | ||
251 | |||
252 | /* Traverse skb structure and copy fragments in to PIO buffer. | ||
253 | * Advances piobuf pointer. | ||
254 | */ | ||
255 | static void efx_skb_copy_bits_to_pio(struct efx_nic *efx, struct sk_buff *skb, | ||
256 | u8 __iomem **piobuf, | ||
257 | struct efx_short_copy_buffer *copy_buf) | ||
258 | { | ||
259 | int i; | ||
260 | |||
261 | efx_memcpy_toio_aligned(efx, piobuf, skb->data, skb_headlen(skb), | ||
262 | copy_buf); | ||
263 | |||
264 | for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { | ||
265 | skb_frag_t *f = &skb_shinfo(skb)->frags[i]; | ||
266 | u8 *vaddr; | ||
267 | |||
268 | vaddr = kmap_atomic(skb_frag_page(f)); | ||
269 | |||
270 | efx_memcpy_toio_aligned_cb(efx, piobuf, vaddr + f->page_offset, | ||
271 | skb_frag_size(f), copy_buf); | ||
272 | kunmap_atomic(vaddr); | ||
273 | } | ||
274 | |||
275 | EFX_BUG_ON_PARANOID(skb_shinfo(skb)->frag_list); | ||
276 | } | ||
277 | |||
278 | static struct efx_tx_buffer * | ||
279 | efx_enqueue_skb_pio(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | ||
280 | { | ||
281 | struct efx_tx_buffer *buffer = | ||
282 | efx_tx_queue_get_insert_buffer(tx_queue); | ||
283 | u8 __iomem *piobuf = tx_queue->piobuf; | ||
284 | |||
285 | /* Copy to PIO buffer. Ensure the writes are padded to the end | ||
286 | * of a cache line, as this is required for write-combining to be | ||
287 | * effective on at least x86. | ||
288 | */ | ||
289 | |||
290 | if (skb_shinfo(skb)->nr_frags) { | ||
291 | /* The size of the copy buffer will ensure all writes | ||
292 | * are the size of a cache line. | ||
293 | */ | ||
294 | struct efx_short_copy_buffer copy_buf; | ||
295 | |||
296 | copy_buf.used = 0; | ||
297 | |||
298 | efx_skb_copy_bits_to_pio(tx_queue->efx, skb, | ||
299 | &piobuf, ©_buf); | ||
300 | efx_flush_copy_buffer(tx_queue->efx, piobuf, ©_buf); | ||
301 | } else { | ||
302 | /* Pad the write to the size of a cache line. | ||
303 | * We can do this because we know the skb_shared_info sruct is | ||
304 | * after the source, and the destination buffer is big enough. | ||
305 | */ | ||
306 | BUILD_BUG_ON(L1_CACHE_BYTES > | ||
307 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info))); | ||
308 | memcpy_toio(tx_queue->piobuf, skb->data, | ||
309 | ALIGN(skb->len, L1_CACHE_BYTES)); | ||
310 | } | ||
311 | |||
312 | EFX_POPULATE_QWORD_5(buffer->option, | ||
313 | ESF_DZ_TX_DESC_IS_OPT, 1, | ||
314 | ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_PIO, | ||
315 | ESF_DZ_TX_PIO_CONT, 0, | ||
316 | ESF_DZ_TX_PIO_BYTE_CNT, skb->len, | ||
317 | ESF_DZ_TX_PIO_BUF_ADDR, | ||
318 | tx_queue->piobuf_offset); | ||
319 | ++tx_queue->pio_packets; | ||
320 | ++tx_queue->insert_count; | ||
321 | return buffer; | ||
322 | } | ||
323 | #endif /* EFX_USE_PIO */ | ||
324 | |||
148 | /* | 325 | /* |
149 | * Add a socket buffer to a TX queue | 326 | * Add a socket buffer to a TX queue |
150 | * | 327 | * |
@@ -167,7 +344,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
167 | struct device *dma_dev = &efx->pci_dev->dev; | 344 | struct device *dma_dev = &efx->pci_dev->dev; |
168 | struct efx_tx_buffer *buffer; | 345 | struct efx_tx_buffer *buffer; |
169 | skb_frag_t *fragment; | 346 | skb_frag_t *fragment; |
170 | unsigned int len, unmap_len = 0, insert_ptr; | 347 | unsigned int len, unmap_len = 0; |
171 | dma_addr_t dma_addr, unmap_addr = 0; | 348 | dma_addr_t dma_addr, unmap_addr = 0; |
172 | unsigned int dma_len; | 349 | unsigned int dma_len; |
173 | unsigned short dma_flags; | 350 | unsigned short dma_flags; |
@@ -189,6 +366,17 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
189 | return NETDEV_TX_OK; | 366 | return NETDEV_TX_OK; |
190 | } | 367 | } |
191 | 368 | ||
369 | /* Consider using PIO for short packets */ | ||
370 | #ifdef EFX_USE_PIO | ||
371 | if (skb->len <= efx_piobuf_size && tx_queue->piobuf && | ||
372 | efx_nic_tx_is_empty(tx_queue) && | ||
373 | efx_nic_tx_is_empty(efx_tx_queue_partner(tx_queue))) { | ||
374 | buffer = efx_enqueue_skb_pio(tx_queue, skb); | ||
375 | dma_flags = EFX_TX_BUF_OPTION; | ||
376 | goto finish_packet; | ||
377 | } | ||
378 | #endif | ||
379 | |||
192 | /* Map for DMA. Use dma_map_single rather than dma_map_page | 380 | /* Map for DMA. Use dma_map_single rather than dma_map_page |
193 | * since this is more efficient on machines with sparse | 381 | * since this is more efficient on machines with sparse |
194 | * memory. | 382 | * memory. |
@@ -208,11 +396,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
208 | 396 | ||
209 | /* Add to TX queue, splitting across DMA boundaries */ | 397 | /* Add to TX queue, splitting across DMA boundaries */ |
210 | do { | 398 | do { |
211 | insert_ptr = tx_queue->insert_count & tx_queue->ptr_mask; | 399 | buffer = efx_tx_queue_get_insert_buffer(tx_queue); |
212 | buffer = &tx_queue->buffer[insert_ptr]; | ||
213 | EFX_BUG_ON_PARANOID(buffer->flags); | ||
214 | EFX_BUG_ON_PARANOID(buffer->len); | ||
215 | EFX_BUG_ON_PARANOID(buffer->unmap_len); | ||
216 | 400 | ||
217 | dma_len = efx_max_tx_len(efx, dma_addr); | 401 | dma_len = efx_max_tx_len(efx, dma_addr); |
218 | if (likely(dma_len >= len)) | 402 | if (likely(dma_len >= len)) |
@@ -245,6 +429,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
245 | } | 429 | } |
246 | 430 | ||
247 | /* Transfer ownership of the skb to the final buffer */ | 431 | /* Transfer ownership of the skb to the final buffer */ |
432 | finish_packet: | ||
248 | buffer->skb = skb; | 433 | buffer->skb = skb; |
249 | buffer->flags = EFX_TX_BUF_SKB | dma_flags; | 434 | buffer->flags = EFX_TX_BUF_SKB | dma_flags; |
250 | 435 | ||
@@ -270,8 +455,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
270 | while (tx_queue->insert_count != tx_queue->write_count) { | 455 | while (tx_queue->insert_count != tx_queue->write_count) { |
271 | unsigned int pkts_compl = 0, bytes_compl = 0; | 456 | unsigned int pkts_compl = 0, bytes_compl = 0; |
272 | --tx_queue->insert_count; | 457 | --tx_queue->insert_count; |
273 | insert_ptr = tx_queue->insert_count & tx_queue->ptr_mask; | 458 | buffer = __efx_tx_queue_get_insert_buffer(tx_queue); |
274 | buffer = &tx_queue->buffer[insert_ptr]; | ||
275 | efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); | 459 | efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl); |
276 | } | 460 | } |
277 | 461 | ||
@@ -628,6 +812,9 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue) | |||
628 | * @tcp_off: Offset of TCP header | 812 | * @tcp_off: Offset of TCP header |
629 | * @header_len: Number of bytes of header | 813 | * @header_len: Number of bytes of header |
630 | * @ip_base_len: IPv4 tot_len or IPv6 payload_len, before TCP payload | 814 | * @ip_base_len: IPv4 tot_len or IPv6 payload_len, before TCP payload |
815 | * @header_dma_addr: Header DMA address, when using option descriptors | ||
816 | * @header_unmap_len: Header DMA mapped length, or 0 if not using option | ||
817 | * descriptors | ||
631 | * | 818 | * |
632 | * The state used during segmentation. It is put into this data structure | 819 | * The state used during segmentation. It is put into this data structure |
633 | * just to make it easy to pass into inline functions. | 820 | * just to make it easy to pass into inline functions. |
@@ -636,7 +823,7 @@ struct tso_state { | |||
636 | /* Output position */ | 823 | /* Output position */ |
637 | unsigned out_len; | 824 | unsigned out_len; |
638 | unsigned seqnum; | 825 | unsigned seqnum; |
639 | unsigned ipv4_id; | 826 | u16 ipv4_id; |
640 | unsigned packet_space; | 827 | unsigned packet_space; |
641 | 828 | ||
642 | /* Input position */ | 829 | /* Input position */ |
@@ -651,6 +838,8 @@ struct tso_state { | |||
651 | unsigned int tcp_off; | 838 | unsigned int tcp_off; |
652 | unsigned header_len; | 839 | unsigned header_len; |
653 | unsigned int ip_base_len; | 840 | unsigned int ip_base_len; |
841 | dma_addr_t header_dma_addr; | ||
842 | unsigned int header_unmap_len; | ||
654 | }; | 843 | }; |
655 | 844 | ||
656 | 845 | ||
@@ -737,23 +926,18 @@ static void efx_tx_queue_insert(struct efx_tx_queue *tx_queue, | |||
737 | { | 926 | { |
738 | struct efx_tx_buffer *buffer; | 927 | struct efx_tx_buffer *buffer; |
739 | struct efx_nic *efx = tx_queue->efx; | 928 | struct efx_nic *efx = tx_queue->efx; |
740 | unsigned dma_len, insert_ptr; | 929 | unsigned dma_len; |
741 | 930 | ||
742 | EFX_BUG_ON_PARANOID(len <= 0); | 931 | EFX_BUG_ON_PARANOID(len <= 0); |
743 | 932 | ||
744 | while (1) { | 933 | while (1) { |
745 | insert_ptr = tx_queue->insert_count & tx_queue->ptr_mask; | 934 | buffer = efx_tx_queue_get_insert_buffer(tx_queue); |
746 | buffer = &tx_queue->buffer[insert_ptr]; | ||
747 | ++tx_queue->insert_count; | 935 | ++tx_queue->insert_count; |
748 | 936 | ||
749 | EFX_BUG_ON_PARANOID(tx_queue->insert_count - | 937 | EFX_BUG_ON_PARANOID(tx_queue->insert_count - |
750 | tx_queue->read_count >= | 938 | tx_queue->read_count >= |
751 | efx->txq_entries); | 939 | efx->txq_entries); |
752 | 940 | ||
753 | EFX_BUG_ON_PARANOID(buffer->len); | ||
754 | EFX_BUG_ON_PARANOID(buffer->unmap_len); | ||
755 | EFX_BUG_ON_PARANOID(buffer->flags); | ||
756 | |||
757 | buffer->dma_addr = dma_addr; | 941 | buffer->dma_addr = dma_addr; |
758 | 942 | ||
759 | dma_len = efx_max_tx_len(efx, dma_addr); | 943 | dma_len = efx_max_tx_len(efx, dma_addr); |
@@ -814,19 +998,27 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | |||
814 | /* Work backwards until we hit the original insert pointer value */ | 998 | /* Work backwards until we hit the original insert pointer value */ |
815 | while (tx_queue->insert_count != tx_queue->write_count) { | 999 | while (tx_queue->insert_count != tx_queue->write_count) { |
816 | --tx_queue->insert_count; | 1000 | --tx_queue->insert_count; |
817 | buffer = &tx_queue->buffer[tx_queue->insert_count & | 1001 | buffer = __efx_tx_queue_get_insert_buffer(tx_queue); |
818 | tx_queue->ptr_mask]; | ||
819 | efx_dequeue_buffer(tx_queue, buffer, NULL, NULL); | 1002 | efx_dequeue_buffer(tx_queue, buffer, NULL, NULL); |
820 | } | 1003 | } |
821 | } | 1004 | } |
822 | 1005 | ||
823 | 1006 | ||
824 | /* Parse the SKB header and initialise state. */ | 1007 | /* Parse the SKB header and initialise state. */ |
825 | static void tso_start(struct tso_state *st, const struct sk_buff *skb) | 1008 | static int tso_start(struct tso_state *st, struct efx_nic *efx, |
1009 | const struct sk_buff *skb) | ||
826 | { | 1010 | { |
1011 | bool use_options = efx_nic_rev(efx) >= EFX_REV_HUNT_A0; | ||
1012 | struct device *dma_dev = &efx->pci_dev->dev; | ||
1013 | unsigned int header_len, in_len; | ||
1014 | dma_addr_t dma_addr; | ||
1015 | |||
827 | st->ip_off = skb_network_header(skb) - skb->data; | 1016 | st->ip_off = skb_network_header(skb) - skb->data; |
828 | st->tcp_off = skb_transport_header(skb) - skb->data; | 1017 | st->tcp_off = skb_transport_header(skb) - skb->data; |
829 | st->header_len = st->tcp_off + (tcp_hdr(skb)->doff << 2u); | 1018 | header_len = st->tcp_off + (tcp_hdr(skb)->doff << 2u); |
1019 | in_len = skb_headlen(skb) - header_len; | ||
1020 | st->header_len = header_len; | ||
1021 | st->in_len = in_len; | ||
830 | if (st->protocol == htons(ETH_P_IP)) { | 1022 | if (st->protocol == htons(ETH_P_IP)) { |
831 | st->ip_base_len = st->header_len - st->ip_off; | 1023 | st->ip_base_len = st->header_len - st->ip_off; |
832 | st->ipv4_id = ntohs(ip_hdr(skb)->id); | 1024 | st->ipv4_id = ntohs(ip_hdr(skb)->id); |
@@ -840,9 +1032,34 @@ static void tso_start(struct tso_state *st, const struct sk_buff *skb) | |||
840 | EFX_BUG_ON_PARANOID(tcp_hdr(skb)->syn); | 1032 | EFX_BUG_ON_PARANOID(tcp_hdr(skb)->syn); |
841 | EFX_BUG_ON_PARANOID(tcp_hdr(skb)->rst); | 1033 | EFX_BUG_ON_PARANOID(tcp_hdr(skb)->rst); |
842 | 1034 | ||
843 | st->out_len = skb->len - st->header_len; | 1035 | st->out_len = skb->len - header_len; |
844 | st->unmap_len = 0; | 1036 | |
845 | st->dma_flags = 0; | 1037 | if (!use_options) { |
1038 | st->header_unmap_len = 0; | ||
1039 | |||
1040 | if (likely(in_len == 0)) { | ||
1041 | st->dma_flags = 0; | ||
1042 | st->unmap_len = 0; | ||
1043 | return 0; | ||
1044 | } | ||
1045 | |||
1046 | dma_addr = dma_map_single(dma_dev, skb->data + header_len, | ||
1047 | in_len, DMA_TO_DEVICE); | ||
1048 | st->dma_flags = EFX_TX_BUF_MAP_SINGLE; | ||
1049 | st->dma_addr = dma_addr; | ||
1050 | st->unmap_addr = dma_addr; | ||
1051 | st->unmap_len = in_len; | ||
1052 | } else { | ||
1053 | dma_addr = dma_map_single(dma_dev, skb->data, | ||
1054 | skb_headlen(skb), DMA_TO_DEVICE); | ||
1055 | st->header_dma_addr = dma_addr; | ||
1056 | st->header_unmap_len = skb_headlen(skb); | ||
1057 | st->dma_flags = 0; | ||
1058 | st->dma_addr = dma_addr + header_len; | ||
1059 | st->unmap_len = 0; | ||
1060 | } | ||
1061 | |||
1062 | return unlikely(dma_mapping_error(dma_dev, dma_addr)) ? -ENOMEM : 0; | ||
846 | } | 1063 | } |
847 | 1064 | ||
848 | static int tso_get_fragment(struct tso_state *st, struct efx_nic *efx, | 1065 | static int tso_get_fragment(struct tso_state *st, struct efx_nic *efx, |
@@ -860,24 +1077,6 @@ static int tso_get_fragment(struct tso_state *st, struct efx_nic *efx, | |||
860 | return -ENOMEM; | 1077 | return -ENOMEM; |
861 | } | 1078 | } |
862 | 1079 | ||
863 | static int tso_get_head_fragment(struct tso_state *st, struct efx_nic *efx, | ||
864 | const struct sk_buff *skb) | ||
865 | { | ||
866 | int hl = st->header_len; | ||
867 | int len = skb_headlen(skb) - hl; | ||
868 | |||
869 | st->unmap_addr = dma_map_single(&efx->pci_dev->dev, skb->data + hl, | ||
870 | len, DMA_TO_DEVICE); | ||
871 | if (likely(!dma_mapping_error(&efx->pci_dev->dev, st->unmap_addr))) { | ||
872 | st->dma_flags = EFX_TX_BUF_MAP_SINGLE; | ||
873 | st->unmap_len = len; | ||
874 | st->in_len = len; | ||
875 | st->dma_addr = st->unmap_addr; | ||
876 | return 0; | ||
877 | } | ||
878 | return -ENOMEM; | ||
879 | } | ||
880 | |||
881 | 1080 | ||
882 | /** | 1081 | /** |
883 | * tso_fill_packet_with_fragment - form descriptors for the current fragment | 1082 | * tso_fill_packet_with_fragment - form descriptors for the current fragment |
@@ -944,55 +1143,97 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue, | |||
944 | struct tso_state *st) | 1143 | struct tso_state *st) |
945 | { | 1144 | { |
946 | struct efx_tx_buffer *buffer = | 1145 | struct efx_tx_buffer *buffer = |
947 | &tx_queue->buffer[tx_queue->insert_count & tx_queue->ptr_mask]; | 1146 | efx_tx_queue_get_insert_buffer(tx_queue); |
948 | struct tcphdr *tsoh_th; | 1147 | bool is_last = st->out_len <= skb_shinfo(skb)->gso_size; |
949 | unsigned ip_length; | 1148 | u8 tcp_flags_clear; |
950 | u8 *header; | ||
951 | int rc; | ||
952 | 1149 | ||
953 | /* Allocate and insert a DMA-mapped header buffer. */ | 1150 | if (!is_last) { |
954 | header = efx_tsoh_get_buffer(tx_queue, buffer, st->header_len); | ||
955 | if (!header) | ||
956 | return -ENOMEM; | ||
957 | |||
958 | tsoh_th = (struct tcphdr *)(header + st->tcp_off); | ||
959 | |||
960 | /* Copy and update the headers. */ | ||
961 | memcpy(header, skb->data, st->header_len); | ||
962 | |||
963 | tsoh_th->seq = htonl(st->seqnum); | ||
964 | st->seqnum += skb_shinfo(skb)->gso_size; | ||
965 | if (st->out_len > skb_shinfo(skb)->gso_size) { | ||
966 | /* This packet will not finish the TSO burst. */ | ||
967 | st->packet_space = skb_shinfo(skb)->gso_size; | 1151 | st->packet_space = skb_shinfo(skb)->gso_size; |
968 | tsoh_th->fin = 0; | 1152 | tcp_flags_clear = 0x09; /* mask out FIN and PSH */ |
969 | tsoh_th->psh = 0; | ||
970 | } else { | 1153 | } else { |
971 | /* This packet will be the last in the TSO burst. */ | ||
972 | st->packet_space = st->out_len; | 1154 | st->packet_space = st->out_len; |
973 | tsoh_th->fin = tcp_hdr(skb)->fin; | 1155 | tcp_flags_clear = 0x00; |
974 | tsoh_th->psh = tcp_hdr(skb)->psh; | ||
975 | } | 1156 | } |
976 | ip_length = st->ip_base_len + st->packet_space; | ||
977 | 1157 | ||
978 | if (st->protocol == htons(ETH_P_IP)) { | 1158 | if (!st->header_unmap_len) { |
979 | struct iphdr *tsoh_iph = (struct iphdr *)(header + st->ip_off); | 1159 | /* Allocate and insert a DMA-mapped header buffer. */ |
1160 | struct tcphdr *tsoh_th; | ||
1161 | unsigned ip_length; | ||
1162 | u8 *header; | ||
1163 | int rc; | ||
1164 | |||
1165 | header = efx_tsoh_get_buffer(tx_queue, buffer, st->header_len); | ||
1166 | if (!header) | ||
1167 | return -ENOMEM; | ||
980 | 1168 | ||
981 | tsoh_iph->tot_len = htons(ip_length); | 1169 | tsoh_th = (struct tcphdr *)(header + st->tcp_off); |
1170 | |||
1171 | /* Copy and update the headers. */ | ||
1172 | memcpy(header, skb->data, st->header_len); | ||
1173 | |||
1174 | tsoh_th->seq = htonl(st->seqnum); | ||
1175 | ((u8 *)tsoh_th)[13] &= ~tcp_flags_clear; | ||
1176 | |||
1177 | ip_length = st->ip_base_len + st->packet_space; | ||
1178 | |||
1179 | if (st->protocol == htons(ETH_P_IP)) { | ||
1180 | struct iphdr *tsoh_iph = | ||
1181 | (struct iphdr *)(header + st->ip_off); | ||
1182 | |||
1183 | tsoh_iph->tot_len = htons(ip_length); | ||
1184 | tsoh_iph->id = htons(st->ipv4_id); | ||
1185 | } else { | ||
1186 | struct ipv6hdr *tsoh_iph = | ||
1187 | (struct ipv6hdr *)(header + st->ip_off); | ||
1188 | |||
1189 | tsoh_iph->payload_len = htons(ip_length); | ||
1190 | } | ||
982 | 1191 | ||
983 | /* Linux leaves suitable gaps in the IP ID space for us to fill. */ | 1192 | rc = efx_tso_put_header(tx_queue, buffer, header); |
984 | tsoh_iph->id = htons(st->ipv4_id); | 1193 | if (unlikely(rc)) |
985 | st->ipv4_id++; | 1194 | return rc; |
986 | } else { | 1195 | } else { |
987 | struct ipv6hdr *tsoh_iph = | 1196 | /* Send the original headers with a TSO option descriptor |
988 | (struct ipv6hdr *)(header + st->ip_off); | 1197 | * in front |
1198 | */ | ||
1199 | u8 tcp_flags = ((u8 *)tcp_hdr(skb))[13] & ~tcp_flags_clear; | ||
989 | 1200 | ||
990 | tsoh_iph->payload_len = htons(ip_length); | 1201 | buffer->flags = EFX_TX_BUF_OPTION; |
1202 | buffer->len = 0; | ||
1203 | buffer->unmap_len = 0; | ||
1204 | EFX_POPULATE_QWORD_5(buffer->option, | ||
1205 | ESF_DZ_TX_DESC_IS_OPT, 1, | ||
1206 | ESF_DZ_TX_OPTION_TYPE, | ||
1207 | ESE_DZ_TX_OPTION_DESC_TSO, | ||
1208 | ESF_DZ_TX_TSO_TCP_FLAGS, tcp_flags, | ||
1209 | ESF_DZ_TX_TSO_IP_ID, st->ipv4_id, | ||
1210 | ESF_DZ_TX_TSO_TCP_SEQNO, st->seqnum); | ||
1211 | ++tx_queue->insert_count; | ||
1212 | |||
1213 | /* We mapped the headers in tso_start(). Unmap them | ||
1214 | * when the last segment is completed. | ||
1215 | */ | ||
1216 | buffer = efx_tx_queue_get_insert_buffer(tx_queue); | ||
1217 | buffer->dma_addr = st->header_dma_addr; | ||
1218 | buffer->len = st->header_len; | ||
1219 | if (is_last) { | ||
1220 | buffer->flags = EFX_TX_BUF_CONT | EFX_TX_BUF_MAP_SINGLE; | ||
1221 | buffer->unmap_len = st->header_unmap_len; | ||
1222 | /* Ensure we only unmap them once in case of a | ||
1223 | * later DMA mapping error and rollback | ||
1224 | */ | ||
1225 | st->header_unmap_len = 0; | ||
1226 | } else { | ||
1227 | buffer->flags = EFX_TX_BUF_CONT; | ||
1228 | buffer->unmap_len = 0; | ||
1229 | } | ||
1230 | ++tx_queue->insert_count; | ||
991 | } | 1231 | } |
992 | 1232 | ||
993 | rc = efx_tso_put_header(tx_queue, buffer, header); | 1233 | st->seqnum += skb_shinfo(skb)->gso_size; |
994 | if (unlikely(rc)) | 1234 | |
995 | return rc; | 1235 | /* Linux leaves suitable gaps in the IP ID space for us to fill. */ |
1236 | ++st->ipv4_id; | ||
996 | 1237 | ||
997 | ++tx_queue->tso_packets; | 1238 | ++tx_queue->tso_packets; |
998 | 1239 | ||
@@ -1023,12 +1264,11 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, | |||
1023 | 1264 | ||
1024 | EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count); | 1265 | EFX_BUG_ON_PARANOID(tx_queue->write_count != tx_queue->insert_count); |
1025 | 1266 | ||
1026 | tso_start(&state, skb); | 1267 | rc = tso_start(&state, efx, skb); |
1268 | if (rc) | ||
1269 | goto mem_err; | ||
1027 | 1270 | ||
1028 | /* Assume that skb header area contains exactly the headers, and | 1271 | if (likely(state.in_len == 0)) { |
1029 | * all payload is in the frag list. | ||
1030 | */ | ||
1031 | if (skb_headlen(skb) == state.header_len) { | ||
1032 | /* Grab the first payload fragment. */ | 1272 | /* Grab the first payload fragment. */ |
1033 | EFX_BUG_ON_PARANOID(skb_shinfo(skb)->nr_frags < 1); | 1273 | EFX_BUG_ON_PARANOID(skb_shinfo(skb)->nr_frags < 1); |
1034 | frag_i = 0; | 1274 | frag_i = 0; |
@@ -1037,9 +1277,7 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, | |||
1037 | if (rc) | 1277 | if (rc) |
1038 | goto mem_err; | 1278 | goto mem_err; |
1039 | } else { | 1279 | } else { |
1040 | rc = tso_get_head_fragment(&state, efx, skb); | 1280 | /* Payload starts in the header area. */ |
1041 | if (rc) | ||
1042 | goto mem_err; | ||
1043 | frag_i = -1; | 1281 | frag_i = -1; |
1044 | } | 1282 | } |
1045 | 1283 | ||
@@ -1091,6 +1329,11 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, | |||
1091 | state.unmap_len, DMA_TO_DEVICE); | 1329 | state.unmap_len, DMA_TO_DEVICE); |
1092 | } | 1330 | } |
1093 | 1331 | ||
1332 | /* Free the header DMA mapping, if using option descriptors */ | ||
1333 | if (state.header_unmap_len) | ||
1334 | dma_unmap_single(&efx->pci_dev->dev, state.header_dma_addr, | ||
1335 | state.header_unmap_len, DMA_TO_DEVICE); | ||
1336 | |||
1094 | efx_enqueue_unwind(tx_queue); | 1337 | efx_enqueue_unwind(tx_queue); |
1095 | return NETDEV_TX_OK; | 1338 | return NETDEV_TX_OK; |
1096 | } | 1339 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 7eb8babed2cb..fc94f202a43e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h | |||
@@ -451,14 +451,14 @@ struct mac_device_info { | |||
451 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr); | 451 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr); |
452 | struct mac_device_info *dwmac100_setup(void __iomem *ioaddr); | 452 | struct mac_device_info *dwmac100_setup(void __iomem *ioaddr); |
453 | 453 | ||
454 | extern void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6], | 454 | void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6], |
455 | unsigned int high, unsigned int low); | 455 | unsigned int high, unsigned int low); |
456 | extern void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, | 456 | void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, |
457 | unsigned int high, unsigned int low); | 457 | unsigned int high, unsigned int low); |
458 | 458 | ||
459 | extern void stmmac_set_mac(void __iomem *ioaddr, bool enable); | 459 | void stmmac_set_mac(void __iomem *ioaddr, bool enable); |
460 | 460 | ||
461 | extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); | 461 | void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); |
462 | extern const struct stmmac_ring_mode_ops ring_mode_ops; | 462 | extern const struct stmmac_ring_mode_ops ring_mode_ops; |
463 | extern const struct stmmac_chain_mode_ops chain_mode_ops; | 463 | extern const struct stmmac_chain_mode_ops chain_mode_ops; |
464 | 464 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h index 8e5662ce488b..def266da55db 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | |||
@@ -104,14 +104,13 @@ | |||
104 | #define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */ | 104 | #define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */ |
105 | #define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */ | 105 | #define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */ |
106 | 106 | ||
107 | extern void dwmac_enable_dma_transmission(void __iomem *ioaddr); | 107 | void dwmac_enable_dma_transmission(void __iomem *ioaddr); |
108 | extern void dwmac_enable_dma_irq(void __iomem *ioaddr); | 108 | void dwmac_enable_dma_irq(void __iomem *ioaddr); |
109 | extern void dwmac_disable_dma_irq(void __iomem *ioaddr); | 109 | void dwmac_disable_dma_irq(void __iomem *ioaddr); |
110 | extern void dwmac_dma_start_tx(void __iomem *ioaddr); | 110 | void dwmac_dma_start_tx(void __iomem *ioaddr); |
111 | extern void dwmac_dma_stop_tx(void __iomem *ioaddr); | 111 | void dwmac_dma_stop_tx(void __iomem *ioaddr); |
112 | extern void dwmac_dma_start_rx(void __iomem *ioaddr); | 112 | void dwmac_dma_start_rx(void __iomem *ioaddr); |
113 | extern void dwmac_dma_stop_rx(void __iomem *ioaddr); | 113 | void dwmac_dma_stop_rx(void __iomem *ioaddr); |
114 | extern int dwmac_dma_interrupt(void __iomem *ioaddr, | 114 | int dwmac_dma_interrupt(void __iomem *ioaddr, struct stmmac_extra_stats *x); |
115 | struct stmmac_extra_stats *x); | ||
116 | 115 | ||
117 | #endif /* __DWMAC_DMA_H__ */ | 116 | #endif /* __DWMAC_DMA_H__ */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc.h b/drivers/net/ethernet/stmicro/stmmac/mmc.h index 48ec001566b5..8607488cbcfc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc.h +++ b/drivers/net/ethernet/stmicro/stmmac/mmc.h | |||
@@ -128,8 +128,8 @@ struct stmmac_counters { | |||
128 | unsigned int mmc_rx_icmp_err_octets; | 128 | unsigned int mmc_rx_icmp_err_octets; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | extern void dwmac_mmc_ctrl(void __iomem *ioaddr, unsigned int mode); | 131 | void dwmac_mmc_ctrl(void __iomem *ioaddr, unsigned int mode); |
132 | extern void dwmac_mmc_intr_all_mask(void __iomem *ioaddr); | 132 | void dwmac_mmc_intr_all_mask(void __iomem *ioaddr); |
133 | extern void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc); | 133 | void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc); |
134 | 134 | ||
135 | #endif /* __MMC_H__ */ | 135 | #endif /* __MMC_H__ */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index f16a9bdf45bb..22f89ffdfd95 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -110,14 +110,14 @@ struct stmmac_priv { | |||
110 | 110 | ||
111 | extern int phyaddr; | 111 | extern int phyaddr; |
112 | 112 | ||
113 | extern int stmmac_mdio_unregister(struct net_device *ndev); | 113 | int stmmac_mdio_unregister(struct net_device *ndev); |
114 | extern int stmmac_mdio_register(struct net_device *ndev); | 114 | int stmmac_mdio_register(struct net_device *ndev); |
115 | extern void stmmac_set_ethtool_ops(struct net_device *netdev); | 115 | void stmmac_set_ethtool_ops(struct net_device *netdev); |
116 | extern const struct stmmac_desc_ops enh_desc_ops; | 116 | extern const struct stmmac_desc_ops enh_desc_ops; |
117 | extern const struct stmmac_desc_ops ndesc_ops; | 117 | extern const struct stmmac_desc_ops ndesc_ops; |
118 | extern const struct stmmac_hwtimestamp stmmac_ptp; | 118 | extern const struct stmmac_hwtimestamp stmmac_ptp; |
119 | extern int stmmac_ptp_register(struct stmmac_priv *priv); | 119 | int stmmac_ptp_register(struct stmmac_priv *priv); |
120 | extern void stmmac_ptp_unregister(struct stmmac_priv *priv); | 120 | void stmmac_ptp_unregister(struct stmmac_priv *priv); |
121 | int stmmac_freeze(struct net_device *ndev); | 121 | int stmmac_freeze(struct net_device *ndev); |
122 | int stmmac_restore(struct net_device *ndev); | 122 | int stmmac_restore(struct net_device *ndev); |
123 | int stmmac_resume(struct net_device *ndev); | 123 | int stmmac_resume(struct net_device *ndev); |
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig index de71b1ec4625..53150c25a96b 100644 --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig | |||
@@ -49,11 +49,19 @@ config TI_DAVINCI_CPDMA | |||
49 | To compile this driver as a module, choose M here: the module | 49 | To compile this driver as a module, choose M here: the module |
50 | will be called davinci_cpdma. This is recommended. | 50 | will be called davinci_cpdma. This is recommended. |
51 | 51 | ||
52 | config TI_CPSW_PHY_SEL | ||
53 | boolean "TI CPSW Switch Phy sel Support" | ||
54 | depends on TI_CPSW | ||
55 | ---help--- | ||
56 | This driver supports configuring of the phy mode connected to | ||
57 | the CPSW. | ||
58 | |||
52 | config TI_CPSW | 59 | config TI_CPSW |
53 | tristate "TI CPSW Switch Support" | 60 | tristate "TI CPSW Switch Support" |
54 | depends on ARM && (ARCH_DAVINCI || SOC_AM33XX) | 61 | depends on ARM && (ARCH_DAVINCI || SOC_AM33XX) |
55 | select TI_DAVINCI_CPDMA | 62 | select TI_DAVINCI_CPDMA |
56 | select TI_DAVINCI_MDIO | 63 | select TI_DAVINCI_MDIO |
64 | select TI_CPSW_PHY_SEL | ||
57 | ---help--- | 65 | ---help--- |
58 | This driver supports TI's CPSW Ethernet Switch. | 66 | This driver supports TI's CPSW Ethernet Switch. |
59 | 67 | ||
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile index c65148e8aa1d..9cfaab8152be 100644 --- a/drivers/net/ethernet/ti/Makefile +++ b/drivers/net/ethernet/ti/Makefile | |||
@@ -7,5 +7,6 @@ obj-$(CONFIG_CPMAC) += cpmac.o | |||
7 | obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o | 7 | obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o |
8 | obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o | 8 | obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o |
9 | obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o | 9 | obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o |
10 | obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o | ||
10 | obj-$(CONFIG_TI_CPSW) += ti_cpsw.o | 11 | obj-$(CONFIG_TI_CPSW) += ti_cpsw.o |
11 | ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o | 12 | ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o |
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c new file mode 100644 index 000000000000..148da9ae8366 --- /dev/null +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* Texas Instruments Ethernet Switch Driver | ||
2 | * | ||
3 | * Copyright (C) 2013 Texas Instruments | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * version 2 as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
10 | * kind, whether express or implied; without even the implied warranty | ||
11 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/netdevice.h> | ||
18 | #include <linux/phy.h> | ||
19 | #include <linux/of.h> | ||
20 | #include <linux/of_device.h> | ||
21 | |||
22 | #include "cpsw.h" | ||
23 | |||
24 | /* AM33xx SoC specific definitions for the CONTROL port */ | ||
25 | #define AM33XX_GMII_SEL_MODE_MII 0 | ||
26 | #define AM33XX_GMII_SEL_MODE_RMII 1 | ||
27 | #define AM33XX_GMII_SEL_MODE_RGMII 2 | ||
28 | |||
29 | #define AM33XX_GMII_SEL_RMII2_IO_CLK_EN BIT(7) | ||
30 | #define AM33XX_GMII_SEL_RMII1_IO_CLK_EN BIT(6) | ||
31 | |||
32 | struct cpsw_phy_sel_priv { | ||
33 | struct device *dev; | ||
34 | u32 __iomem *gmii_sel; | ||
35 | bool rmii_clock_external; | ||
36 | void (*cpsw_phy_sel)(struct cpsw_phy_sel_priv *priv, | ||
37 | phy_interface_t phy_mode, int slave); | ||
38 | }; | ||
39 | |||
40 | |||
41 | static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv, | ||
42 | phy_interface_t phy_mode, int slave) | ||
43 | { | ||
44 | u32 reg; | ||
45 | u32 mask; | ||
46 | u32 mode = 0; | ||
47 | |||
48 | reg = readl(priv->gmii_sel); | ||
49 | |||
50 | switch (phy_mode) { | ||
51 | case PHY_INTERFACE_MODE_RMII: | ||
52 | mode = AM33XX_GMII_SEL_MODE_RMII; | ||
53 | break; | ||
54 | |||
55 | case PHY_INTERFACE_MODE_RGMII: | ||
56 | case PHY_INTERFACE_MODE_RGMII_ID: | ||
57 | case PHY_INTERFACE_MODE_RGMII_RXID: | ||
58 | case PHY_INTERFACE_MODE_RGMII_TXID: | ||
59 | mode = AM33XX_GMII_SEL_MODE_RGMII; | ||
60 | break; | ||
61 | |||
62 | case PHY_INTERFACE_MODE_MII: | ||
63 | default: | ||
64 | mode = AM33XX_GMII_SEL_MODE_MII; | ||
65 | break; | ||
66 | }; | ||
67 | |||
68 | mask = 0x3 << (slave * 2) | BIT(slave + 6); | ||
69 | mode <<= slave * 2; | ||
70 | |||
71 | if (priv->rmii_clock_external) { | ||
72 | if (slave == 0) | ||
73 | mode |= AM33XX_GMII_SEL_RMII1_IO_CLK_EN; | ||
74 | else | ||
75 | mode |= AM33XX_GMII_SEL_RMII2_IO_CLK_EN; | ||
76 | } | ||
77 | |||
78 | reg &= ~mask; | ||
79 | reg |= mode; | ||
80 | |||
81 | writel(reg, priv->gmii_sel); | ||
82 | } | ||
83 | |||
84 | static struct platform_driver cpsw_phy_sel_driver; | ||
85 | static int match(struct device *dev, void *data) | ||
86 | { | ||
87 | struct device_node *node = (struct device_node *)data; | ||
88 | return dev->of_node == node && | ||
89 | dev->driver == &cpsw_phy_sel_driver.driver; | ||
90 | } | ||
91 | |||
92 | void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave) | ||
93 | { | ||
94 | struct device_node *node; | ||
95 | struct cpsw_phy_sel_priv *priv; | ||
96 | |||
97 | node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel"); | ||
98 | if (!node) { | ||
99 | dev_err(dev, "Phy mode driver DT not found\n"); | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | dev = bus_find_device(&platform_bus_type, NULL, node, match); | ||
104 | priv = dev_get_drvdata(dev); | ||
105 | |||
106 | priv->cpsw_phy_sel(priv, phy_mode, slave); | ||
107 | } | ||
108 | EXPORT_SYMBOL_GPL(cpsw_phy_sel); | ||
109 | |||
110 | static const struct of_device_id cpsw_phy_sel_id_table[] = { | ||
111 | { | ||
112 | .compatible = "ti,am3352-cpsw-phy-sel", | ||
113 | .data = &cpsw_gmii_sel_am3352, | ||
114 | }, | ||
115 | {} | ||
116 | }; | ||
117 | MODULE_DEVICE_TABLE(of, cpsw_phy_sel_id_table); | ||
118 | |||
119 | static int cpsw_phy_sel_probe(struct platform_device *pdev) | ||
120 | { | ||
121 | struct resource *res; | ||
122 | const struct of_device_id *of_id; | ||
123 | struct cpsw_phy_sel_priv *priv; | ||
124 | |||
125 | of_id = of_match_node(cpsw_phy_sel_id_table, pdev->dev.of_node); | ||
126 | if (!of_id) | ||
127 | return -EINVAL; | ||
128 | |||
129 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | ||
130 | if (!priv) { | ||
131 | dev_err(&pdev->dev, "unable to alloc memory for cpsw phy sel\n"); | ||
132 | return -ENOMEM; | ||
133 | } | ||
134 | |||
135 | priv->cpsw_phy_sel = of_id->data; | ||
136 | |||
137 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gmii-sel"); | ||
138 | priv->gmii_sel = devm_ioremap_resource(&pdev->dev, res); | ||
139 | if (IS_ERR(priv->gmii_sel)) | ||
140 | return PTR_ERR(priv->gmii_sel); | ||
141 | |||
142 | if (of_find_property(pdev->dev.of_node, "rmii-clock-ext", NULL)) | ||
143 | priv->rmii_clock_external = true; | ||
144 | |||
145 | dev_set_drvdata(&pdev->dev, priv); | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static struct platform_driver cpsw_phy_sel_driver = { | ||
151 | .probe = cpsw_phy_sel_probe, | ||
152 | .driver = { | ||
153 | .name = "cpsw-phy-sel", | ||
154 | .owner = THIS_MODULE, | ||
155 | .of_match_table = cpsw_phy_sel_id_table, | ||
156 | }, | ||
157 | }; | ||
158 | |||
159 | module_platform_driver(cpsw_phy_sel_driver); | ||
160 | MODULE_AUTHOR("Mugunthan V N <mugunthanvnm@ti.com>"); | ||
161 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 79974e31187a..7290f11a937d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -367,8 +367,6 @@ struct cpsw_priv { | |||
367 | spinlock_t lock; | 367 | spinlock_t lock; |
368 | struct platform_device *pdev; | 368 | struct platform_device *pdev; |
369 | struct net_device *ndev; | 369 | struct net_device *ndev; |
370 | struct resource *cpsw_res; | ||
371 | struct resource *cpsw_wr_res; | ||
372 | struct napi_struct napi; | 370 | struct napi_struct napi; |
373 | struct device *dev; | 371 | struct device *dev; |
374 | struct cpsw_platform_data data; | 372 | struct cpsw_platform_data data; |
@@ -1023,6 +1021,10 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) | |||
1023 | dev_info(priv->dev, "phy found : id is : 0x%x\n", | 1021 | dev_info(priv->dev, "phy found : id is : 0x%x\n", |
1024 | slave->phy->phy_id); | 1022 | slave->phy->phy_id); |
1025 | phy_start(slave->phy); | 1023 | phy_start(slave->phy); |
1024 | |||
1025 | /* Configure GMII_SEL register */ | ||
1026 | cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, | ||
1027 | slave->slave_num); | ||
1026 | } | 1028 | } |
1027 | } | 1029 | } |
1028 | 1030 | ||
@@ -1712,62 +1714,55 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1712 | 1714 | ||
1713 | if (of_property_read_u32(node, "active_slave", &prop)) { | 1715 | if (of_property_read_u32(node, "active_slave", &prop)) { |
1714 | pr_err("Missing active_slave property in the DT.\n"); | 1716 | pr_err("Missing active_slave property in the DT.\n"); |
1715 | ret = -EINVAL; | 1717 | return -EINVAL; |
1716 | goto error_ret; | ||
1717 | } | 1718 | } |
1718 | data->active_slave = prop; | 1719 | data->active_slave = prop; |
1719 | 1720 | ||
1720 | if (of_property_read_u32(node, "cpts_clock_mult", &prop)) { | 1721 | if (of_property_read_u32(node, "cpts_clock_mult", &prop)) { |
1721 | pr_err("Missing cpts_clock_mult property in the DT.\n"); | 1722 | pr_err("Missing cpts_clock_mult property in the DT.\n"); |
1722 | ret = -EINVAL; | 1723 | return -EINVAL; |
1723 | goto error_ret; | ||
1724 | } | 1724 | } |
1725 | data->cpts_clock_mult = prop; | 1725 | data->cpts_clock_mult = prop; |
1726 | 1726 | ||
1727 | if (of_property_read_u32(node, "cpts_clock_shift", &prop)) { | 1727 | if (of_property_read_u32(node, "cpts_clock_shift", &prop)) { |
1728 | pr_err("Missing cpts_clock_shift property in the DT.\n"); | 1728 | pr_err("Missing cpts_clock_shift property in the DT.\n"); |
1729 | ret = -EINVAL; | 1729 | return -EINVAL; |
1730 | goto error_ret; | ||
1731 | } | 1730 | } |
1732 | data->cpts_clock_shift = prop; | 1731 | data->cpts_clock_shift = prop; |
1733 | 1732 | ||
1734 | data->slave_data = kcalloc(data->slaves, sizeof(struct cpsw_slave_data), | 1733 | data->slave_data = devm_kzalloc(&pdev->dev, data->slaves |
1735 | GFP_KERNEL); | 1734 | * sizeof(struct cpsw_slave_data), |
1735 | GFP_KERNEL); | ||
1736 | if (!data->slave_data) | 1736 | if (!data->slave_data) |
1737 | return -EINVAL; | 1737 | return -ENOMEM; |
1738 | 1738 | ||
1739 | if (of_property_read_u32(node, "cpdma_channels", &prop)) { | 1739 | if (of_property_read_u32(node, "cpdma_channels", &prop)) { |
1740 | pr_err("Missing cpdma_channels property in the DT.\n"); | 1740 | pr_err("Missing cpdma_channels property in the DT.\n"); |
1741 | ret = -EINVAL; | 1741 | return -EINVAL; |
1742 | goto error_ret; | ||
1743 | } | 1742 | } |
1744 | data->channels = prop; | 1743 | data->channels = prop; |
1745 | 1744 | ||
1746 | if (of_property_read_u32(node, "ale_entries", &prop)) { | 1745 | if (of_property_read_u32(node, "ale_entries", &prop)) { |
1747 | pr_err("Missing ale_entries property in the DT.\n"); | 1746 | pr_err("Missing ale_entries property in the DT.\n"); |
1748 | ret = -EINVAL; | 1747 | return -EINVAL; |
1749 | goto error_ret; | ||
1750 | } | 1748 | } |
1751 | data->ale_entries = prop; | 1749 | data->ale_entries = prop; |
1752 | 1750 | ||
1753 | if (of_property_read_u32(node, "bd_ram_size", &prop)) { | 1751 | if (of_property_read_u32(node, "bd_ram_size", &prop)) { |
1754 | pr_err("Missing bd_ram_size property in the DT.\n"); | 1752 | pr_err("Missing bd_ram_size property in the DT.\n"); |
1755 | ret = -EINVAL; | 1753 | return -EINVAL; |
1756 | goto error_ret; | ||
1757 | } | 1754 | } |
1758 | data->bd_ram_size = prop; | 1755 | data->bd_ram_size = prop; |
1759 | 1756 | ||
1760 | if (of_property_read_u32(node, "rx_descs", &prop)) { | 1757 | if (of_property_read_u32(node, "rx_descs", &prop)) { |
1761 | pr_err("Missing rx_descs property in the DT.\n"); | 1758 | pr_err("Missing rx_descs property in the DT.\n"); |
1762 | ret = -EINVAL; | 1759 | return -EINVAL; |
1763 | goto error_ret; | ||
1764 | } | 1760 | } |
1765 | data->rx_descs = prop; | 1761 | data->rx_descs = prop; |
1766 | 1762 | ||
1767 | if (of_property_read_u32(node, "mac_control", &prop)) { | 1763 | if (of_property_read_u32(node, "mac_control", &prop)) { |
1768 | pr_err("Missing mac_control property in the DT.\n"); | 1764 | pr_err("Missing mac_control property in the DT.\n"); |
1769 | ret = -EINVAL; | 1765 | return -EINVAL; |
1770 | goto error_ret; | ||
1771 | } | 1766 | } |
1772 | data->mac_control = prop; | 1767 | data->mac_control = prop; |
1773 | 1768 | ||
@@ -1794,8 +1789,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1794 | parp = of_get_property(slave_node, "phy_id", &lenp); | 1789 | parp = of_get_property(slave_node, "phy_id", &lenp); |
1795 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { | 1790 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
1796 | pr_err("Missing slave[%d] phy_id property\n", i); | 1791 | pr_err("Missing slave[%d] phy_id property\n", i); |
1797 | ret = -EINVAL; | 1792 | return -EINVAL; |
1798 | goto error_ret; | ||
1799 | } | 1793 | } |
1800 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); | 1794 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); |
1801 | phyid = be32_to_cpup(parp+1); | 1795 | phyid = be32_to_cpup(parp+1); |
@@ -1825,10 +1819,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1825 | } | 1819 | } |
1826 | 1820 | ||
1827 | return 0; | 1821 | return 0; |
1828 | |||
1829 | error_ret: | ||
1830 | kfree(data->slave_data); | ||
1831 | return ret; | ||
1832 | } | 1822 | } |
1833 | 1823 | ||
1834 | static int cpsw_probe_dual_emac(struct platform_device *pdev, | 1824 | static int cpsw_probe_dual_emac(struct platform_device *pdev, |
@@ -1870,7 +1860,6 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev, | |||
1870 | priv_sl2->coal_intvl = 0; | 1860 | priv_sl2->coal_intvl = 0; |
1871 | priv_sl2->bus_freq_mhz = priv->bus_freq_mhz; | 1861 | priv_sl2->bus_freq_mhz = priv->bus_freq_mhz; |
1872 | 1862 | ||
1873 | priv_sl2->cpsw_res = priv->cpsw_res; | ||
1874 | priv_sl2->regs = priv->regs; | 1863 | priv_sl2->regs = priv->regs; |
1875 | priv_sl2->host_port = priv->host_port; | 1864 | priv_sl2->host_port = priv->host_port; |
1876 | priv_sl2->host_port_regs = priv->host_port_regs; | 1865 | priv_sl2->host_port_regs = priv->host_port_regs; |
@@ -1914,8 +1903,8 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1914 | struct cpsw_priv *priv; | 1903 | struct cpsw_priv *priv; |
1915 | struct cpdma_params dma_params; | 1904 | struct cpdma_params dma_params; |
1916 | struct cpsw_ale_params ale_params; | 1905 | struct cpsw_ale_params ale_params; |
1917 | void __iomem *ss_regs, *wr_regs; | 1906 | void __iomem *ss_regs; |
1918 | struct resource *res; | 1907 | struct resource *res, *ss_res; |
1919 | u32 slave_offset, sliver_offset, slave_size; | 1908 | u32 slave_offset, sliver_offset, slave_size; |
1920 | int ret = 0, i, k = 0; | 1909 | int ret = 0, i, k = 0; |
1921 | 1910 | ||
@@ -1951,7 +1940,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1951 | if (cpsw_probe_dt(&priv->data, pdev)) { | 1940 | if (cpsw_probe_dt(&priv->data, pdev)) { |
1952 | pr_err("cpsw: platform data missing\n"); | 1941 | pr_err("cpsw: platform data missing\n"); |
1953 | ret = -ENODEV; | 1942 | ret = -ENODEV; |
1954 | goto clean_ndev_ret; | 1943 | goto clean_runtime_disable_ret; |
1955 | } | 1944 | } |
1956 | data = &priv->data; | 1945 | data = &priv->data; |
1957 | 1946 | ||
@@ -1965,11 +1954,12 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1965 | 1954 | ||
1966 | memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); | 1955 | memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); |
1967 | 1956 | ||
1968 | priv->slaves = kzalloc(sizeof(struct cpsw_slave) * data->slaves, | 1957 | priv->slaves = devm_kzalloc(&pdev->dev, |
1969 | GFP_KERNEL); | 1958 | sizeof(struct cpsw_slave) * data->slaves, |
1959 | GFP_KERNEL); | ||
1970 | if (!priv->slaves) { | 1960 | if (!priv->slaves) { |
1971 | ret = -EBUSY; | 1961 | ret = -ENOMEM; |
1972 | goto clean_ndev_ret; | 1962 | goto clean_runtime_disable_ret; |
1973 | } | 1963 | } |
1974 | for (i = 0; i < data->slaves; i++) | 1964 | for (i = 0; i < data->slaves; i++) |
1975 | priv->slaves[i].slave_num = i; | 1965 | priv->slaves[i].slave_num = i; |
@@ -1977,55 +1967,31 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1977 | priv->slaves[0].ndev = ndev; | 1967 | priv->slaves[0].ndev = ndev; |
1978 | priv->emac_port = 0; | 1968 | priv->emac_port = 0; |
1979 | 1969 | ||
1980 | priv->clk = clk_get(&pdev->dev, "fck"); | 1970 | priv->clk = devm_clk_get(&pdev->dev, "fck"); |
1981 | if (IS_ERR(priv->clk)) { | 1971 | if (IS_ERR(priv->clk)) { |
1982 | dev_err(&pdev->dev, "fck is not found\n"); | 1972 | dev_err(priv->dev, "fck is not found\n"); |
1983 | ret = -ENODEV; | 1973 | ret = -ENODEV; |
1984 | goto clean_slave_ret; | 1974 | goto clean_runtime_disable_ret; |
1985 | } | 1975 | } |
1986 | priv->coal_intvl = 0; | 1976 | priv->coal_intvl = 0; |
1987 | priv->bus_freq_mhz = clk_get_rate(priv->clk) / 1000000; | 1977 | priv->bus_freq_mhz = clk_get_rate(priv->clk) / 1000000; |
1988 | 1978 | ||
1989 | priv->cpsw_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1979 | ss_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1990 | if (!priv->cpsw_res) { | 1980 | ss_regs = devm_ioremap_resource(&pdev->dev, ss_res); |
1991 | dev_err(priv->dev, "error getting i/o resource\n"); | 1981 | if (IS_ERR(ss_regs)) { |
1992 | ret = -ENOENT; | 1982 | ret = PTR_ERR(ss_regs); |
1993 | goto clean_clk_ret; | 1983 | goto clean_runtime_disable_ret; |
1994 | } | ||
1995 | if (!request_mem_region(priv->cpsw_res->start, | ||
1996 | resource_size(priv->cpsw_res), ndev->name)) { | ||
1997 | dev_err(priv->dev, "failed request i/o region\n"); | ||
1998 | ret = -ENXIO; | ||
1999 | goto clean_clk_ret; | ||
2000 | } | ||
2001 | ss_regs = ioremap(priv->cpsw_res->start, resource_size(priv->cpsw_res)); | ||
2002 | if (!ss_regs) { | ||
2003 | dev_err(priv->dev, "unable to map i/o region\n"); | ||
2004 | goto clean_cpsw_iores_ret; | ||
2005 | } | 1984 | } |
2006 | priv->regs = ss_regs; | 1985 | priv->regs = ss_regs; |
2007 | priv->version = __raw_readl(&priv->regs->id_ver); | 1986 | priv->version = __raw_readl(&priv->regs->id_ver); |
2008 | priv->host_port = HOST_PORT_NUM; | 1987 | priv->host_port = HOST_PORT_NUM; |
2009 | 1988 | ||
2010 | priv->cpsw_wr_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1989 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
2011 | if (!priv->cpsw_wr_res) { | 1990 | priv->wr_regs = devm_ioremap_resource(&pdev->dev, res); |
2012 | dev_err(priv->dev, "error getting i/o resource\n"); | 1991 | if (IS_ERR(priv->wr_regs)) { |
2013 | ret = -ENOENT; | 1992 | ret = PTR_ERR(priv->wr_regs); |
2014 | goto clean_iomap_ret; | 1993 | goto clean_runtime_disable_ret; |
2015 | } | ||
2016 | if (!request_mem_region(priv->cpsw_wr_res->start, | ||
2017 | resource_size(priv->cpsw_wr_res), ndev->name)) { | ||
2018 | dev_err(priv->dev, "failed request i/o region\n"); | ||
2019 | ret = -ENXIO; | ||
2020 | goto clean_iomap_ret; | ||
2021 | } | 1994 | } |
2022 | wr_regs = ioremap(priv->cpsw_wr_res->start, | ||
2023 | resource_size(priv->cpsw_wr_res)); | ||
2024 | if (!wr_regs) { | ||
2025 | dev_err(priv->dev, "unable to map i/o region\n"); | ||
2026 | goto clean_cpsw_wr_iores_ret; | ||
2027 | } | ||
2028 | priv->wr_regs = wr_regs; | ||
2029 | 1995 | ||
2030 | memset(&dma_params, 0, sizeof(dma_params)); | 1996 | memset(&dma_params, 0, sizeof(dma_params)); |
2031 | memset(&ale_params, 0, sizeof(ale_params)); | 1997 | memset(&ale_params, 0, sizeof(ale_params)); |
@@ -2056,12 +2022,12 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2056 | slave_size = CPSW2_SLAVE_SIZE; | 2022 | slave_size = CPSW2_SLAVE_SIZE; |
2057 | sliver_offset = CPSW2_SLIVER_OFFSET; | 2023 | sliver_offset = CPSW2_SLIVER_OFFSET; |
2058 | dma_params.desc_mem_phys = | 2024 | dma_params.desc_mem_phys = |
2059 | (u32 __force) priv->cpsw_res->start + CPSW2_BD_OFFSET; | 2025 | (u32 __force) ss_res->start + CPSW2_BD_OFFSET; |
2060 | break; | 2026 | break; |
2061 | default: | 2027 | default: |
2062 | dev_err(priv->dev, "unknown version 0x%08x\n", priv->version); | 2028 | dev_err(priv->dev, "unknown version 0x%08x\n", priv->version); |
2063 | ret = -ENODEV; | 2029 | ret = -ENODEV; |
2064 | goto clean_cpsw_wr_iores_ret; | 2030 | goto clean_runtime_disable_ret; |
2065 | } | 2031 | } |
2066 | for (i = 0; i < priv->data.slaves; i++) { | 2032 | for (i = 0; i < priv->data.slaves; i++) { |
2067 | struct cpsw_slave *slave = &priv->slaves[i]; | 2033 | struct cpsw_slave *slave = &priv->slaves[i]; |
@@ -2089,7 +2055,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2089 | if (!priv->dma) { | 2055 | if (!priv->dma) { |
2090 | dev_err(priv->dev, "error initializing dma\n"); | 2056 | dev_err(priv->dev, "error initializing dma\n"); |
2091 | ret = -ENOMEM; | 2057 | ret = -ENOMEM; |
2092 | goto clean_wr_iomap_ret; | 2058 | goto clean_runtime_disable_ret; |
2093 | } | 2059 | } |
2094 | 2060 | ||
2095 | priv->txch = cpdma_chan_create(priv->dma, tx_chan_num(0), | 2061 | priv->txch = cpdma_chan_create(priv->dma, tx_chan_num(0), |
@@ -2124,8 +2090,8 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2124 | 2090 | ||
2125 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | 2091 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { |
2126 | for (i = res->start; i <= res->end; i++) { | 2092 | for (i = res->start; i <= res->end; i++) { |
2127 | if (request_irq(i, cpsw_interrupt, 0, | 2093 | if (devm_request_irq(&pdev->dev, i, cpsw_interrupt, 0, |
2128 | dev_name(&pdev->dev), priv)) { | 2094 | dev_name(priv->dev), priv)) { |
2129 | dev_err(priv->dev, "error attaching irq\n"); | 2095 | dev_err(priv->dev, "error attaching irq\n"); |
2130 | goto clean_ale_ret; | 2096 | goto clean_ale_ret; |
2131 | } | 2097 | } |
@@ -2147,7 +2113,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2147 | if (ret) { | 2113 | if (ret) { |
2148 | dev_err(priv->dev, "error registering net device\n"); | 2114 | dev_err(priv->dev, "error registering net device\n"); |
2149 | ret = -ENODEV; | 2115 | ret = -ENODEV; |
2150 | goto clean_irq_ret; | 2116 | goto clean_ale_ret; |
2151 | } | 2117 | } |
2152 | 2118 | ||
2153 | if (cpts_register(&pdev->dev, priv->cpts, | 2119 | if (cpts_register(&pdev->dev, priv->cpts, |
@@ -2155,44 +2121,27 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2155 | dev_err(priv->dev, "error registering cpts device\n"); | 2121 | dev_err(priv->dev, "error registering cpts device\n"); |
2156 | 2122 | ||
2157 | cpsw_notice(priv, probe, "initialized device (regs %x, irq %d)\n", | 2123 | cpsw_notice(priv, probe, "initialized device (regs %x, irq %d)\n", |
2158 | priv->cpsw_res->start, ndev->irq); | 2124 | ss_res->start, ndev->irq); |
2159 | 2125 | ||
2160 | if (priv->data.dual_emac) { | 2126 | if (priv->data.dual_emac) { |
2161 | ret = cpsw_probe_dual_emac(pdev, priv); | 2127 | ret = cpsw_probe_dual_emac(pdev, priv); |
2162 | if (ret) { | 2128 | if (ret) { |
2163 | cpsw_err(priv, probe, "error probe slave 2 emac interface\n"); | 2129 | cpsw_err(priv, probe, "error probe slave 2 emac interface\n"); |
2164 | goto clean_irq_ret; | 2130 | goto clean_ale_ret; |
2165 | } | 2131 | } |
2166 | } | 2132 | } |
2167 | 2133 | ||
2168 | return 0; | 2134 | return 0; |
2169 | 2135 | ||
2170 | clean_irq_ret: | ||
2171 | for (i = 0; i < priv->num_irqs; i++) | ||
2172 | free_irq(priv->irqs_table[i], priv); | ||
2173 | clean_ale_ret: | 2136 | clean_ale_ret: |
2174 | cpsw_ale_destroy(priv->ale); | 2137 | cpsw_ale_destroy(priv->ale); |
2175 | clean_dma_ret: | 2138 | clean_dma_ret: |
2176 | cpdma_chan_destroy(priv->txch); | 2139 | cpdma_chan_destroy(priv->txch); |
2177 | cpdma_chan_destroy(priv->rxch); | 2140 | cpdma_chan_destroy(priv->rxch); |
2178 | cpdma_ctlr_destroy(priv->dma); | 2141 | cpdma_ctlr_destroy(priv->dma); |
2179 | clean_wr_iomap_ret: | 2142 | clean_runtime_disable_ret: |
2180 | iounmap(priv->wr_regs); | ||
2181 | clean_cpsw_wr_iores_ret: | ||
2182 | release_mem_region(priv->cpsw_wr_res->start, | ||
2183 | resource_size(priv->cpsw_wr_res)); | ||
2184 | clean_iomap_ret: | ||
2185 | iounmap(priv->regs); | ||
2186 | clean_cpsw_iores_ret: | ||
2187 | release_mem_region(priv->cpsw_res->start, | ||
2188 | resource_size(priv->cpsw_res)); | ||
2189 | clean_clk_ret: | ||
2190 | clk_put(priv->clk); | ||
2191 | clean_slave_ret: | ||
2192 | pm_runtime_disable(&pdev->dev); | 2143 | pm_runtime_disable(&pdev->dev); |
2193 | kfree(priv->slaves); | ||
2194 | clean_ndev_ret: | 2144 | clean_ndev_ret: |
2195 | kfree(priv->data.slave_data); | ||
2196 | free_netdev(priv->ndev); | 2145 | free_netdev(priv->ndev); |
2197 | return ret; | 2146 | return ret; |
2198 | } | 2147 | } |
@@ -2201,30 +2150,18 @@ static int cpsw_remove(struct platform_device *pdev) | |||
2201 | { | 2150 | { |
2202 | struct net_device *ndev = platform_get_drvdata(pdev); | 2151 | struct net_device *ndev = platform_get_drvdata(pdev); |
2203 | struct cpsw_priv *priv = netdev_priv(ndev); | 2152 | struct cpsw_priv *priv = netdev_priv(ndev); |
2204 | int i; | ||
2205 | 2153 | ||
2206 | if (priv->data.dual_emac) | 2154 | if (priv->data.dual_emac) |
2207 | unregister_netdev(cpsw_get_slave_ndev(priv, 1)); | 2155 | unregister_netdev(cpsw_get_slave_ndev(priv, 1)); |
2208 | unregister_netdev(ndev); | 2156 | unregister_netdev(ndev); |
2209 | 2157 | ||
2210 | cpts_unregister(priv->cpts); | 2158 | cpts_unregister(priv->cpts); |
2211 | for (i = 0; i < priv->num_irqs; i++) | ||
2212 | free_irq(priv->irqs_table[i], priv); | ||
2213 | 2159 | ||
2214 | cpsw_ale_destroy(priv->ale); | 2160 | cpsw_ale_destroy(priv->ale); |
2215 | cpdma_chan_destroy(priv->txch); | 2161 | cpdma_chan_destroy(priv->txch); |
2216 | cpdma_chan_destroy(priv->rxch); | 2162 | cpdma_chan_destroy(priv->rxch); |
2217 | cpdma_ctlr_destroy(priv->dma); | 2163 | cpdma_ctlr_destroy(priv->dma); |
2218 | iounmap(priv->regs); | ||
2219 | release_mem_region(priv->cpsw_res->start, | ||
2220 | resource_size(priv->cpsw_res)); | ||
2221 | iounmap(priv->wr_regs); | ||
2222 | release_mem_region(priv->cpsw_wr_res->start, | ||
2223 | resource_size(priv->cpsw_wr_res)); | ||
2224 | pm_runtime_disable(&pdev->dev); | 2164 | pm_runtime_disable(&pdev->dev); |
2225 | clk_put(priv->clk); | ||
2226 | kfree(priv->slaves); | ||
2227 | kfree(priv->data.slave_data); | ||
2228 | if (priv->data.dual_emac) | 2165 | if (priv->data.dual_emac) |
2229 | free_netdev(cpsw_get_slave_ndev(priv, 1)); | 2166 | free_netdev(cpsw_get_slave_ndev(priv, 1)); |
2230 | free_netdev(ndev); | 2167 | free_netdev(ndev); |
@@ -2280,7 +2217,7 @@ static struct platform_driver cpsw_driver = { | |||
2280 | .name = "cpsw", | 2217 | .name = "cpsw", |
2281 | .owner = THIS_MODULE, | 2218 | .owner = THIS_MODULE, |
2282 | .pm = &cpsw_pm_ops, | 2219 | .pm = &cpsw_pm_ops, |
2283 | .of_match_table = of_match_ptr(cpsw_of_mtable), | 2220 | .of_match_table = cpsw_of_mtable, |
2284 | }, | 2221 | }, |
2285 | .probe = cpsw_probe, | 2222 | .probe = cpsw_probe, |
2286 | .remove = cpsw_remove, | 2223 | .remove = cpsw_remove, |
diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h index eb3e101ec048..574f49da693f 100644 --- a/drivers/net/ethernet/ti/cpsw.h +++ b/drivers/net/ethernet/ti/cpsw.h | |||
@@ -39,4 +39,6 @@ struct cpsw_platform_data { | |||
39 | bool dual_emac; /* Enable Dual EMAC mode */ | 39 | bool dual_emac; /* Enable Dual EMAC mode */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave); | ||
43 | |||
42 | #endif /* __CPSW_H__ */ | 44 | #endif /* __CPSW_H__ */ |
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h index fe993cdd7e23..1a581ef7eee8 100644 --- a/drivers/net/ethernet/ti/cpts.h +++ b/drivers/net/ethernet/ti/cpts.h | |||
@@ -127,8 +127,8 @@ struct cpts { | |||
127 | }; | 127 | }; |
128 | 128 | ||
129 | #ifdef CONFIG_TI_CPTS | 129 | #ifdef CONFIG_TI_CPTS |
130 | extern void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb); | 130 | void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb); |
131 | extern void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb); | 131 | void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb); |
132 | #else | 132 | #else |
133 | static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) | 133 | static inline void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb) |
134 | { | 134 | { |
@@ -138,8 +138,7 @@ static inline void cpts_tx_timestamp(struct cpts *cpts, struct sk_buff *skb) | |||
138 | } | 138 | } |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | extern int cpts_register(struct device *dev, struct cpts *cpts, | 141 | int cpts_register(struct device *dev, struct cpts *cpts, u32 mult, u32 shift); |
142 | u32 mult, u32 shift); | 142 | void cpts_unregister(struct cpts *cpts); |
143 | extern void cpts_unregister(struct cpts *cpts); | ||
144 | 143 | ||
145 | #endif | 144 | #endif |
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.h b/drivers/net/ethernet/toshiba/ps3_gelic_net.h index 309abb472aa2..8505196be9f5 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.h +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.h | |||
@@ -359,27 +359,26 @@ static inline void *port_priv(struct gelic_port *port) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | #ifdef CONFIG_PPC_EARLY_DEBUG_PS3GELIC | 361 | #ifdef CONFIG_PPC_EARLY_DEBUG_PS3GELIC |
362 | extern void udbg_shutdown_ps3gelic(void); | 362 | void udbg_shutdown_ps3gelic(void); |
363 | #else | 363 | #else |
364 | static inline void udbg_shutdown_ps3gelic(void) {} | 364 | static inline void udbg_shutdown_ps3gelic(void) {} |
365 | #endif | 365 | #endif |
366 | 366 | ||
367 | extern int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask); | 367 | int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask); |
368 | /* shared netdev ops */ | 368 | /* shared netdev ops */ |
369 | extern void gelic_card_up(struct gelic_card *card); | 369 | void gelic_card_up(struct gelic_card *card); |
370 | extern void gelic_card_down(struct gelic_card *card); | 370 | void gelic_card_down(struct gelic_card *card); |
371 | extern int gelic_net_open(struct net_device *netdev); | 371 | int gelic_net_open(struct net_device *netdev); |
372 | extern int gelic_net_stop(struct net_device *netdev); | 372 | int gelic_net_stop(struct net_device *netdev); |
373 | extern int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev); | 373 | int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev); |
374 | extern void gelic_net_set_multi(struct net_device *netdev); | 374 | void gelic_net_set_multi(struct net_device *netdev); |
375 | extern void gelic_net_tx_timeout(struct net_device *netdev); | 375 | void gelic_net_tx_timeout(struct net_device *netdev); |
376 | extern int gelic_net_change_mtu(struct net_device *netdev, int new_mtu); | 376 | int gelic_net_change_mtu(struct net_device *netdev, int new_mtu); |
377 | extern int gelic_net_setup_netdev(struct net_device *netdev, | 377 | int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card); |
378 | struct gelic_card *card); | ||
379 | 378 | ||
380 | /* shared ethtool ops */ | 379 | /* shared ethtool ops */ |
381 | extern void gelic_net_get_drvinfo(struct net_device *netdev, | 380 | void gelic_net_get_drvinfo(struct net_device *netdev, |
382 | struct ethtool_drvinfo *info); | 381 | struct ethtool_drvinfo *info); |
383 | extern void gelic_net_poll_controller(struct net_device *netdev); | 382 | void gelic_net_poll_controller(struct net_device *netdev); |
384 | 383 | ||
385 | #endif /* _GELIC_NET_H */ | 384 | #endif /* _GELIC_NET_H */ |
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.h b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.h index f7e51b7d7049..11f443d8e4ea 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.h +++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.h | |||
@@ -320,7 +320,7 @@ struct gelic_eurus_cmd { | |||
320 | #define GELIC_WL_PRIV_SET_PSK (SIOCIWFIRSTPRIV + 0) | 320 | #define GELIC_WL_PRIV_SET_PSK (SIOCIWFIRSTPRIV + 0) |
321 | #define GELIC_WL_PRIV_GET_PSK (SIOCIWFIRSTPRIV + 1) | 321 | #define GELIC_WL_PRIV_GET_PSK (SIOCIWFIRSTPRIV + 1) |
322 | 322 | ||
323 | extern int gelic_wl_driver_probe(struct gelic_card *card); | 323 | int gelic_wl_driver_probe(struct gelic_card *card); |
324 | extern int gelic_wl_driver_remove(struct gelic_card *card); | 324 | int gelic_wl_driver_remove(struct gelic_card *card); |
325 | extern void gelic_wl_interrupt(struct net_device *netdev, u64 status); | 325 | void gelic_wl_interrupt(struct net_device *netdev, u64 status); |
326 | #endif /* _GELIC_WIRELESS_H */ | 326 | #endif /* _GELIC_WIRELESS_H */ |
diff --git a/drivers/net/ethernet/toshiba/spider_net.h b/drivers/net/ethernet/toshiba/spider_net.h index 4ba2135474d1..9b6af0845a11 100644 --- a/drivers/net/ethernet/toshiba/spider_net.h +++ b/drivers/net/ethernet/toshiba/spider_net.h | |||
@@ -29,8 +29,8 @@ | |||
29 | 29 | ||
30 | #include <linux/sungem_phy.h> | 30 | #include <linux/sungem_phy.h> |
31 | 31 | ||
32 | extern int spider_net_stop(struct net_device *netdev); | 32 | int spider_net_stop(struct net_device *netdev); |
33 | extern int spider_net_open(struct net_device *netdev); | 33 | int spider_net_open(struct net_device *netdev); |
34 | 34 | ||
35 | extern const struct ethtool_ops spider_net_ethtool_ops; | 35 | extern const struct ethtool_ops spider_net_ethtool_ops; |
36 | 36 | ||
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 4c619ea5189f..80dd40417850 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #define DRIVER_NAME "xilinx_emaclite" | 31 | #define DRIVER_NAME "xilinx_emaclite" |
32 | 32 | ||
33 | /* Register offsets for the EmacLite Core */ | 33 | /* Register offsets for the EmacLite Core */ |
34 | #define XEL_TXBUFF_OFFSET 0x0 /* Transmit Buffer */ | 34 | #define XEL_TXBUFF_OFFSET 0x0 /* Transmit Buffer */ |
35 | #define XEL_MDIOADDR_OFFSET 0x07E4 /* MDIO Address Register */ | 35 | #define XEL_MDIOADDR_OFFSET 0x07E4 /* MDIO Address Register */ |
36 | #define XEL_MDIOWR_OFFSET 0x07E8 /* MDIO Write Data Register */ | 36 | #define XEL_MDIOWR_OFFSET 0x07E8 /* MDIO Write Data Register */ |
37 | #define XEL_MDIORD_OFFSET 0x07EC /* MDIO Read Data Register */ | 37 | #define XEL_MDIORD_OFFSET 0x07EC /* MDIO Read Data Register */ |
@@ -63,13 +63,13 @@ | |||
63 | #define XEL_MDIOCTRL_MDIOEN_MASK 0x00000008 /* MDIO Enable */ | 63 | #define XEL_MDIOCTRL_MDIOEN_MASK 0x00000008 /* MDIO Enable */ |
64 | 64 | ||
65 | /* Global Interrupt Enable Register (GIER) Bit Masks */ | 65 | /* Global Interrupt Enable Register (GIER) Bit Masks */ |
66 | #define XEL_GIER_GIE_MASK 0x80000000 /* Global Enable */ | 66 | #define XEL_GIER_GIE_MASK 0x80000000 /* Global Enable */ |
67 | 67 | ||
68 | /* Transmit Status Register (TSR) Bit Masks */ | 68 | /* Transmit Status Register (TSR) Bit Masks */ |
69 | #define XEL_TSR_XMIT_BUSY_MASK 0x00000001 /* Tx complete */ | 69 | #define XEL_TSR_XMIT_BUSY_MASK 0x00000001 /* Tx complete */ |
70 | #define XEL_TSR_PROGRAM_MASK 0x00000002 /* Program the MAC address */ | 70 | #define XEL_TSR_PROGRAM_MASK 0x00000002 /* Program the MAC address */ |
71 | #define XEL_TSR_XMIT_IE_MASK 0x00000008 /* Tx interrupt enable bit */ | 71 | #define XEL_TSR_XMIT_IE_MASK 0x00000008 /* Tx interrupt enable bit */ |
72 | #define XEL_TSR_XMIT_ACTIVE_MASK 0x80000000 /* Buffer is active, SW bit | 72 | #define XEL_TSR_XMIT_ACTIVE_MASK 0x80000000 /* Buffer is active, SW bit |
73 | * only. This is not documented | 73 | * only. This is not documented |
74 | * in the HW spec */ | 74 | * in the HW spec */ |
75 | 75 | ||
@@ -77,21 +77,21 @@ | |||
77 | #define XEL_TSR_PROG_MAC_ADDR (XEL_TSR_XMIT_BUSY_MASK | XEL_TSR_PROGRAM_MASK) | 77 | #define XEL_TSR_PROG_MAC_ADDR (XEL_TSR_XMIT_BUSY_MASK | XEL_TSR_PROGRAM_MASK) |
78 | 78 | ||
79 | /* Receive Status Register (RSR) */ | 79 | /* Receive Status Register (RSR) */ |
80 | #define XEL_RSR_RECV_DONE_MASK 0x00000001 /* Rx complete */ | 80 | #define XEL_RSR_RECV_DONE_MASK 0x00000001 /* Rx complete */ |
81 | #define XEL_RSR_RECV_IE_MASK 0x00000008 /* Rx interrupt enable bit */ | 81 | #define XEL_RSR_RECV_IE_MASK 0x00000008 /* Rx interrupt enable bit */ |
82 | 82 | ||
83 | /* Transmit Packet Length Register (TPLR) */ | 83 | /* Transmit Packet Length Register (TPLR) */ |
84 | #define XEL_TPLR_LENGTH_MASK 0x0000FFFF /* Tx packet length */ | 84 | #define XEL_TPLR_LENGTH_MASK 0x0000FFFF /* Tx packet length */ |
85 | 85 | ||
86 | /* Receive Packet Length Register (RPLR) */ | 86 | /* Receive Packet Length Register (RPLR) */ |
87 | #define XEL_RPLR_LENGTH_MASK 0x0000FFFF /* Rx packet length */ | 87 | #define XEL_RPLR_LENGTH_MASK 0x0000FFFF /* Rx packet length */ |
88 | 88 | ||
89 | #define XEL_HEADER_OFFSET 12 /* Offset to length field */ | 89 | #define XEL_HEADER_OFFSET 12 /* Offset to length field */ |
90 | #define XEL_HEADER_SHIFT 16 /* Shift value for length */ | 90 | #define XEL_HEADER_SHIFT 16 /* Shift value for length */ |
91 | 91 | ||
92 | /* General Ethernet Definitions */ | 92 | /* General Ethernet Definitions */ |
93 | #define XEL_ARP_PACKET_SIZE 28 /* Max ARP packet size */ | 93 | #define XEL_ARP_PACKET_SIZE 28 /* Max ARP packet size */ |
94 | #define XEL_HEADER_IP_LENGTH_OFFSET 16 /* IP Length Offset */ | 94 | #define XEL_HEADER_IP_LENGTH_OFFSET 16 /* IP Length Offset */ |
95 | 95 | ||
96 | 96 | ||
97 | 97 | ||
@@ -1075,14 +1075,9 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) | |||
1075 | * This function un maps the IO region of the Emaclite device and frees the net | 1075 | * This function un maps the IO region of the Emaclite device and frees the net |
1076 | * device. | 1076 | * device. |
1077 | */ | 1077 | */ |
1078 | static void xemaclite_remove_ndev(struct net_device *ndev, | 1078 | static void xemaclite_remove_ndev(struct net_device *ndev) |
1079 | struct platform_device *pdev) | ||
1080 | { | 1079 | { |
1081 | if (ndev) { | 1080 | if (ndev) { |
1082 | struct net_local *lp = netdev_priv(ndev); | ||
1083 | |||
1084 | if (lp->base_addr) | ||
1085 | devm_iounmap(&pdev->dev, lp->base_addr); | ||
1086 | free_netdev(ndev); | 1081 | free_netdev(ndev); |
1087 | } | 1082 | } |
1088 | } | 1083 | } |
@@ -1214,7 +1209,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) | |||
1214 | return 0; | 1209 | return 0; |
1215 | 1210 | ||
1216 | error: | 1211 | error: |
1217 | xemaclite_remove_ndev(ndev, ofdev); | 1212 | xemaclite_remove_ndev(ndev); |
1218 | return rc; | 1213 | return rc; |
1219 | } | 1214 | } |
1220 | 1215 | ||
@@ -1248,7 +1243,7 @@ static int xemaclite_of_remove(struct platform_device *of_dev) | |||
1248 | of_node_put(lp->phy_node); | 1243 | of_node_put(lp->phy_node); |
1249 | lp->phy_node = NULL; | 1244 | lp->phy_node = NULL; |
1250 | 1245 | ||
1251 | xemaclite_remove_ndev(ndev, of_dev); | 1246 | xemaclite_remove_ndev(ndev); |
1252 | 1247 | ||
1253 | return 0; | 1248 | return 0; |
1254 | } | 1249 | } |
diff --git a/drivers/net/fddi/skfp/h/smc.h b/drivers/net/fddi/skfp/h/smc.h index 3ca308b28214..bd1166bf8f61 100644 --- a/drivers/net/fddi/skfp/h/smc.h +++ b/drivers/net/fddi/skfp/h/smc.h | |||
@@ -469,20 +469,20 @@ struct s_smc { | |||
469 | 469 | ||
470 | extern const struct fddi_addr fddi_broadcast; | 470 | extern const struct fddi_addr fddi_broadcast; |
471 | 471 | ||
472 | extern void all_selection_criteria(struct s_smc *smc); | 472 | void all_selection_criteria(struct s_smc *smc); |
473 | extern void card_stop(struct s_smc *smc); | 473 | void card_stop(struct s_smc *smc); |
474 | extern void init_board(struct s_smc *smc, u_char *mac_addr); | 474 | void init_board(struct s_smc *smc, u_char *mac_addr); |
475 | extern int init_fplus(struct s_smc *smc); | 475 | int init_fplus(struct s_smc *smc); |
476 | extern void init_plc(struct s_smc *smc); | 476 | void init_plc(struct s_smc *smc); |
477 | extern int init_smt(struct s_smc *smc, u_char * mac_addr); | 477 | int init_smt(struct s_smc *smc, u_char *mac_addr); |
478 | extern void mac1_irq(struct s_smc *smc, u_short stu, u_short stl); | 478 | void mac1_irq(struct s_smc *smc, u_short stu, u_short stl); |
479 | extern void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l); | 479 | void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l); |
480 | extern void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l); | 480 | void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l); |
481 | extern int pcm_status_twisted(struct s_smc *smc); | 481 | int pcm_status_twisted(struct s_smc *smc); |
482 | extern void plc1_irq(struct s_smc *smc); | 482 | void plc1_irq(struct s_smc *smc); |
483 | extern void plc2_irq(struct s_smc *smc); | 483 | void plc2_irq(struct s_smc *smc); |
484 | extern void read_address(struct s_smc *smc, u_char * mac_addr); | 484 | void read_address(struct s_smc *smc, u_char *mac_addr); |
485 | extern void timer_irq(struct s_smc *smc); | 485 | void timer_irq(struct s_smc *smc); |
486 | 486 | ||
487 | #endif /* _SCMECM_ */ | 487 | #endif /* _SCMECM_ */ |
488 | 488 | ||
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index a974727dd9a2..636b65c66d49 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
@@ -445,7 +445,7 @@ static int ser12_open(struct net_device *dev) | |||
445 | outb(0, FCR(dev->base_addr)); /* disable FIFOs */ | 445 | outb(0, FCR(dev->base_addr)); /* disable FIFOs */ |
446 | outb(0x0d, MCR(dev->base_addr)); | 446 | outb(0x0d, MCR(dev->base_addr)); |
447 | outb(0, IER(dev->base_addr)); | 447 | outb(0, IER(dev->base_addr)); |
448 | if (request_irq(dev->irq, ser12_interrupt, IRQF_DISABLED | IRQF_SHARED, | 448 | if (request_irq(dev->irq, ser12_interrupt, IRQF_SHARED, |
449 | "baycom_ser_fdx", dev)) { | 449 | "baycom_ser_fdx", dev)) { |
450 | release_region(dev->base_addr, SER12_EXTENT); | 450 | release_region(dev->base_addr, SER12_EXTENT); |
451 | return -EBUSY; | 451 | return -EBUSY; |
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index e349d867449b..f9a8976195ba 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c | |||
@@ -490,7 +490,7 @@ static int ser12_open(struct net_device *dev) | |||
490 | outb(0, FCR(dev->base_addr)); /* disable FIFOs */ | 490 | outb(0, FCR(dev->base_addr)); /* disable FIFOs */ |
491 | outb(0x0d, MCR(dev->base_addr)); | 491 | outb(0x0d, MCR(dev->base_addr)); |
492 | outb(0, IER(dev->base_addr)); | 492 | outb(0, IER(dev->base_addr)); |
493 | if (request_irq(dev->irq, ser12_interrupt, IRQF_DISABLED | IRQF_SHARED, | 493 | if (request_irq(dev->irq, ser12_interrupt, IRQF_SHARED, |
494 | "baycom_ser12", dev)) { | 494 | "baycom_ser12", dev)) { |
495 | release_region(dev->base_addr, SER12_EXTENT); | 495 | release_region(dev->base_addr, SER12_EXTENT); |
496 | return -EBUSY; | 496 | return -EBUSY; |
diff --git a/drivers/net/irda/sir-dev.h b/drivers/net/irda/sir-dev.h index 6d5b1e2b1289..f50b9c1c0639 100644 --- a/drivers/net/irda/sir-dev.h +++ b/drivers/net/irda/sir-dev.h | |||
@@ -102,28 +102,29 @@ struct sir_driver { | |||
102 | 102 | ||
103 | /* exported */ | 103 | /* exported */ |
104 | 104 | ||
105 | extern int irda_register_dongle(struct dongle_driver *new); | 105 | int irda_register_dongle(struct dongle_driver *new); |
106 | extern int irda_unregister_dongle(struct dongle_driver *drv); | 106 | int irda_unregister_dongle(struct dongle_driver *drv); |
107 | 107 | ||
108 | extern struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *name); | 108 | struct sir_dev *sirdev_get_instance(const struct sir_driver *drv, |
109 | extern int sirdev_put_instance(struct sir_dev *self); | 109 | const char *name); |
110 | int sirdev_put_instance(struct sir_dev *self); | ||
110 | 111 | ||
111 | extern int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type); | 112 | int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type); |
112 | extern void sirdev_write_complete(struct sir_dev *dev); | 113 | void sirdev_write_complete(struct sir_dev *dev); |
113 | extern int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count); | 114 | int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count); |
114 | 115 | ||
115 | /* low level helpers for SIR device/dongle setup */ | 116 | /* low level helpers for SIR device/dongle setup */ |
116 | extern int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len); | 117 | int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len); |
117 | extern int sirdev_raw_read(struct sir_dev *dev, char *buf, int len); | 118 | int sirdev_raw_read(struct sir_dev *dev, char *buf, int len); |
118 | extern int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts); | 119 | int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts); |
119 | 120 | ||
120 | /* not exported */ | 121 | /* not exported */ |
121 | 122 | ||
122 | extern int sirdev_get_dongle(struct sir_dev *self, IRDA_DONGLE type); | 123 | int sirdev_get_dongle(struct sir_dev *self, IRDA_DONGLE type); |
123 | extern int sirdev_put_dongle(struct sir_dev *self); | 124 | int sirdev_put_dongle(struct sir_dev *self); |
124 | 125 | ||
125 | extern void sirdev_enable_rx(struct sir_dev *dev); | 126 | void sirdev_enable_rx(struct sir_dev *dev); |
126 | extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param); | 127 | int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param); |
127 | 128 | ||
128 | /* inline helpers */ | 129 | /* inline helpers */ |
129 | 130 | ||
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index ac22283aaf23..bc71947b1ec3 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c | |||
@@ -100,6 +100,45 @@ static void at803x_get_wol(struct phy_device *phydev, | |||
100 | wol->wolopts |= WAKE_MAGIC; | 100 | wol->wolopts |= WAKE_MAGIC; |
101 | } | 101 | } |
102 | 102 | ||
103 | static int at803x_suspend(struct phy_device *phydev) | ||
104 | { | ||
105 | int value; | ||
106 | int wol_enabled; | ||
107 | |||
108 | mutex_lock(&phydev->lock); | ||
109 | |||
110 | value = phy_read(phydev, AT803X_INTR_ENABLE); | ||
111 | wol_enabled = value & AT803X_WOL_ENABLE; | ||
112 | |||
113 | value = phy_read(phydev, MII_BMCR); | ||
114 | |||
115 | if (wol_enabled) | ||
116 | value |= BMCR_ISOLATE; | ||
117 | else | ||
118 | value |= BMCR_PDOWN; | ||
119 | |||
120 | phy_write(phydev, MII_BMCR, value); | ||
121 | |||
122 | mutex_unlock(&phydev->lock); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static int at803x_resume(struct phy_device *phydev) | ||
128 | { | ||
129 | int value; | ||
130 | |||
131 | mutex_lock(&phydev->lock); | ||
132 | |||
133 | value = phy_read(phydev, MII_BMCR); | ||
134 | value &= ~(BMCR_PDOWN | BMCR_ISOLATE); | ||
135 | phy_write(phydev, MII_BMCR, value); | ||
136 | |||
137 | mutex_unlock(&phydev->lock); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
103 | static int at803x_config_init(struct phy_device *phydev) | 142 | static int at803x_config_init(struct phy_device *phydev) |
104 | { | 143 | { |
105 | int val; | 144 | int val; |
@@ -161,10 +200,12 @@ static struct phy_driver at803x_driver[] = { | |||
161 | .config_init = at803x_config_init, | 200 | .config_init = at803x_config_init, |
162 | .set_wol = at803x_set_wol, | 201 | .set_wol = at803x_set_wol, |
163 | .get_wol = at803x_get_wol, | 202 | .get_wol = at803x_get_wol, |
203 | .suspend = at803x_suspend, | ||
204 | .resume = at803x_resume, | ||
164 | .features = PHY_GBIT_FEATURES, | 205 | .features = PHY_GBIT_FEATURES, |
165 | .flags = PHY_HAS_INTERRUPT, | 206 | .flags = PHY_HAS_INTERRUPT, |
166 | .config_aneg = &genphy_config_aneg, | 207 | .config_aneg = genphy_config_aneg, |
167 | .read_status = &genphy_read_status, | 208 | .read_status = genphy_read_status, |
168 | .driver = { | 209 | .driver = { |
169 | .owner = THIS_MODULE, | 210 | .owner = THIS_MODULE, |
170 | }, | 211 | }, |
@@ -176,10 +217,12 @@ static struct phy_driver at803x_driver[] = { | |||
176 | .config_init = at803x_config_init, | 217 | .config_init = at803x_config_init, |
177 | .set_wol = at803x_set_wol, | 218 | .set_wol = at803x_set_wol, |
178 | .get_wol = at803x_get_wol, | 219 | .get_wol = at803x_get_wol, |
220 | .suspend = at803x_suspend, | ||
221 | .resume = at803x_resume, | ||
179 | .features = PHY_GBIT_FEATURES, | 222 | .features = PHY_GBIT_FEATURES, |
180 | .flags = PHY_HAS_INTERRUPT, | 223 | .flags = PHY_HAS_INTERRUPT, |
181 | .config_aneg = &genphy_config_aneg, | 224 | .config_aneg = genphy_config_aneg, |
182 | .read_status = &genphy_read_status, | 225 | .read_status = genphy_read_status, |
183 | .driver = { | 226 | .driver = { |
184 | .owner = THIS_MODULE, | 227 | .owner = THIS_MODULE, |
185 | }, | 228 | }, |
@@ -191,10 +234,12 @@ static struct phy_driver at803x_driver[] = { | |||
191 | .config_init = at803x_config_init, | 234 | .config_init = at803x_config_init, |
192 | .set_wol = at803x_set_wol, | 235 | .set_wol = at803x_set_wol, |
193 | .get_wol = at803x_get_wol, | 236 | .get_wol = at803x_get_wol, |
237 | .suspend = at803x_suspend, | ||
238 | .resume = at803x_resume, | ||
194 | .features = PHY_GBIT_FEATURES, | 239 | .features = PHY_GBIT_FEATURES, |
195 | .flags = PHY_HAS_INTERRUPT, | 240 | .flags = PHY_HAS_INTERRUPT, |
196 | .config_aneg = &genphy_config_aneg, | 241 | .config_aneg = genphy_config_aneg, |
197 | .read_status = &genphy_read_status, | 242 | .read_status = genphy_read_status, |
198 | .driver = { | 243 | .driver = { |
199 | .owner = THIS_MODULE, | 244 | .owner = THIS_MODULE, |
200 | }, | 245 | }, |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 2e91477362d4..2e3c778ea9bf 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -34,9 +34,9 @@ | |||
34 | #include <linux/marvell_phy.h> | 34 | #include <linux/marvell_phy.h> |
35 | #include <linux/of.h> | 35 | #include <linux/of.h> |
36 | 36 | ||
37 | #include <asm/io.h> | 37 | #include <linux/io.h> |
38 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
39 | #include <asm/uaccess.h> | 39 | #include <linux/uaccess.h> |
40 | 40 | ||
41 | #define MII_MARVELL_PHY_PAGE 22 | 41 | #define MII_MARVELL_PHY_PAGE 22 |
42 | 42 | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index c31aad0004cb..3ae28f420868 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -287,6 +287,8 @@ static struct phy_driver ksphy_driver[] = { | |||
287 | .read_status = genphy_read_status, | 287 | .read_status = genphy_read_status, |
288 | .ack_interrupt = kszphy_ack_interrupt, | 288 | .ack_interrupt = kszphy_ack_interrupt, |
289 | .config_intr = ks8737_config_intr, | 289 | .config_intr = ks8737_config_intr, |
290 | .suspend = genphy_suspend, | ||
291 | .resume = genphy_resume, | ||
290 | .driver = { .owner = THIS_MODULE,}, | 292 | .driver = { .owner = THIS_MODULE,}, |
291 | }, { | 293 | }, { |
292 | .phy_id = PHY_ID_KSZ8021, | 294 | .phy_id = PHY_ID_KSZ8021, |
@@ -300,6 +302,8 @@ static struct phy_driver ksphy_driver[] = { | |||
300 | .read_status = genphy_read_status, | 302 | .read_status = genphy_read_status, |
301 | .ack_interrupt = kszphy_ack_interrupt, | 303 | .ack_interrupt = kszphy_ack_interrupt, |
302 | .config_intr = kszphy_config_intr, | 304 | .config_intr = kszphy_config_intr, |
305 | .suspend = genphy_suspend, | ||
306 | .resume = genphy_resume, | ||
303 | .driver = { .owner = THIS_MODULE,}, | 307 | .driver = { .owner = THIS_MODULE,}, |
304 | }, { | 308 | }, { |
305 | .phy_id = PHY_ID_KSZ8031, | 309 | .phy_id = PHY_ID_KSZ8031, |
@@ -313,6 +317,8 @@ static struct phy_driver ksphy_driver[] = { | |||
313 | .read_status = genphy_read_status, | 317 | .read_status = genphy_read_status, |
314 | .ack_interrupt = kszphy_ack_interrupt, | 318 | .ack_interrupt = kszphy_ack_interrupt, |
315 | .config_intr = kszphy_config_intr, | 319 | .config_intr = kszphy_config_intr, |
320 | .suspend = genphy_suspend, | ||
321 | .resume = genphy_resume, | ||
316 | .driver = { .owner = THIS_MODULE,}, | 322 | .driver = { .owner = THIS_MODULE,}, |
317 | }, { | 323 | }, { |
318 | .phy_id = PHY_ID_KSZ8041, | 324 | .phy_id = PHY_ID_KSZ8041, |
@@ -326,6 +332,8 @@ static struct phy_driver ksphy_driver[] = { | |||
326 | .read_status = genphy_read_status, | 332 | .read_status = genphy_read_status, |
327 | .ack_interrupt = kszphy_ack_interrupt, | 333 | .ack_interrupt = kszphy_ack_interrupt, |
328 | .config_intr = kszphy_config_intr, | 334 | .config_intr = kszphy_config_intr, |
335 | .suspend = genphy_suspend, | ||
336 | .resume = genphy_resume, | ||
329 | .driver = { .owner = THIS_MODULE,}, | 337 | .driver = { .owner = THIS_MODULE,}, |
330 | }, { | 338 | }, { |
331 | .phy_id = PHY_ID_KSZ8051, | 339 | .phy_id = PHY_ID_KSZ8051, |
@@ -339,6 +347,8 @@ static struct phy_driver ksphy_driver[] = { | |||
339 | .read_status = genphy_read_status, | 347 | .read_status = genphy_read_status, |
340 | .ack_interrupt = kszphy_ack_interrupt, | 348 | .ack_interrupt = kszphy_ack_interrupt, |
341 | .config_intr = kszphy_config_intr, | 349 | .config_intr = kszphy_config_intr, |
350 | .suspend = genphy_suspend, | ||
351 | .resume = genphy_resume, | ||
342 | .driver = { .owner = THIS_MODULE,}, | 352 | .driver = { .owner = THIS_MODULE,}, |
343 | }, { | 353 | }, { |
344 | .phy_id = PHY_ID_KSZ8001, | 354 | .phy_id = PHY_ID_KSZ8001, |
@@ -351,6 +361,8 @@ static struct phy_driver ksphy_driver[] = { | |||
351 | .read_status = genphy_read_status, | 361 | .read_status = genphy_read_status, |
352 | .ack_interrupt = kszphy_ack_interrupt, | 362 | .ack_interrupt = kszphy_ack_interrupt, |
353 | .config_intr = kszphy_config_intr, | 363 | .config_intr = kszphy_config_intr, |
364 | .suspend = genphy_suspend, | ||
365 | .resume = genphy_resume, | ||
354 | .driver = { .owner = THIS_MODULE,}, | 366 | .driver = { .owner = THIS_MODULE,}, |
355 | }, { | 367 | }, { |
356 | .phy_id = PHY_ID_KSZ8081, | 368 | .phy_id = PHY_ID_KSZ8081, |
@@ -363,6 +375,8 @@ static struct phy_driver ksphy_driver[] = { | |||
363 | .read_status = genphy_read_status, | 375 | .read_status = genphy_read_status, |
364 | .ack_interrupt = kszphy_ack_interrupt, | 376 | .ack_interrupt = kszphy_ack_interrupt, |
365 | .config_intr = kszphy_config_intr, | 377 | .config_intr = kszphy_config_intr, |
378 | .suspend = genphy_suspend, | ||
379 | .resume = genphy_resume, | ||
366 | .driver = { .owner = THIS_MODULE,}, | 380 | .driver = { .owner = THIS_MODULE,}, |
367 | }, { | 381 | }, { |
368 | .phy_id = PHY_ID_KSZ8061, | 382 | .phy_id = PHY_ID_KSZ8061, |
@@ -375,6 +389,8 @@ static struct phy_driver ksphy_driver[] = { | |||
375 | .read_status = genphy_read_status, | 389 | .read_status = genphy_read_status, |
376 | .ack_interrupt = kszphy_ack_interrupt, | 390 | .ack_interrupt = kszphy_ack_interrupt, |
377 | .config_intr = kszphy_config_intr, | 391 | .config_intr = kszphy_config_intr, |
392 | .suspend = genphy_suspend, | ||
393 | .resume = genphy_resume, | ||
378 | .driver = { .owner = THIS_MODULE,}, | 394 | .driver = { .owner = THIS_MODULE,}, |
379 | }, { | 395 | }, { |
380 | .phy_id = PHY_ID_KSZ9021, | 396 | .phy_id = PHY_ID_KSZ9021, |
@@ -387,6 +403,8 @@ static struct phy_driver ksphy_driver[] = { | |||
387 | .read_status = genphy_read_status, | 403 | .read_status = genphy_read_status, |
388 | .ack_interrupt = kszphy_ack_interrupt, | 404 | .ack_interrupt = kszphy_ack_interrupt, |
389 | .config_intr = ksz9021_config_intr, | 405 | .config_intr = ksz9021_config_intr, |
406 | .suspend = genphy_suspend, | ||
407 | .resume = genphy_resume, | ||
390 | .driver = { .owner = THIS_MODULE, }, | 408 | .driver = { .owner = THIS_MODULE, }, |
391 | }, { | 409 | }, { |
392 | .phy_id = PHY_ID_KSZ9031, | 410 | .phy_id = PHY_ID_KSZ9031, |
@@ -400,6 +418,8 @@ static struct phy_driver ksphy_driver[] = { | |||
400 | .read_status = genphy_read_status, | 418 | .read_status = genphy_read_status, |
401 | .ack_interrupt = kszphy_ack_interrupt, | 419 | .ack_interrupt = kszphy_ack_interrupt, |
402 | .config_intr = ksz9021_config_intr, | 420 | .config_intr = ksz9021_config_intr, |
421 | .suspend = genphy_suspend, | ||
422 | .resume = genphy_resume, | ||
403 | .driver = { .owner = THIS_MODULE, }, | 423 | .driver = { .owner = THIS_MODULE, }, |
404 | }, { | 424 | }, { |
405 | .phy_id = PHY_ID_KSZ8873MLL, | 425 | .phy_id = PHY_ID_KSZ8873MLL, |
@@ -410,6 +430,8 @@ static struct phy_driver ksphy_driver[] = { | |||
410 | .config_init = kszphy_config_init, | 430 | .config_init = kszphy_config_init, |
411 | .config_aneg = ksz8873mll_config_aneg, | 431 | .config_aneg = ksz8873mll_config_aneg, |
412 | .read_status = ksz8873mll_read_status, | 432 | .read_status = ksz8873mll_read_status, |
433 | .suspend = genphy_suspend, | ||
434 | .resume = genphy_resume, | ||
413 | .driver = { .owner = THIS_MODULE, }, | 435 | .driver = { .owner = THIS_MODULE, }, |
414 | }, { | 436 | }, { |
415 | .phy_id = PHY_ID_KSZ886X, | 437 | .phy_id = PHY_ID_KSZ886X, |
@@ -420,6 +442,8 @@ static struct phy_driver ksphy_driver[] = { | |||
420 | .config_init = kszphy_config_init, | 442 | .config_init = kszphy_config_init, |
421 | .config_aneg = genphy_config_aneg, | 443 | .config_aneg = genphy_config_aneg, |
422 | .read_status = genphy_read_status, | 444 | .read_status = genphy_read_status, |
445 | .suspend = genphy_suspend, | ||
446 | .resume = genphy_resume, | ||
423 | .driver = { .owner = THIS_MODULE, }, | 447 | .driver = { .owner = THIS_MODULE, }, |
424 | } }; | 448 | } }; |
425 | 449 | ||
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 7d78669000d7..6358d420e185 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c | |||
@@ -328,7 +328,7 @@ MODULE_DEVICE_TABLE(usb, usbpn_ids); | |||
328 | 328 | ||
329 | static struct usb_driver usbpn_driver; | 329 | static struct usb_driver usbpn_driver; |
330 | 330 | ||
331 | int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id) | 331 | static int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id) |
332 | { | 332 | { |
333 | static const char ifname[] = "usbpn%d"; | 333 | static const char ifname[] = "usbpn%d"; |
334 | const struct usb_cdc_union_desc *union_header = NULL; | 334 | const struct usb_cdc_union_desc *union_header = NULL; |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 3d6aaf79d8b2..d03b6b6c64c0 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -143,16 +143,22 @@ static const struct net_device_ops qmi_wwan_netdev_ops = { | |||
143 | .ndo_validate_addr = eth_validate_addr, | 143 | .ndo_validate_addr = eth_validate_addr, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | /* using a counter to merge subdriver requests with our own into a combined state */ | 146 | /* using a counter to merge subdriver requests with our own into a |
147 | * combined state | ||
148 | */ | ||
147 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) | 149 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
148 | { | 150 | { |
149 | struct qmi_wwan_state *info = (void *)&dev->data; | 151 | struct qmi_wwan_state *info = (void *)&dev->data; |
150 | int rv = 0; | 152 | int rv = 0; |
151 | 153 | ||
152 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on); | 154 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, |
155 | atomic_read(&info->pmcount), on); | ||
153 | 156 | ||
154 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) { | 157 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || |
155 | /* need autopm_get/put here to ensure the usbcore sees the new value */ | 158 | (!on && atomic_dec_and_test(&info->pmcount))) { |
159 | /* need autopm_get/put here to ensure the usbcore sees | ||
160 | * the new value | ||
161 | */ | ||
156 | rv = usb_autopm_get_interface(dev->intf); | 162 | rv = usb_autopm_get_interface(dev->intf); |
157 | if (rv < 0) | 163 | if (rv < 0) |
158 | goto err; | 164 | goto err; |
@@ -199,7 +205,8 @@ static int qmi_wwan_register_subdriver(struct usbnet *dev) | |||
199 | atomic_set(&info->pmcount, 0); | 205 | atomic_set(&info->pmcount, 0); |
200 | 206 | ||
201 | /* register subdriver */ | 207 | /* register subdriver */ |
202 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 4096, &qmi_wwan_cdc_wdm_manage_power); | 208 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, |
209 | 4096, &qmi_wwan_cdc_wdm_manage_power); | ||
203 | if (IS_ERR(subdriver)) { | 210 | if (IS_ERR(subdriver)) { |
204 | dev_err(&info->control->dev, "subdriver registration failed\n"); | 211 | dev_err(&info->control->dev, "subdriver registration failed\n"); |
205 | rv = PTR_ERR(subdriver); | 212 | rv = PTR_ERR(subdriver); |
@@ -228,7 +235,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
228 | struct usb_driver *driver = driver_of(intf); | 235 | struct usb_driver *driver = driver_of(intf); |
229 | struct qmi_wwan_state *info = (void *)&dev->data; | 236 | struct qmi_wwan_state *info = (void *)&dev->data; |
230 | 237 | ||
231 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | 238 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < |
239 | sizeof(struct qmi_wwan_state))); | ||
232 | 240 | ||
233 | /* set up initial state */ | 241 | /* set up initial state */ |
234 | info->control = intf; | 242 | info->control = intf; |
@@ -250,7 +258,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
250 | goto err; | 258 | goto err; |
251 | } | 259 | } |
252 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { | 260 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { |
253 | dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength); | 261 | dev_dbg(&intf->dev, "CDC header len %u\n", |
262 | h->bLength); | ||
254 | goto err; | 263 | goto err; |
255 | } | 264 | } |
256 | break; | 265 | break; |
@@ -260,7 +269,8 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
260 | goto err; | 269 | goto err; |
261 | } | 270 | } |
262 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { | 271 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { |
263 | dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength); | 272 | dev_dbg(&intf->dev, "CDC union len %u\n", |
273 | h->bLength); | ||
264 | goto err; | 274 | goto err; |
265 | } | 275 | } |
266 | cdc_union = (struct usb_cdc_union_desc *)buf; | 276 | cdc_union = (struct usb_cdc_union_desc *)buf; |
@@ -271,15 +281,15 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
271 | goto err; | 281 | goto err; |
272 | } | 282 | } |
273 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { | 283 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { |
274 | dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength); | 284 | dev_dbg(&intf->dev, "CDC ether len %u\n", |
285 | h->bLength); | ||
275 | goto err; | 286 | goto err; |
276 | } | 287 | } |
277 | cdc_ether = (struct usb_cdc_ether_desc *)buf; | 288 | cdc_ether = (struct usb_cdc_ether_desc *)buf; |
278 | break; | 289 | break; |
279 | } | 290 | } |
280 | 291 | ||
281 | /* | 292 | /* Remember which CDC functional descriptors we've seen. Works |
282 | * Remember which CDC functional descriptors we've seen. Works | ||
283 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE | 293 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE |
284 | * (0x0f) is the highest numbered | 294 | * (0x0f) is the highest numbered |
285 | */ | 295 | */ |
@@ -293,10 +303,14 @@ next_desc: | |||
293 | 303 | ||
294 | /* Use separate control and data interfaces if we found a CDC Union */ | 304 | /* Use separate control and data interfaces if we found a CDC Union */ |
295 | if (cdc_union) { | 305 | if (cdc_union) { |
296 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); | 306 | info->data = usb_ifnum_to_if(dev->udev, |
297 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) { | 307 | cdc_union->bSlaveInterface0); |
298 | dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n", | 308 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || |
299 | cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0); | 309 | !info->data) { |
310 | dev_err(&intf->dev, | ||
311 | "bogus CDC Union: master=%u, slave=%u\n", | ||
312 | cdc_union->bMasterInterface0, | ||
313 | cdc_union->bSlaveInterface0); | ||
300 | goto err; | 314 | goto err; |
301 | } | 315 | } |
302 | } | 316 | } |
@@ -374,8 +388,7 @@ static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) | |||
374 | struct qmi_wwan_state *info = (void *)&dev->data; | 388 | struct qmi_wwan_state *info = (void *)&dev->data; |
375 | int ret; | 389 | int ret; |
376 | 390 | ||
377 | /* | 391 | /* Both usbnet_suspend() and subdriver->suspend() MUST return 0 |
378 | * Both usbnet_suspend() and subdriver->suspend() MUST return 0 | ||
379 | * in system sleep context, otherwise, the resume callback has | 392 | * in system sleep context, otherwise, the resume callback has |
380 | * to recover device from previous suspend failure. | 393 | * to recover device from previous suspend failure. |
381 | */ | 394 | */ |
@@ -383,7 +396,8 @@ static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) | |||
383 | if (ret < 0) | 396 | if (ret < 0) |
384 | goto err; | 397 | goto err; |
385 | 398 | ||
386 | if (intf == info->control && info->subdriver && info->subdriver->suspend) | 399 | if (intf == info->control && info->subdriver && |
400 | info->subdriver->suspend) | ||
387 | ret = info->subdriver->suspend(intf, message); | 401 | ret = info->subdriver->suspend(intf, message); |
388 | if (ret < 0) | 402 | if (ret < 0) |
389 | usbnet_resume(intf); | 403 | usbnet_resume(intf); |
@@ -396,7 +410,8 @@ static int qmi_wwan_resume(struct usb_interface *intf) | |||
396 | struct usbnet *dev = usb_get_intfdata(intf); | 410 | struct usbnet *dev = usb_get_intfdata(intf); |
397 | struct qmi_wwan_state *info = (void *)&dev->data; | 411 | struct qmi_wwan_state *info = (void *)&dev->data; |
398 | int ret = 0; | 412 | int ret = 0; |
399 | bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume); | 413 | bool callsub = (intf == info->control && info->subdriver && |
414 | info->subdriver->resume); | ||
400 | 415 | ||
401 | if (callsub) | 416 | if (callsub) |
402 | ret = info->subdriver->resume(intf); | 417 | ret = info->subdriver->resume(intf); |
@@ -714,6 +729,7 @@ static const struct usb_device_id products[] = { | |||
714 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 729 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
715 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ | 730 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ |
716 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 731 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
732 | {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ | ||
717 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ | 733 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ |
718 | 734 | ||
719 | /* 4. Gobi 1000 devices */ | 735 | /* 4. Gobi 1000 devices */ |
@@ -776,7 +792,8 @@ static const struct usb_device_id products[] = { | |||
776 | }; | 792 | }; |
777 | MODULE_DEVICE_TABLE(usb, products); | 793 | MODULE_DEVICE_TABLE(usb, products); |
778 | 794 | ||
779 | static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) | 795 | static int qmi_wwan_probe(struct usb_interface *intf, |
796 | const struct usb_device_id *prod) | ||
780 | { | 797 | { |
781 | struct usb_device_id *id = (struct usb_device_id *)prod; | 798 | struct usb_device_id *id = (struct usb_device_id *)prod; |
782 | 799 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index a03f358fd58b..12040a35d95d 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -410,9 +410,9 @@ int | |||
410 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, | 410 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, |
411 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); | 411 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); |
412 | 412 | ||
413 | extern void vmxnet3_set_ethtool_ops(struct net_device *netdev); | 413 | void vmxnet3_set_ethtool_ops(struct net_device *netdev); |
414 | 414 | ||
415 | extern struct rtnl_link_stats64 * | 415 | struct rtnl_link_stats64 * |
416 | vmxnet3_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats); | 416 | vmxnet3_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats); |
417 | 417 | ||
418 | extern char vmxnet3_driver_name[]; | 418 | extern char vmxnet3_driver_name[]; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 2ef5b6219f3f..da8479479d01 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2087,7 +2087,7 @@ static void vxlan_setup(struct net_device *dev) | |||
2087 | vxlan->age_timer.function = vxlan_cleanup; | 2087 | vxlan->age_timer.function = vxlan_cleanup; |
2088 | vxlan->age_timer.data = (unsigned long) vxlan; | 2088 | vxlan->age_timer.data = (unsigned long) vxlan; |
2089 | 2089 | ||
2090 | inet_get_local_port_range(&low, &high); | 2090 | inet_get_local_port_range(dev_net(dev), &low, &high); |
2091 | vxlan->port_min = low; | 2091 | vxlan->port_min = low; |
2092 | vxlan->port_max = high; | 2092 | vxlan->port_max = high; |
2093 | vxlan->dst_port = htons(vxlan_port); | 2093 | vxlan->dst_port = htons(vxlan_port); |
diff --git a/drivers/net/wan/x25_asy.h b/drivers/net/wan/x25_asy.h index 8f0fc2e57e2b..f57ee67836ae 100644 --- a/drivers/net/wan/x25_asy.h +++ b/drivers/net/wan/x25_asy.h | |||
@@ -41,6 +41,6 @@ struct x25_asy { | |||
41 | 41 | ||
42 | #define X25_ASY_MAGIC 0x5303 | 42 | #define X25_ASY_MAGIC 0x5303 |
43 | 43 | ||
44 | extern int x25_asy_init(struct net_device *dev); | 44 | int x25_asy_init(struct net_device *dev); |
45 | 45 | ||
46 | #endif /* _LINUX_X25_ASY.H */ | 46 | #endif /* _LINUX_X25_ASY.H */ |
diff --git a/drivers/net/wan/z85230.h b/drivers/net/wan/z85230.h index f29d554fc07d..2416a9d60bd6 100644 --- a/drivers/net/wan/z85230.h +++ b/drivers/net/wan/z85230.h | |||
@@ -395,20 +395,19 @@ struct z8530_dev | |||
395 | extern u8 z8530_dead_port[]; | 395 | extern u8 z8530_dead_port[]; |
396 | extern u8 z8530_hdlc_kilostream_85230[]; | 396 | extern u8 z8530_hdlc_kilostream_85230[]; |
397 | extern u8 z8530_hdlc_kilostream[]; | 397 | extern u8 z8530_hdlc_kilostream[]; |
398 | extern irqreturn_t z8530_interrupt(int, void *); | 398 | irqreturn_t z8530_interrupt(int, void *); |
399 | extern void z8530_describe(struct z8530_dev *, char *mapping, unsigned long io); | 399 | void z8530_describe(struct z8530_dev *, char *mapping, unsigned long io); |
400 | extern int z8530_init(struct z8530_dev *); | 400 | int z8530_init(struct z8530_dev *); |
401 | extern int z8530_shutdown(struct z8530_dev *); | 401 | int z8530_shutdown(struct z8530_dev *); |
402 | extern int z8530_sync_open(struct net_device *, struct z8530_channel *); | 402 | int z8530_sync_open(struct net_device *, struct z8530_channel *); |
403 | extern int z8530_sync_close(struct net_device *, struct z8530_channel *); | 403 | int z8530_sync_close(struct net_device *, struct z8530_channel *); |
404 | extern int z8530_sync_dma_open(struct net_device *, struct z8530_channel *); | 404 | int z8530_sync_dma_open(struct net_device *, struct z8530_channel *); |
405 | extern int z8530_sync_dma_close(struct net_device *, struct z8530_channel *); | 405 | int z8530_sync_dma_close(struct net_device *, struct z8530_channel *); |
406 | extern int z8530_sync_txdma_open(struct net_device *, struct z8530_channel *); | 406 | int z8530_sync_txdma_open(struct net_device *, struct z8530_channel *); |
407 | extern int z8530_sync_txdma_close(struct net_device *, struct z8530_channel *); | 407 | int z8530_sync_txdma_close(struct net_device *, struct z8530_channel *); |
408 | extern int z8530_channel_load(struct z8530_channel *, u8 *); | 408 | int z8530_channel_load(struct z8530_channel *, u8 *); |
409 | extern netdev_tx_t z8530_queue_xmit(struct z8530_channel *c, | 409 | netdev_tx_t z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb); |
410 | struct sk_buff *skb); | 410 | void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb); |
411 | extern void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb); | ||
412 | 411 | ||
413 | 412 | ||
414 | /* | 413 | /* |
diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h index 9f1e947f3557..649ecad6844c 100644 --- a/drivers/net/wimax/i2400m/i2400m-usb.h +++ b/drivers/net/wimax/i2400m/i2400m-usb.h | |||
@@ -256,21 +256,20 @@ void i2400mu_init(struct i2400mu *i2400mu) | |||
256 | i2400mu->rx_size_auto_shrink = 1; | 256 | i2400mu->rx_size_auto_shrink = 1; |
257 | } | 257 | } |
258 | 258 | ||
259 | extern int i2400mu_notification_setup(struct i2400mu *); | 259 | int i2400mu_notification_setup(struct i2400mu *); |
260 | extern void i2400mu_notification_release(struct i2400mu *); | 260 | void i2400mu_notification_release(struct i2400mu *); |
261 | 261 | ||
262 | extern int i2400mu_rx_setup(struct i2400mu *); | 262 | int i2400mu_rx_setup(struct i2400mu *); |
263 | extern void i2400mu_rx_release(struct i2400mu *); | 263 | void i2400mu_rx_release(struct i2400mu *); |
264 | extern void i2400mu_rx_kick(struct i2400mu *); | 264 | void i2400mu_rx_kick(struct i2400mu *); |
265 | 265 | ||
266 | extern int i2400mu_tx_setup(struct i2400mu *); | 266 | int i2400mu_tx_setup(struct i2400mu *); |
267 | extern void i2400mu_tx_release(struct i2400mu *); | 267 | void i2400mu_tx_release(struct i2400mu *); |
268 | extern void i2400mu_bus_tx_kick(struct i2400m *); | 268 | void i2400mu_bus_tx_kick(struct i2400m *); |
269 | 269 | ||
270 | extern ssize_t i2400mu_bus_bm_cmd_send(struct i2400m *, | 270 | ssize_t i2400mu_bus_bm_cmd_send(struct i2400m *, |
271 | const struct i2400m_bootrom_header *, | 271 | const struct i2400m_bootrom_header *, size_t, |
272 | size_t, int); | 272 | int); |
273 | extern ssize_t i2400mu_bus_bm_wait_for_ack(struct i2400m *, | 273 | ssize_t i2400mu_bus_bm_wait_for_ack(struct i2400m *, |
274 | struct i2400m_bootrom_header *, | 274 | struct i2400m_bootrom_header *, size_t); |
275 | size_t); | ||
276 | #endif /* #ifndef __I2400M_USB_H__ */ | 275 | #endif /* #ifndef __I2400M_USB_H__ */ |
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h index 79c6505b5c20..5a34e72bab9a 100644 --- a/drivers/net/wimax/i2400m/i2400m.h +++ b/drivers/net/wimax/i2400m/i2400m.h | |||
@@ -710,18 +710,18 @@ enum i2400m_bri { | |||
710 | I2400M_BRI_MAC_REINIT = 1 << 3, | 710 | I2400M_BRI_MAC_REINIT = 1 << 3, |
711 | }; | 711 | }; |
712 | 712 | ||
713 | extern void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *); | 713 | void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *); |
714 | extern int i2400m_dev_bootstrap(struct i2400m *, enum i2400m_bri); | 714 | int i2400m_dev_bootstrap(struct i2400m *, enum i2400m_bri); |
715 | extern int i2400m_read_mac_addr(struct i2400m *); | 715 | int i2400m_read_mac_addr(struct i2400m *); |
716 | extern int i2400m_bootrom_init(struct i2400m *, enum i2400m_bri); | 716 | int i2400m_bootrom_init(struct i2400m *, enum i2400m_bri); |
717 | extern int i2400m_is_boot_barker(struct i2400m *, const void *, size_t); | 717 | int i2400m_is_boot_barker(struct i2400m *, const void *, size_t); |
718 | static inline | 718 | static inline |
719 | int i2400m_is_d2h_barker(const void *buf) | 719 | int i2400m_is_d2h_barker(const void *buf) |
720 | { | 720 | { |
721 | const __le32 *barker = buf; | 721 | const __le32 *barker = buf; |
722 | return le32_to_cpu(*barker) == I2400M_D2H_MSG_BARKER; | 722 | return le32_to_cpu(*barker) == I2400M_D2H_MSG_BARKER; |
723 | } | 723 | } |
724 | extern void i2400m_unknown_barker(struct i2400m *, const void *, size_t); | 724 | void i2400m_unknown_barker(struct i2400m *, const void *, size_t); |
725 | 725 | ||
726 | /* Make/grok boot-rom header commands */ | 726 | /* Make/grok boot-rom header commands */ |
727 | 727 | ||
@@ -789,32 +789,31 @@ unsigned i2400m_brh_get_signature(const struct i2400m_bootrom_header *hdr) | |||
789 | /* | 789 | /* |
790 | * Driver / device setup and internal functions | 790 | * Driver / device setup and internal functions |
791 | */ | 791 | */ |
792 | extern void i2400m_init(struct i2400m *); | 792 | void i2400m_init(struct i2400m *); |
793 | extern int i2400m_reset(struct i2400m *, enum i2400m_reset_type); | 793 | int i2400m_reset(struct i2400m *, enum i2400m_reset_type); |
794 | extern void i2400m_netdev_setup(struct net_device *net_dev); | 794 | void i2400m_netdev_setup(struct net_device *net_dev); |
795 | extern int i2400m_sysfs_setup(struct device_driver *); | 795 | int i2400m_sysfs_setup(struct device_driver *); |
796 | extern void i2400m_sysfs_release(struct device_driver *); | 796 | void i2400m_sysfs_release(struct device_driver *); |
797 | extern int i2400m_tx_setup(struct i2400m *); | 797 | int i2400m_tx_setup(struct i2400m *); |
798 | extern void i2400m_wake_tx_work(struct work_struct *); | 798 | void i2400m_wake_tx_work(struct work_struct *); |
799 | extern void i2400m_tx_release(struct i2400m *); | 799 | void i2400m_tx_release(struct i2400m *); |
800 | 800 | ||
801 | extern int i2400m_rx_setup(struct i2400m *); | 801 | int i2400m_rx_setup(struct i2400m *); |
802 | extern void i2400m_rx_release(struct i2400m *); | 802 | void i2400m_rx_release(struct i2400m *); |
803 | 803 | ||
804 | extern void i2400m_fw_cache(struct i2400m *); | 804 | void i2400m_fw_cache(struct i2400m *); |
805 | extern void i2400m_fw_uncache(struct i2400m *); | 805 | void i2400m_fw_uncache(struct i2400m *); |
806 | 806 | ||
807 | extern void i2400m_net_rx(struct i2400m *, struct sk_buff *, unsigned, | 807 | void i2400m_net_rx(struct i2400m *, struct sk_buff *, unsigned, const void *, |
808 | const void *, int); | 808 | int); |
809 | extern void i2400m_net_erx(struct i2400m *, struct sk_buff *, | 809 | void i2400m_net_erx(struct i2400m *, struct sk_buff *, enum i2400m_cs); |
810 | enum i2400m_cs); | 810 | void i2400m_net_wake_stop(struct i2400m *); |
811 | extern void i2400m_net_wake_stop(struct i2400m *); | ||
812 | enum i2400m_pt; | 811 | enum i2400m_pt; |
813 | extern int i2400m_tx(struct i2400m *, const void *, size_t, enum i2400m_pt); | 812 | int i2400m_tx(struct i2400m *, const void *, size_t, enum i2400m_pt); |
814 | 813 | ||
815 | #ifdef CONFIG_DEBUG_FS | 814 | #ifdef CONFIG_DEBUG_FS |
816 | extern int i2400m_debugfs_add(struct i2400m *); | 815 | int i2400m_debugfs_add(struct i2400m *); |
817 | extern void i2400m_debugfs_rm(struct i2400m *); | 816 | void i2400m_debugfs_rm(struct i2400m *); |
818 | #else | 817 | #else |
819 | static inline int i2400m_debugfs_add(struct i2400m *i2400m) | 818 | static inline int i2400m_debugfs_add(struct i2400m *i2400m) |
820 | { | 819 | { |
@@ -824,8 +823,8 @@ static inline void i2400m_debugfs_rm(struct i2400m *i2400m) {} | |||
824 | #endif | 823 | #endif |
825 | 824 | ||
826 | /* Initialize/shutdown the device */ | 825 | /* Initialize/shutdown the device */ |
827 | extern int i2400m_dev_initialize(struct i2400m *); | 826 | int i2400m_dev_initialize(struct i2400m *); |
828 | extern void i2400m_dev_shutdown(struct i2400m *); | 827 | void i2400m_dev_shutdown(struct i2400m *); |
829 | 828 | ||
830 | extern struct attribute_group i2400m_dev_attr_group; | 829 | extern struct attribute_group i2400m_dev_attr_group; |
831 | 830 | ||
@@ -873,21 +872,21 @@ void i2400m_put(struct i2400m *i2400m) | |||
873 | dev_put(i2400m->wimax_dev.net_dev); | 872 | dev_put(i2400m->wimax_dev.net_dev); |
874 | } | 873 | } |
875 | 874 | ||
876 | extern int i2400m_dev_reset_handle(struct i2400m *, const char *); | 875 | int i2400m_dev_reset_handle(struct i2400m *, const char *); |
877 | extern int i2400m_pre_reset(struct i2400m *); | 876 | int i2400m_pre_reset(struct i2400m *); |
878 | extern int i2400m_post_reset(struct i2400m *); | 877 | int i2400m_post_reset(struct i2400m *); |
879 | extern void i2400m_error_recovery(struct i2400m *); | 878 | void i2400m_error_recovery(struct i2400m *); |
880 | 879 | ||
881 | /* | 880 | /* |
882 | * _setup()/_release() are called by the probe/disconnect functions of | 881 | * _setup()/_release() are called by the probe/disconnect functions of |
883 | * the bus-specific drivers. | 882 | * the bus-specific drivers. |
884 | */ | 883 | */ |
885 | extern int i2400m_setup(struct i2400m *, enum i2400m_bri bm_flags); | 884 | int i2400m_setup(struct i2400m *, enum i2400m_bri bm_flags); |
886 | extern void i2400m_release(struct i2400m *); | 885 | void i2400m_release(struct i2400m *); |
887 | 886 | ||
888 | extern int i2400m_rx(struct i2400m *, struct sk_buff *); | 887 | int i2400m_rx(struct i2400m *, struct sk_buff *); |
889 | extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *); | 888 | struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *); |
890 | extern void i2400m_tx_msg_sent(struct i2400m *); | 889 | void i2400m_tx_msg_sent(struct i2400m *); |
891 | 890 | ||
892 | 891 | ||
893 | /* | 892 | /* |
@@ -900,20 +899,19 @@ struct device *i2400m_dev(struct i2400m *i2400m) | |||
900 | return i2400m->wimax_dev.net_dev->dev.parent; | 899 | return i2400m->wimax_dev.net_dev->dev.parent; |
901 | } | 900 | } |
902 | 901 | ||
903 | extern int i2400m_msg_check_status(const struct i2400m_l3l4_hdr *, | 902 | int i2400m_msg_check_status(const struct i2400m_l3l4_hdr *, char *, size_t); |
904 | char *, size_t); | 903 | int i2400m_msg_size_check(struct i2400m *, const struct i2400m_l3l4_hdr *, |
905 | extern int i2400m_msg_size_check(struct i2400m *, | 904 | size_t); |
906 | const struct i2400m_l3l4_hdr *, size_t); | 905 | struct sk_buff *i2400m_msg_to_dev(struct i2400m *, const void *, size_t); |
907 | extern struct sk_buff *i2400m_msg_to_dev(struct i2400m *, const void *, size_t); | 906 | void i2400m_msg_to_dev_cancel_wait(struct i2400m *, int); |
908 | extern void i2400m_msg_to_dev_cancel_wait(struct i2400m *, int); | 907 | void i2400m_report_hook(struct i2400m *, const struct i2400m_l3l4_hdr *, |
909 | extern void i2400m_report_hook(struct i2400m *, | 908 | size_t); |
910 | const struct i2400m_l3l4_hdr *, size_t); | 909 | void i2400m_report_hook_work(struct work_struct *); |
911 | extern void i2400m_report_hook_work(struct work_struct *); | 910 | int i2400m_cmd_enter_powersave(struct i2400m *); |
912 | extern int i2400m_cmd_enter_powersave(struct i2400m *); | 911 | int i2400m_cmd_exit_idle(struct i2400m *); |
913 | extern int i2400m_cmd_exit_idle(struct i2400m *); | 912 | struct sk_buff *i2400m_get_device_info(struct i2400m *); |
914 | extern struct sk_buff *i2400m_get_device_info(struct i2400m *); | 913 | int i2400m_firmware_check(struct i2400m *); |
915 | extern int i2400m_firmware_check(struct i2400m *); | 914 | int i2400m_set_idle_timeout(struct i2400m *, unsigned); |
916 | extern int i2400m_set_idle_timeout(struct i2400m *, unsigned); | ||
917 | 915 | ||
918 | static inline | 916 | static inline |
919 | struct usb_endpoint_descriptor *usb_get_epd(struct usb_interface *iface, int ep) | 917 | struct usb_endpoint_descriptor *usb_get_epd(struct usb_interface *iface, int ep) |
@@ -921,10 +919,9 @@ struct usb_endpoint_descriptor *usb_get_epd(struct usb_interface *iface, int ep) | |||
921 | return &iface->cur_altsetting->endpoint[ep].desc; | 919 | return &iface->cur_altsetting->endpoint[ep].desc; |
922 | } | 920 | } |
923 | 921 | ||
924 | extern int i2400m_op_rfkill_sw_toggle(struct wimax_dev *, | 922 | int i2400m_op_rfkill_sw_toggle(struct wimax_dev *, enum wimax_rf_state); |
925 | enum wimax_rf_state); | 923 | void i2400m_report_tlv_rf_switches_status(struct i2400m *, |
926 | extern void i2400m_report_tlv_rf_switches_status( | 924 | const struct i2400m_tlv_rf_switches_status *); |
927 | struct i2400m *, const struct i2400m_tlv_rf_switches_status *); | ||
928 | 925 | ||
929 | /* | 926 | /* |
930 | * Helpers for firmware backwards compatibility | 927 | * Helpers for firmware backwards compatibility |
@@ -968,8 +965,8 @@ void __i2400m_msleep(unsigned ms) | |||
968 | 965 | ||
969 | 966 | ||
970 | /* module initialization helpers */ | 967 | /* module initialization helpers */ |
971 | extern int i2400m_barker_db_init(const char *); | 968 | int i2400m_barker_db_init(const char *); |
972 | extern void i2400m_barker_db_exit(void); | 969 | void i2400m_barker_db_exit(void); |
973 | 970 | ||
974 | 971 | ||
975 | 972 | ||
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h index 168140c54028..bb0063320397 100644 --- a/drivers/net/wireless/ath/ath10k/debug.h +++ b/drivers/net/wireless/ath/ath10k/debug.h | |||
@@ -37,9 +37,9 @@ enum ath10k_debug_mask { | |||
37 | 37 | ||
38 | extern unsigned int ath10k_debug_mask; | 38 | extern unsigned int ath10k_debug_mask; |
39 | 39 | ||
40 | extern __printf(1, 2) int ath10k_info(const char *fmt, ...); | 40 | __printf(1, 2) int ath10k_info(const char *fmt, ...); |
41 | extern __printf(1, 2) int ath10k_err(const char *fmt, ...); | 41 | __printf(1, 2) int ath10k_err(const char *fmt, ...); |
42 | extern __printf(1, 2) int ath10k_warn(const char *fmt, ...); | 42 | __printf(1, 2) int ath10k_warn(const char *fmt, ...); |
43 | 43 | ||
44 | #ifdef CONFIG_ATH10K_DEBUGFS | 44 | #ifdef CONFIG_ATH10K_DEBUGFS |
45 | int ath10k_debug_create(struct ath10k *ar); | 45 | int ath10k_debug_create(struct ath10k *ar); |
@@ -68,7 +68,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar, | |||
68 | #endif /* CONFIG_ATH10K_DEBUGFS */ | 68 | #endif /* CONFIG_ATH10K_DEBUGFS */ |
69 | 69 | ||
70 | #ifdef CONFIG_ATH10K_DEBUG | 70 | #ifdef CONFIG_ATH10K_DEBUG |
71 | extern __printf(2, 3) void ath10k_dbg(enum ath10k_debug_mask mask, | 71 | __printf(2, 3) void ath10k_dbg(enum ath10k_debug_mask mask, |
72 | const char *fmt, ...); | 72 | const char *fmt, ...); |
73 | void ath10k_dbg_dump(enum ath10k_debug_mask mask, | 73 | void ath10k_dbg_dump(enum ath10k_debug_mask mask, |
74 | const char *msg, const char *prefix, | 74 | const char *msg, const char *prefix, |
diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h index 98a886154d9c..05debf700a84 100644 --- a/drivers/net/wireless/ath/ath6kl/common.h +++ b/drivers/net/wireless/ath/ath6kl/common.h | |||
@@ -22,8 +22,7 @@ | |||
22 | 22 | ||
23 | #define ATH6KL_MAX_IE 256 | 23 | #define ATH6KL_MAX_IE 256 |
24 | 24 | ||
25 | extern __printf(2, 3) | 25 | __printf(2, 3) int ath6kl_printk(const char *level, const char *fmt, ...); |
26 | int ath6kl_printk(const char *level, const char *fmt, ...); | ||
27 | 26 | ||
28 | /* | 27 | /* |
29 | * Reflects the version of binary interface exposed by ATH6KL target | 28 | * Reflects the version of binary interface exposed by ATH6KL target |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h index 74369de00fb5..ca9ba005f287 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.h +++ b/drivers/net/wireless/ath/ath6kl/debug.h | |||
@@ -50,11 +50,10 @@ enum ATH6K_DEBUG_MASK { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | extern unsigned int debug_mask; | 52 | extern unsigned int debug_mask; |
53 | extern __printf(2, 3) | 53 | __printf(2, 3) int ath6kl_printk(const char *level, const char *fmt, ...); |
54 | int ath6kl_printk(const char *level, const char *fmt, ...); | 54 | __printf(1, 2) int ath6kl_info(const char *fmt, ...); |
55 | extern __printf(1, 2) int ath6kl_info(const char *fmt, ...); | 55 | __printf(1, 2) int ath6kl_err(const char *fmt, ...); |
56 | extern __printf(1, 2) int ath6kl_err(const char *fmt, ...); | 56 | __printf(1, 2) int ath6kl_warn(const char *fmt, ...); |
57 | extern __printf(1, 2) int ath6kl_warn(const char *fmt, ...); | ||
58 | 57 | ||
59 | enum ath6kl_war { | 58 | enum ath6kl_war { |
60 | ATH6KL_WAR_INVALID_RATE, | 59 | ATH6KL_WAR_INVALID_RATE, |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 2ee35f677c0e..da24ba2a5b41 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -952,7 +952,7 @@ void ath9k_ps_restore(struct ath_softc *sc); | |||
952 | u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate); | 952 | u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate); |
953 | 953 | ||
954 | void ath_start_rfkill_poll(struct ath_softc *sc); | 954 | void ath_start_rfkill_poll(struct ath_softc *sc); |
955 | extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw); | 955 | void ath9k_rfkill_poll_state(struct ieee80211_hw *hw); |
956 | void ath9k_calculate_iter_data(struct ieee80211_hw *hw, | 956 | void ath9k_calculate_iter_data(struct ieee80211_hw *hw, |
957 | struct ieee80211_vif *vif, | 957 | struct ieee80211_vif *vif, |
958 | struct ath9k_vif_iter_data *iter_data); | 958 | struct ath9k_vif_iter_data *iter_data); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index 2eb9e642c9bf..34af9d183107 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h | |||
@@ -632,29 +632,29 @@ struct brcmf_skb_reorder_data { | |||
632 | u8 *reorder; | 632 | u8 *reorder; |
633 | }; | 633 | }; |
634 | 634 | ||
635 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); | 635 | int brcmf_netdev_wait_pend8021x(struct net_device *ndev); |
636 | 636 | ||
637 | /* Return pointer to interface name */ | 637 | /* Return pointer to interface name */ |
638 | extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); | 638 | char *brcmf_ifname(struct brcmf_pub *drvr, int idx); |
639 | 639 | ||
640 | /* Query dongle */ | 640 | /* Query dongle */ |
641 | extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, | 641 | int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, |
642 | uint cmd, void *buf, uint len); | 642 | void *buf, uint len); |
643 | extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, | 643 | int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, |
644 | void *buf, uint len); | 644 | void *buf, uint len); |
645 | 645 | ||
646 | /* Remove any protocol-specific data header. */ | 646 | /* Remove any protocol-specific data header. */ |
647 | extern int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx, | 647 | int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx, |
648 | struct sk_buff *rxp); | 648 | struct sk_buff *rxp); |
649 | 649 | ||
650 | extern int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); | 650 | int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); |
651 | extern struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, | 651 | struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, |
652 | s32 ifidx, char *name, u8 *mac_addr); | 652 | char *name, u8 *mac_addr); |
653 | extern void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx); | 653 | void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx); |
654 | void brcmf_txflowblock_if(struct brcmf_if *ifp, | 654 | void brcmf_txflowblock_if(struct brcmf_if *ifp, |
655 | enum brcmf_netif_stop_reason reason, bool state); | 655 | enum brcmf_netif_stop_reason reason, bool state); |
656 | extern u32 brcmf_get_chip_info(struct brcmf_if *ifp); | 656 | u32 brcmf_get_chip_info(struct brcmf_if *ifp); |
657 | extern void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, | 657 | void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, |
658 | bool success); | 658 | bool success); |
659 | 659 | ||
660 | #endif /* _BRCMF_H_ */ | 660 | #endif /* _BRCMF_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index 74156f84180c..7f1340d03f18 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | |||
@@ -132,35 +132,34 @@ struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus) | |||
132 | * interface functions from common layer | 132 | * interface functions from common layer |
133 | */ | 133 | */ |
134 | 134 | ||
135 | extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, | 135 | bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, struct sk_buff *pkt, |
136 | struct sk_buff *pkt, int prec); | 136 | int prec); |
137 | 137 | ||
138 | /* Receive frame for delivery to OS. Callee disposes of rxp. */ | 138 | /* Receive frame for delivery to OS. Callee disposes of rxp. */ |
139 | extern void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist); | 139 | void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist); |
140 | 140 | ||
141 | /* Indication from bus module regarding presence/insertion of dongle. */ | 141 | /* Indication from bus module regarding presence/insertion of dongle. */ |
142 | extern int brcmf_attach(uint bus_hdrlen, struct device *dev); | 142 | int brcmf_attach(uint bus_hdrlen, struct device *dev); |
143 | /* Indication from bus module regarding removal/absence of dongle */ | 143 | /* Indication from bus module regarding removal/absence of dongle */ |
144 | extern void brcmf_detach(struct device *dev); | 144 | void brcmf_detach(struct device *dev); |
145 | /* Indication from bus module that dongle should be reset */ | 145 | /* Indication from bus module that dongle should be reset */ |
146 | extern void brcmf_dev_reset(struct device *dev); | 146 | void brcmf_dev_reset(struct device *dev); |
147 | /* Indication from bus module to change flow-control state */ | 147 | /* Indication from bus module to change flow-control state */ |
148 | extern void brcmf_txflowblock(struct device *dev, bool state); | 148 | void brcmf_txflowblock(struct device *dev, bool state); |
149 | 149 | ||
150 | /* Notify the bus has transferred the tx packet to firmware */ | 150 | /* Notify the bus has transferred the tx packet to firmware */ |
151 | extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, | 151 | void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success); |
152 | bool success); | ||
153 | 152 | ||
154 | extern int brcmf_bus_start(struct device *dev); | 153 | int brcmf_bus_start(struct device *dev); |
155 | 154 | ||
156 | #ifdef CONFIG_BRCMFMAC_SDIO | 155 | #ifdef CONFIG_BRCMFMAC_SDIO |
157 | extern void brcmf_sdio_exit(void); | 156 | void brcmf_sdio_exit(void); |
158 | extern void brcmf_sdio_init(void); | 157 | void brcmf_sdio_init(void); |
159 | extern void brcmf_sdio_register(void); | 158 | void brcmf_sdio_register(void); |
160 | #endif | 159 | #endif |
161 | #ifdef CONFIG_BRCMFMAC_USB | 160 | #ifdef CONFIG_BRCMFMAC_USB |
162 | extern void brcmf_usb_exit(void); | 161 | void brcmf_usb_exit(void); |
163 | extern void brcmf_usb_register(void); | 162 | void brcmf_usb_register(void); |
164 | #endif | 163 | #endif |
165 | 164 | ||
166 | #endif /* _BRCMF_BUS_H_ */ | 165 | #endif /* _BRCMF_BUS_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h index ef9179883748..53c6e710f2cb 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h | |||
@@ -22,21 +22,21 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* Linkage, sets prot link and updates hdrlen in pub */ | 24 | /* Linkage, sets prot link and updates hdrlen in pub */ |
25 | extern int brcmf_proto_attach(struct brcmf_pub *drvr); | 25 | int brcmf_proto_attach(struct brcmf_pub *drvr); |
26 | 26 | ||
27 | /* Unlink, frees allocated protocol memory (including brcmf_proto) */ | 27 | /* Unlink, frees allocated protocol memory (including brcmf_proto) */ |
28 | extern void brcmf_proto_detach(struct brcmf_pub *drvr); | 28 | void brcmf_proto_detach(struct brcmf_pub *drvr); |
29 | 29 | ||
30 | /* Stop protocol: sync w/dongle state. */ | 30 | /* Stop protocol: sync w/dongle state. */ |
31 | extern void brcmf_proto_stop(struct brcmf_pub *drvr); | 31 | void brcmf_proto_stop(struct brcmf_pub *drvr); |
32 | 32 | ||
33 | /* Add any protocol-specific data header. | 33 | /* Add any protocol-specific data header. |
34 | * Caller must reserve prot_hdrlen prepend space. | 34 | * Caller must reserve prot_hdrlen prepend space. |
35 | */ | 35 | */ |
36 | extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx, u8 offset, | 36 | void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx, u8 offset, |
37 | struct sk_buff *txp); | 37 | struct sk_buff *txp); |
38 | 38 | ||
39 | /* Sets dongle media info (drv_version, mac address). */ | 39 | /* Sets dongle media info (drv_version, mac address). */ |
40 | extern int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); | 40 | int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); |
41 | 41 | ||
42 | #endif /* _BRCMF_PROTO_H_ */ | 42 | #endif /* _BRCMF_PROTO_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h index 83c041f1bf4a..f0780ee05602 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h | |||
@@ -215,17 +215,16 @@ struct sdpcmd_regs { | |||
215 | u16 PAD[0x80]; | 215 | u16 PAD[0x80]; |
216 | }; | 216 | }; |
217 | 217 | ||
218 | extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, | 218 | int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, |
219 | struct chip_info **ci_ptr, u32 regs); | 219 | struct chip_info **ci_ptr, u32 regs); |
220 | extern void brcmf_sdio_chip_detach(struct chip_info **ci_ptr); | 220 | void brcmf_sdio_chip_detach(struct chip_info **ci_ptr); |
221 | extern void brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, | 221 | void brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, |
222 | struct chip_info *ci, | 222 | struct chip_info *ci, u32 drivestrength); |
223 | u32 drivestrength); | 223 | u8 brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid); |
224 | extern u8 brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid); | 224 | void brcmf_sdio_chip_enter_download(struct brcmf_sdio_dev *sdiodev, |
225 | extern void brcmf_sdio_chip_enter_download(struct brcmf_sdio_dev *sdiodev, | 225 | struct chip_info *ci); |
226 | struct chip_info *ci); | 226 | bool brcmf_sdio_chip_exit_download(struct brcmf_sdio_dev *sdiodev, |
227 | extern bool brcmf_sdio_chip_exit_download(struct brcmf_sdio_dev *sdiodev, | 227 | struct chip_info *ci, char *nvram_dat, |
228 | struct chip_info *ci, char *nvram_dat, | 228 | uint nvram_sz); |
229 | uint nvram_sz); | ||
230 | 229 | ||
231 | #endif /* _BRCMFMAC_SDIO_CHIP_H_ */ | 230 | #endif /* _BRCMFMAC_SDIO_CHIP_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h index 2b5407f002e5..c9b06b4e71f7 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h | |||
@@ -181,18 +181,18 @@ struct brcmf_sdio_dev { | |||
181 | }; | 181 | }; |
182 | 182 | ||
183 | /* Register/deregister interrupt handler. */ | 183 | /* Register/deregister interrupt handler. */ |
184 | extern int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev); | 184 | int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev); |
185 | extern int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev); | 185 | int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev); |
186 | 186 | ||
187 | /* sdio device register access interface */ | 187 | /* sdio device register access interface */ |
188 | extern u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); | 188 | u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); |
189 | extern u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); | 189 | u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); |
190 | extern void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, | 190 | void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, u8 data, |
191 | u8 data, int *ret); | 191 | int *ret); |
192 | extern void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, | 192 | void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data, |
193 | u32 data, int *ret); | 193 | int *ret); |
194 | extern int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, | 194 | int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, |
195 | void *data, bool write); | 195 | void *data, bool write); |
196 | 196 | ||
197 | /* Buffer transfer to/from device (client) core via cmd53. | 197 | /* Buffer transfer to/from device (client) core via cmd53. |
198 | * fn: function number | 198 | * fn: function number |
@@ -206,22 +206,17 @@ extern int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, | |||
206 | * Returns 0 or error code. | 206 | * Returns 0 or error code. |
207 | * NOTE: Async operation is not currently supported. | 207 | * NOTE: Async operation is not currently supported. |
208 | */ | 208 | */ |
209 | extern int | 209 | int brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
210 | brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | 210 | uint flags, struct sk_buff_head *pktq); |
211 | uint flags, struct sk_buff_head *pktq); | 211 | int brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
212 | extern int | 212 | uint flags, u8 *buf, uint nbytes); |
213 | brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | 213 | |
214 | uint flags, u8 *buf, uint nbytes); | 214 | int brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
215 | 215 | uint flags, struct sk_buff *pkt); | |
216 | extern int | 216 | int brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
217 | brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | 217 | uint flags, u8 *buf, uint nbytes); |
218 | uint flags, struct sk_buff *pkt); | 218 | int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, |
219 | extern int | 219 | uint flags, struct sk_buff_head *pktq); |
220 | brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | ||
221 | uint flags, u8 *buf, uint nbytes); | ||
222 | extern int | ||
223 | brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | ||
224 | uint flags, struct sk_buff_head *pktq); | ||
225 | 220 | ||
226 | /* Flags bits */ | 221 | /* Flags bits */ |
227 | 222 | ||
@@ -237,46 +232,43 @@ brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, | |||
237 | * nbytes: number of bytes to transfer to/from buf | 232 | * nbytes: number of bytes to transfer to/from buf |
238 | * Returns 0 or error code. | 233 | * Returns 0 or error code. |
239 | */ | 234 | */ |
240 | extern int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, | 235 | int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr, |
241 | u32 addr, u8 *buf, uint nbytes); | 236 | u8 *buf, uint nbytes); |
242 | extern int brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, | 237 | int brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address, |
243 | u32 address, u8 *data, uint size); | 238 | u8 *data, uint size); |
244 | 239 | ||
245 | /* Issue an abort to the specified function */ | 240 | /* Issue an abort to the specified function */ |
246 | extern int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn); | 241 | int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn); |
247 | 242 | ||
248 | /* platform specific/high level functions */ | 243 | /* platform specific/high level functions */ |
249 | extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev); | 244 | int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev); |
250 | extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev); | 245 | int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev); |
251 | 246 | ||
252 | /* attach, return handler on success, NULL if failed. | 247 | /* attach, return handler on success, NULL if failed. |
253 | * The handler shall be provided by all subsequent calls. No local cache | 248 | * The handler shall be provided by all subsequent calls. No local cache |
254 | * cfghdl points to the starting address of pci device mapped memory | 249 | * cfghdl points to the starting address of pci device mapped memory |
255 | */ | 250 | */ |
256 | extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev); | 251 | int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev); |
257 | extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev); | 252 | void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev); |
258 | 253 | ||
259 | /* read or write one byte using cmd52 */ | 254 | /* read or write one byte using cmd52 */ |
260 | extern int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, | 255 | int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint fnc, |
261 | uint fnc, uint addr, u8 *byte); | 256 | uint addr, u8 *byte); |
262 | 257 | ||
263 | /* read or write 2/4 bytes using cmd53 */ | 258 | /* read or write 2/4 bytes using cmd53 */ |
264 | extern int | 259 | int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint rw, uint fnc, |
265 | brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, | 260 | uint addr, u32 *word, uint nbyte); |
266 | uint rw, uint fnc, uint addr, | ||
267 | u32 *word, uint nbyte); | ||
268 | 261 | ||
269 | /* Watchdog timer interface for pm ops */ | 262 | /* Watchdog timer interface for pm ops */ |
270 | extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, | 263 | void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, bool enable); |
271 | bool enable); | ||
272 | 264 | ||
273 | extern void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev); | 265 | void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev); |
274 | extern void brcmf_sdbrcm_disconnect(void *ptr); | 266 | void brcmf_sdbrcm_disconnect(void *ptr); |
275 | extern void brcmf_sdbrcm_isr(void *arg); | 267 | void brcmf_sdbrcm_isr(void *arg); |
276 | 268 | ||
277 | extern void brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick); | 269 | void brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick); |
278 | 270 | ||
279 | extern void brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, | 271 | void brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, |
280 | wait_queue_head_t *wq); | 272 | wait_queue_head_t *wq); |
281 | extern bool brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev); | 273 | bool brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev); |
282 | #endif /* _BRCM_SDH_H_ */ | 274 | #endif /* _BRCM_SDH_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h index a8a267b5b87a..2d08c155c23b 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | |||
@@ -172,19 +172,19 @@ struct si_info { | |||
172 | 172 | ||
173 | 173 | ||
174 | /* AMBA Interconnect exported externs */ | 174 | /* AMBA Interconnect exported externs */ |
175 | extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val); | 175 | u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val); |
176 | 176 | ||
177 | /* === exported functions === */ | 177 | /* === exported functions === */ |
178 | extern struct si_pub *ai_attach(struct bcma_bus *pbus); | 178 | struct si_pub *ai_attach(struct bcma_bus *pbus); |
179 | extern void ai_detach(struct si_pub *sih); | 179 | void ai_detach(struct si_pub *sih); |
180 | extern uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val); | 180 | uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val); |
181 | extern void ai_clkctl_init(struct si_pub *sih); | 181 | void ai_clkctl_init(struct si_pub *sih); |
182 | extern u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih); | 182 | u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih); |
183 | extern bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode); | 183 | bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode); |
184 | extern bool ai_deviceremoved(struct si_pub *sih); | 184 | bool ai_deviceremoved(struct si_pub *sih); |
185 | 185 | ||
186 | /* Enable Ex-PA for 4313 */ | 186 | /* Enable Ex-PA for 4313 */ |
187 | extern void ai_epa_4313war(struct si_pub *sih); | 187 | void ai_epa_4313war(struct si_pub *sih); |
188 | 188 | ||
189 | static inline u32 ai_get_cccaps(struct si_pub *sih) | 189 | static inline u32 ai_get_cccaps(struct si_pub *sih) |
190 | { | 190 | { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h index 73d01e586109..03bdcf29bd50 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h | |||
@@ -37,17 +37,17 @@ struct brcms_ampdu_session { | |||
37 | u16 dma_len; | 37 | u16 dma_len; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | extern void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session, | 40 | void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session, |
41 | struct brcms_c_info *wlc); | 41 | struct brcms_c_info *wlc); |
42 | extern int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session, | 42 | int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session, |
43 | struct sk_buff *p); | 43 | struct sk_buff *p); |
44 | extern void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session); | 44 | void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session); |
45 | 45 | ||
46 | extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc); | 46 | struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc); |
47 | extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu); | 47 | void brcms_c_ampdu_detach(struct ampdu_info *ampdu); |
48 | extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, | 48 | void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, |
49 | struct sk_buff *p, struct tx_status *txs); | 49 | struct sk_buff *p, struct tx_status *txs); |
50 | extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc); | 50 | void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc); |
51 | extern void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu); | 51 | void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu); |
52 | 52 | ||
53 | #endif /* _BRCM_AMPDU_H_ */ | 53 | #endif /* _BRCM_AMPDU_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/antsel.h b/drivers/net/wireless/brcm80211/brcmsmac/antsel.h index 97ea3881a8ec..a3d487ab1964 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/antsel.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/antsel.h | |||
@@ -17,13 +17,11 @@ | |||
17 | #ifndef _BRCM_ANTSEL_H_ | 17 | #ifndef _BRCM_ANTSEL_H_ |
18 | #define _BRCM_ANTSEL_H_ | 18 | #define _BRCM_ANTSEL_H_ |
19 | 19 | ||
20 | extern struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc); | 20 | struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc); |
21 | extern void brcms_c_antsel_detach(struct antsel_info *asi); | 21 | void brcms_c_antsel_detach(struct antsel_info *asi); |
22 | extern void brcms_c_antsel_init(struct antsel_info *asi); | 22 | void brcms_c_antsel_init(struct antsel_info *asi); |
23 | extern void brcms_c_antsel_antcfg_get(struct antsel_info *asi, bool usedef, | 23 | void brcms_c_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel, |
24 | bool sel, | 24 | u8 id, u8 fbid, u8 *antcfg, u8 *fbantcfg); |
25 | u8 id, u8 fbid, u8 *antcfg, | 25 | u8 brcms_c_antsel_antsel2id(struct antsel_info *asi, u16 antsel); |
26 | u8 *fbantcfg); | ||
27 | extern u8 brcms_c_antsel_antsel2id(struct antsel_info *asi, u16 antsel); | ||
28 | 26 | ||
29 | #endif /* _BRCM_ANTSEL_H_ */ | 27 | #endif /* _BRCM_ANTSEL_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.h b/drivers/net/wireless/brcm80211/brcmsmac/channel.h index 006483a0abe6..39dd3a5b2979 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.h | |||
@@ -32,20 +32,16 @@ | |||
32 | 32 | ||
33 | #define BRCMS_DFS_EU (BRCMS_DFS_TPC | BRCMS_RADAR_TYPE_EU) /* Flag for DFS EU */ | 33 | #define BRCMS_DFS_EU (BRCMS_DFS_TPC | BRCMS_RADAR_TYPE_EU) /* Flag for DFS EU */ |
34 | 34 | ||
35 | extern struct brcms_cm_info * | 35 | struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc); |
36 | brcms_c_channel_mgr_attach(struct brcms_c_info *wlc); | ||
37 | 36 | ||
38 | extern void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm); | 37 | void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm); |
39 | 38 | ||
40 | extern bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, | 39 | bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, u16 chspec); |
41 | u16 chspec); | ||
42 | 40 | ||
43 | extern void brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, | 41 | void brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, |
44 | u16 chanspec, | 42 | struct txpwr_limits *txpwr); |
45 | struct txpwr_limits *txpwr); | 43 | void brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec, |
46 | extern void brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, | 44 | u8 local_constraint_qdbm); |
47 | u16 chanspec, | 45 | void brcms_c_regd_init(struct brcms_c_info *wlc); |
48 | u8 local_constraint_qdbm); | ||
49 | extern void brcms_c_regd_init(struct brcms_c_info *wlc); | ||
50 | 46 | ||
51 | #endif /* _WLC_CHANNEL_H */ | 47 | #endif /* _WLC_CHANNEL_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h index 4090032e81a2..198053dfc310 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h | |||
@@ -88,26 +88,26 @@ struct brcms_info { | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | /* misc callbacks */ | 90 | /* misc callbacks */ |
91 | extern void brcms_init(struct brcms_info *wl); | 91 | void brcms_init(struct brcms_info *wl); |
92 | extern uint brcms_reset(struct brcms_info *wl); | 92 | uint brcms_reset(struct brcms_info *wl); |
93 | extern void brcms_intrson(struct brcms_info *wl); | 93 | void brcms_intrson(struct brcms_info *wl); |
94 | extern u32 brcms_intrsoff(struct brcms_info *wl); | 94 | u32 brcms_intrsoff(struct brcms_info *wl); |
95 | extern void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask); | 95 | void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask); |
96 | extern int brcms_up(struct brcms_info *wl); | 96 | int brcms_up(struct brcms_info *wl); |
97 | extern void brcms_down(struct brcms_info *wl); | 97 | void brcms_down(struct brcms_info *wl); |
98 | extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, | 98 | void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, |
99 | bool state, int prio); | 99 | bool state, int prio); |
100 | extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl); | 100 | bool brcms_rfkill_set_hw_state(struct brcms_info *wl); |
101 | 101 | ||
102 | /* timer functions */ | 102 | /* timer functions */ |
103 | extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl, | 103 | struct brcms_timer *brcms_init_timer(struct brcms_info *wl, |
104 | void (*fn) (void *arg), void *arg, | 104 | void (*fn) (void *arg), void *arg, |
105 | const char *name); | 105 | const char *name); |
106 | extern void brcms_free_timer(struct brcms_timer *timer); | 106 | void brcms_free_timer(struct brcms_timer *timer); |
107 | extern void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic); | 107 | void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic); |
108 | extern bool brcms_del_timer(struct brcms_timer *timer); | 108 | bool brcms_del_timer(struct brcms_timer *timer); |
109 | extern void brcms_dpc(unsigned long data); | 109 | void brcms_dpc(unsigned long data); |
110 | extern void brcms_timer(struct brcms_timer *t); | 110 | void brcms_timer(struct brcms_timer *t); |
111 | extern void brcms_fatal_error(struct brcms_info *wl); | 111 | void brcms_fatal_error(struct brcms_info *wl); |
112 | 112 | ||
113 | #endif /* _BRCM_MAC80211_IF_H_ */ | 113 | #endif /* _BRCM_MAC80211_IF_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h index b5d7a38b53fe..c4d135cff04a 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h | |||
@@ -616,66 +616,54 @@ struct brcms_bss_cfg { | |||
616 | struct brcms_bss_info *current_bss; | 616 | struct brcms_bss_info *current_bss; |
617 | }; | 617 | }; |
618 | 618 | ||
619 | extern int brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, | 619 | int brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p); |
620 | struct sk_buff *p); | 620 | int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, |
621 | extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, | 621 | uint *blocks); |
622 | uint *blocks); | 622 | |
623 | 623 | int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); | |
624 | extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); | 624 | void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); |
625 | extern void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); | 625 | u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, uint mac_len); |
626 | extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, | 626 | u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec, |
627 | uint mac_len); | 627 | bool use_rspec, u16 mimo_ctlchbw); |
628 | extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, | 628 | u16 brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only, |
629 | u32 rspec, | 629 | u32 rts_rate, u32 frame_rate, |
630 | bool use_rspec, u16 mimo_ctlchbw); | 630 | u8 rts_preamble_type, u8 frame_preamble_type, |
631 | extern u16 brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only, | 631 | uint frame_len, bool ba); |
632 | u32 rts_rate, | 632 | void brcms_c_inval_dma_pkts(struct brcms_hardware *hw, |
633 | u32 frame_rate, | 633 | struct ieee80211_sta *sta, void (*dma_callback_fn)); |
634 | u8 rts_preamble_type, | 634 | void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend); |
635 | u8 frame_preamble_type, uint frame_len, | 635 | int brcms_c_set_nmode(struct brcms_c_info *wlc); |
636 | bool ba); | 636 | void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, u32 bcn_rate); |
637 | extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw, | 637 | void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type); |
638 | struct ieee80211_sta *sta, | 638 | void brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, |
639 | void (*dma_callback_fn)); | 639 | bool mute, struct txpwr_limits *txpwr); |
640 | extern void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend); | 640 | void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v); |
641 | extern int brcms_c_set_nmode(struct brcms_c_info *wlc); | 641 | u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset); |
642 | extern void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, | 642 | void brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, |
643 | u32 bcn_rate); | 643 | int bands); |
644 | extern void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, | 644 | void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags); |
645 | u8 antsel_type); | 645 | void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val); |
646 | extern void brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, | 646 | void brcms_b_phy_reset(struct brcms_hardware *wlc_hw); |
647 | u16 chanspec, | 647 | void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw); |
648 | bool mute, struct txpwr_limits *txpwr); | 648 | void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw); |
649 | extern void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, | 649 | void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, |
650 | u16 v); | 650 | u32 override_bit); |
651 | extern u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset); | 651 | void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, |
652 | extern void brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, | 652 | u32 override_bit); |
653 | u16 val, int bands); | 653 | void brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, |
654 | extern void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags); | 654 | int len, void *buf); |
655 | extern void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val); | 655 | u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate); |
656 | extern void brcms_b_phy_reset(struct brcms_hardware *wlc_hw); | 656 | void brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset, |
657 | extern void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw); | 657 | const void *buf, int len, u32 sel); |
658 | extern void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw); | 658 | void brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, |
659 | extern void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, | 659 | void *buf, int len, u32 sel); |
660 | u32 override_bit); | 660 | void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode); |
661 | extern void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, | 661 | u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw); |
662 | u32 override_bit); | 662 | void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk); |
663 | extern void brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, | 663 | void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk); |
664 | int offset, int len, void *buf); | 664 | void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on); |
665 | extern u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate); | 665 | void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant); |
666 | extern void brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, | 666 | void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode); |
667 | uint offset, const void *buf, int len, | 667 | void brcms_c_init_scb(struct scb *scb); |
668 | u32 sel); | ||
669 | extern void brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, | ||
670 | void *buf, int len, u32 sel); | ||
671 | extern void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode); | ||
672 | extern u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw); | ||
673 | extern void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk); | ||
674 | extern void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk); | ||
675 | extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on); | ||
676 | extern void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant); | ||
677 | extern void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, | ||
678 | u8 stf_mode); | ||
679 | extern void brcms_c_init_scb(struct scb *scb); | ||
680 | 668 | ||
681 | #endif /* _BRCM_MAIN_H_ */ | 669 | #endif /* _BRCM_MAIN_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h index e34a71e7d242..4d3734f48d9c 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h | |||
@@ -179,121 +179,106 @@ struct shared_phy_params { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | 181 | ||
182 | extern struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp); | 182 | struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp); |
183 | extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh, | 183 | struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh, |
184 | struct bcma_device *d11core, | 184 | struct bcma_device *d11core, int bandtype, |
185 | int bandtype, struct wiphy *wiphy); | 185 | struct wiphy *wiphy); |
186 | extern void wlc_phy_detach(struct brcms_phy_pub *ppi); | 186 | void wlc_phy_detach(struct brcms_phy_pub *ppi); |
187 | 187 | ||
188 | extern bool wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype, | 188 | bool wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype, |
189 | u16 *phyrev, u16 *radioid, | 189 | u16 *phyrev, u16 *radioid, u16 *radiover); |
190 | u16 *radiover); | 190 | bool wlc_phy_get_encore(struct brcms_phy_pub *pih); |
191 | extern bool wlc_phy_get_encore(struct brcms_phy_pub *pih); | 191 | u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih); |
192 | extern u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih); | 192 | |
193 | 193 | void wlc_phy_hw_clk_state_upd(struct brcms_phy_pub *ppi, bool newstate); | |
194 | extern void wlc_phy_hw_clk_state_upd(struct brcms_phy_pub *ppi, bool newstate); | 194 | void wlc_phy_hw_state_upd(struct brcms_phy_pub *ppi, bool newstate); |
195 | extern void wlc_phy_hw_state_upd(struct brcms_phy_pub *ppi, bool newstate); | 195 | void wlc_phy_init(struct brcms_phy_pub *ppi, u16 chanspec); |
196 | extern void wlc_phy_init(struct brcms_phy_pub *ppi, u16 chanspec); | 196 | void wlc_phy_watchdog(struct brcms_phy_pub *ppi); |
197 | extern void wlc_phy_watchdog(struct brcms_phy_pub *ppi); | 197 | int wlc_phy_down(struct brcms_phy_pub *ppi); |
198 | extern int wlc_phy_down(struct brcms_phy_pub *ppi); | 198 | u32 wlc_phy_clk_bwbits(struct brcms_phy_pub *pih); |
199 | extern u32 wlc_phy_clk_bwbits(struct brcms_phy_pub *pih); | 199 | void wlc_phy_cal_init(struct brcms_phy_pub *ppi); |
200 | extern void wlc_phy_cal_init(struct brcms_phy_pub *ppi); | 200 | void wlc_phy_antsel_init(struct brcms_phy_pub *ppi, bool lut_init); |
201 | extern void wlc_phy_antsel_init(struct brcms_phy_pub *ppi, bool lut_init); | 201 | |
202 | 202 | void wlc_phy_chanspec_set(struct brcms_phy_pub *ppi, u16 chanspec); | |
203 | extern void wlc_phy_chanspec_set(struct brcms_phy_pub *ppi, | 203 | u16 wlc_phy_chanspec_get(struct brcms_phy_pub *ppi); |
204 | u16 chanspec); | 204 | void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, u16 newch); |
205 | extern u16 wlc_phy_chanspec_get(struct brcms_phy_pub *ppi); | 205 | u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi); |
206 | extern void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, | 206 | void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw); |
207 | u16 newch); | 207 | |
208 | extern u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi); | 208 | int wlc_phy_rssi_compute(struct brcms_phy_pub *pih, struct d11rxhdr *rxh); |
209 | extern void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw); | 209 | void wlc_phy_por_inform(struct brcms_phy_pub *ppi); |
210 | 210 | void wlc_phy_noise_sample_intr(struct brcms_phy_pub *ppi); | |
211 | extern int wlc_phy_rssi_compute(struct brcms_phy_pub *pih, | 211 | bool wlc_phy_bist_check_phy(struct brcms_phy_pub *ppi); |
212 | struct d11rxhdr *rxh); | 212 | |
213 | extern void wlc_phy_por_inform(struct brcms_phy_pub *ppi); | 213 | void wlc_phy_set_deaf(struct brcms_phy_pub *ppi, bool user_flag); |
214 | extern void wlc_phy_noise_sample_intr(struct brcms_phy_pub *ppi); | 214 | |
215 | extern bool wlc_phy_bist_check_phy(struct brcms_phy_pub *ppi); | 215 | void wlc_phy_switch_radio(struct brcms_phy_pub *ppi, bool on); |
216 | 216 | void wlc_phy_anacore(struct brcms_phy_pub *ppi, bool on); | |
217 | extern void wlc_phy_set_deaf(struct brcms_phy_pub *ppi, bool user_flag); | 217 | |
218 | 218 | ||
219 | extern void wlc_phy_switch_radio(struct brcms_phy_pub *ppi, bool on); | 219 | void wlc_phy_BSSinit(struct brcms_phy_pub *ppi, bool bonlyap, int rssi); |
220 | extern void wlc_phy_anacore(struct brcms_phy_pub *ppi, bool on); | 220 | |
221 | 221 | void wlc_phy_chanspec_ch14_widefilter_set(struct brcms_phy_pub *ppi, | |
222 | 222 | bool wide_filter); | |
223 | extern void wlc_phy_BSSinit(struct brcms_phy_pub *ppi, bool bonlyap, int rssi); | 223 | void wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band, |
224 | 224 | struct brcms_chanvec *channels); | |
225 | extern void wlc_phy_chanspec_ch14_widefilter_set(struct brcms_phy_pub *ppi, | 225 | u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band); |
226 | bool wide_filter); | 226 | |
227 | extern void wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band, | 227 | void wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint chan, u8 *_min_, |
228 | struct brcms_chanvec *channels); | 228 | u8 *_max_, int rate); |
229 | extern u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, | 229 | void wlc_phy_txpower_sromlimit_max_get(struct brcms_phy_pub *ppi, uint chan, |
230 | uint band); | 230 | u8 *_max_, u8 *_min_); |
231 | 231 | void wlc_phy_txpower_boardlimit_band(struct brcms_phy_pub *ppi, uint band, | |
232 | extern void wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint chan, | 232 | s32 *, s32 *, u32 *); |
233 | u8 *_min_, u8 *_max_, int rate); | 233 | void wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, struct txpwr_limits *, |
234 | extern void wlc_phy_txpower_sromlimit_max_get(struct brcms_phy_pub *ppi, | 234 | u16 chanspec); |
235 | uint chan, u8 *_max_, u8 *_min_); | 235 | int wlc_phy_txpower_get(struct brcms_phy_pub *ppi, uint *qdbm, bool *override); |
236 | extern void wlc_phy_txpower_boardlimit_band(struct brcms_phy_pub *ppi, | 236 | int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override); |
237 | uint band, s32 *, s32 *, u32 *); | 237 | void wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi, |
238 | extern void wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, | 238 | struct txpwr_limits *); |
239 | struct txpwr_limits *, | 239 | bool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi); |
240 | u16 chanspec); | 240 | void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, bool hwpwrctrl); |
241 | extern int wlc_phy_txpower_get(struct brcms_phy_pub *ppi, uint *qdbm, | 241 | u8 wlc_phy_txpower_get_target_min(struct brcms_phy_pub *ppi); |
242 | bool *override); | 242 | u8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi); |
243 | extern int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, | 243 | bool wlc_phy_txpower_ipa_ison(struct brcms_phy_pub *pih); |
244 | bool override); | 244 | |
245 | extern void wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi, | 245 | void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain); |
246 | struct txpwr_limits *); | 246 | void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain); |
247 | extern bool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi); | 247 | void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, u8 *rxchain); |
248 | extern void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, | 248 | u8 wlc_phy_stf_chain_active_get(struct brcms_phy_pub *pih); |
249 | bool hwpwrctrl); | 249 | s8 wlc_phy_stf_ssmode_get(struct brcms_phy_pub *pih, u16 chanspec); |
250 | extern u8 wlc_phy_txpower_get_target_min(struct brcms_phy_pub *ppi); | 250 | void wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool val); |
251 | extern u8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi); | 251 | |
252 | extern bool wlc_phy_txpower_ipa_ison(struct brcms_phy_pub *pih); | 252 | void wlc_phy_cal_perical(struct brcms_phy_pub *ppi, u8 reason); |
253 | 253 | void wlc_phy_noise_sample_request_external(struct brcms_phy_pub *ppi); | |
254 | extern void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, | 254 | void wlc_phy_edcrs_lock(struct brcms_phy_pub *pih, bool lock); |
255 | u8 rxchain); | 255 | void wlc_phy_cal_papd_recal(struct brcms_phy_pub *ppi); |
256 | extern void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, | 256 | |
257 | u8 rxchain); | 257 | void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val); |
258 | extern void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, | 258 | void wlc_phy_clear_tssi(struct brcms_phy_pub *ppi); |
259 | u8 *rxchain); | 259 | void wlc_phy_hold_upd(struct brcms_phy_pub *ppi, u32 id, bool val); |
260 | extern u8 wlc_phy_stf_chain_active_get(struct brcms_phy_pub *pih); | 260 | void wlc_phy_mute_upd(struct brcms_phy_pub *ppi, bool val, u32 flags); |
261 | extern s8 wlc_phy_stf_ssmode_get(struct brcms_phy_pub *pih, | 261 | |
262 | u16 chanspec); | 262 | void wlc_phy_antsel_type_set(struct brcms_phy_pub *ppi, u8 antsel_type); |
263 | extern void wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool val); | 263 | |
264 | 264 | void wlc_phy_txpower_get_current(struct brcms_phy_pub *ppi, | |
265 | extern void wlc_phy_cal_perical(struct brcms_phy_pub *ppi, u8 reason); | 265 | struct tx_power *power, uint channel); |
266 | extern void wlc_phy_noise_sample_request_external(struct brcms_phy_pub *ppi); | 266 | |
267 | extern void wlc_phy_edcrs_lock(struct brcms_phy_pub *pih, bool lock); | 267 | void wlc_phy_initcal_enable(struct brcms_phy_pub *pih, bool initcal); |
268 | extern void wlc_phy_cal_papd_recal(struct brcms_phy_pub *ppi); | 268 | bool wlc_phy_test_ison(struct brcms_phy_pub *ppi); |
269 | 269 | void wlc_phy_txpwr_percent_set(struct brcms_phy_pub *ppi, u8 txpwr_percent); | |
270 | extern void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val); | 270 | void wlc_phy_ofdm_rateset_war(struct brcms_phy_pub *pih, bool war); |
271 | extern void wlc_phy_clear_tssi(struct brcms_phy_pub *ppi); | 271 | void wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, bool bf_preempt); |
272 | extern void wlc_phy_hold_upd(struct brcms_phy_pub *ppi, u32 id, bool val); | 272 | void wlc_phy_machwcap_set(struct brcms_phy_pub *ppi, u32 machwcap); |
273 | extern void wlc_phy_mute_upd(struct brcms_phy_pub *ppi, bool val, u32 flags); | 273 | |
274 | 274 | void wlc_phy_runbist_config(struct brcms_phy_pub *ppi, bool start_end); | |
275 | extern void wlc_phy_antsel_type_set(struct brcms_phy_pub *ppi, u8 antsel_type); | 275 | |
276 | 276 | void wlc_phy_freqtrack_start(struct brcms_phy_pub *ppi); | |
277 | extern void wlc_phy_txpower_get_current(struct brcms_phy_pub *ppi, | 277 | void wlc_phy_freqtrack_end(struct brcms_phy_pub *ppi); |
278 | struct tx_power *power, uint channel); | 278 | |
279 | 279 | const u8 *wlc_phy_get_ofdm_rate_lookup(void); | |
280 | extern void wlc_phy_initcal_enable(struct brcms_phy_pub *pih, bool initcal); | 280 | |
281 | extern bool wlc_phy_test_ison(struct brcms_phy_pub *ppi); | 281 | s8 wlc_phy_get_tx_power_offset_by_mcs(struct brcms_phy_pub *ppi, |
282 | extern void wlc_phy_txpwr_percent_set(struct brcms_phy_pub *ppi, | 282 | u8 mcs_offset); |
283 | u8 txpwr_percent); | 283 | s8 wlc_phy_get_tx_power_offset(struct brcms_phy_pub *ppi, u8 tbl_offset); |
284 | extern void wlc_phy_ofdm_rateset_war(struct brcms_phy_pub *pih, bool war); | ||
285 | extern void wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, | ||
286 | bool bf_preempt); | ||
287 | extern void wlc_phy_machwcap_set(struct brcms_phy_pub *ppi, u32 machwcap); | ||
288 | |||
289 | extern void wlc_phy_runbist_config(struct brcms_phy_pub *ppi, bool start_end); | ||
290 | |||
291 | extern void wlc_phy_freqtrack_start(struct brcms_phy_pub *ppi); | ||
292 | extern void wlc_phy_freqtrack_end(struct brcms_phy_pub *ppi); | ||
293 | |||
294 | extern const u8 *wlc_phy_get_ofdm_rate_lookup(void); | ||
295 | |||
296 | extern s8 wlc_phy_get_tx_power_offset_by_mcs(struct brcms_phy_pub *ppi, | ||
297 | u8 mcs_offset); | ||
298 | extern s8 wlc_phy_get_tx_power_offset(struct brcms_phy_pub *ppi, u8 tbl_offset); | ||
299 | #endif /* _BRCM_PHY_HAL_H_ */ | 284 | #endif /* _BRCM_PHY_HAL_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h index 1dc767c31653..4960f7d26804 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h | |||
@@ -910,113 +910,103 @@ struct lcnphy_radio_regs { | |||
910 | u8 do_init_g; | 910 | u8 do_init_g; |
911 | }; | 911 | }; |
912 | 912 | ||
913 | extern u16 read_phy_reg(struct brcms_phy *pi, u16 addr); | 913 | u16 read_phy_reg(struct brcms_phy *pi, u16 addr); |
914 | extern void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); | 914 | void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); |
915 | extern void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); | 915 | void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); |
916 | extern void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); | 916 | void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); |
917 | extern void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val); | 917 | void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val); |
918 | 918 | ||
919 | extern u16 read_radio_reg(struct brcms_phy *pi, u16 addr); | 919 | u16 read_radio_reg(struct brcms_phy *pi, u16 addr); |
920 | extern void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); | 920 | void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); |
921 | extern void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); | 921 | void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); |
922 | extern void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, | 922 | void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val); |
923 | u16 val); | 923 | void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask); |
924 | extern void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask); | 924 | |
925 | 925 | void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); | |
926 | extern void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); | 926 | |
927 | 927 | void wlc_phyreg_enter(struct brcms_phy_pub *pih); | |
928 | extern void wlc_phyreg_enter(struct brcms_phy_pub *pih); | 928 | void wlc_phyreg_exit(struct brcms_phy_pub *pih); |
929 | extern void wlc_phyreg_exit(struct brcms_phy_pub *pih); | 929 | void wlc_radioreg_enter(struct brcms_phy_pub *pih); |
930 | extern void wlc_radioreg_enter(struct brcms_phy_pub *pih); | 930 | void wlc_radioreg_exit(struct brcms_phy_pub *pih); |
931 | extern void wlc_radioreg_exit(struct brcms_phy_pub *pih); | 931 | |
932 | 932 | void wlc_phy_read_table(struct brcms_phy *pi, | |
933 | extern void wlc_phy_read_table(struct brcms_phy *pi, | 933 | const struct phytbl_info *ptbl_info, |
934 | const struct phytbl_info *ptbl_info, | 934 | u16 tblAddr, u16 tblDataHi, u16 tblDatalo); |
935 | u16 tblAddr, u16 tblDataHi, | 935 | void wlc_phy_write_table(struct brcms_phy *pi, |
936 | u16 tblDatalo); | 936 | const struct phytbl_info *ptbl_info, |
937 | extern void wlc_phy_write_table(struct brcms_phy *pi, | 937 | u16 tblAddr, u16 tblDataHi, u16 tblDatalo); |
938 | const struct phytbl_info *ptbl_info, | 938 | void wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset, |
939 | u16 tblAddr, u16 tblDataHi, u16 tblDatalo); | 939 | u16 tblAddr, u16 tblDataHi, u16 tblDataLo); |
940 | extern void wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, | 940 | void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val); |
941 | uint tbl_offset, u16 tblAddr, u16 tblDataHi, | 941 | |
942 | u16 tblDataLo); | 942 | void write_phy_channel_reg(struct brcms_phy *pi, uint val); |
943 | extern void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val); | 943 | void wlc_phy_txpower_update_shm(struct brcms_phy *pi); |
944 | 944 | ||
945 | extern void write_phy_channel_reg(struct brcms_phy *pi, uint val); | 945 | u8 wlc_phy_nbits(s32 value); |
946 | extern void wlc_phy_txpower_update_shm(struct brcms_phy *pi); | 946 | void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_dB, u8 core); |
947 | 947 | ||
948 | extern u8 wlc_phy_nbits(s32 value); | 948 | uint wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi, |
949 | extern void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_dB, u8 core); | 949 | struct radio_20xx_regs *radioregs); |
950 | 950 | uint wlc_phy_init_radio_regs(struct brcms_phy *pi, | |
951 | extern uint wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi, | 951 | const struct radio_regs *radioregs, |
952 | struct radio_20xx_regs *radioregs); | 952 | u16 core_offset); |
953 | extern uint wlc_phy_init_radio_regs(struct brcms_phy *pi, | 953 | |
954 | const struct radio_regs *radioregs, | 954 | void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi); |
955 | u16 core_offset); | 955 | |
956 | 956 | void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on); | |
957 | extern void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi); | 957 | void wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, s32 *eps_imag); |
958 | 958 | ||
959 | extern void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on); | 959 | void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi); |
960 | extern void wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, | 960 | void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi); |
961 | s32 *eps_imag); | 961 | |
962 | 962 | bool wlc_phy_attach_nphy(struct brcms_phy *pi); | |
963 | extern void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi); | 963 | bool wlc_phy_attach_lcnphy(struct brcms_phy *pi); |
964 | extern void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi); | 964 | |
965 | 965 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi); | |
966 | extern bool wlc_phy_attach_nphy(struct brcms_phy *pi); | 966 | |
967 | extern bool wlc_phy_attach_lcnphy(struct brcms_phy *pi); | 967 | void wlc_phy_init_nphy(struct brcms_phy *pi); |
968 | 968 | void wlc_phy_init_lcnphy(struct brcms_phy *pi); | |
969 | extern void wlc_phy_detach_lcnphy(struct brcms_phy *pi); | 969 | |
970 | 970 | void wlc_phy_cal_init_nphy(struct brcms_phy *pi); | |
971 | extern void wlc_phy_init_nphy(struct brcms_phy *pi); | 971 | void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi); |
972 | extern void wlc_phy_init_lcnphy(struct brcms_phy *pi); | 972 | |
973 | 973 | void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, u16 chanspec); | |
974 | extern void wlc_phy_cal_init_nphy(struct brcms_phy *pi); | 974 | void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec); |
975 | extern void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi); | 975 | void wlc_phy_chanspec_set_fixup_lcnphy(struct brcms_phy *pi, u16 chanspec); |
976 | 976 | int wlc_phy_channel2freq(uint channel); | |
977 | extern void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, | 977 | int wlc_phy_chanspec_freq2bandrange_lpssn(uint); |
978 | u16 chanspec); | 978 | int wlc_phy_chanspec_bandrange_get(struct brcms_phy *, u16 chanspec); |
979 | extern void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, | 979 | |
980 | u16 chanspec); | 980 | void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode); |
981 | extern void wlc_phy_chanspec_set_fixup_lcnphy(struct brcms_phy *pi, | 981 | s8 wlc_lcnphy_get_current_tx_pwr_idx(struct brcms_phy *pi); |
982 | u16 chanspec); | 982 | |
983 | extern int wlc_phy_channel2freq(uint channel); | 983 | void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi); |
984 | extern int wlc_phy_chanspec_freq2bandrange_lpssn(uint); | 984 | void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi); |
985 | extern int wlc_phy_chanspec_bandrange_get(struct brcms_phy *, u16 chanspec); | 985 | void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi); |
986 | 986 | ||
987 | extern void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode); | 987 | void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index); |
988 | extern s8 wlc_lcnphy_get_current_tx_pwr_idx(struct brcms_phy *pi); | 988 | void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable); |
989 | 989 | void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi); | |
990 | extern void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi); | 990 | void wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val, |
991 | extern void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi); | 991 | bool iqcalmode); |
992 | extern void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi); | 992 | |
993 | 993 | void wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan, | |
994 | extern void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index); | 994 | u8 *max_pwr, u8 rate_id); |
995 | extern void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable); | 995 | void wlc_phy_ofdm_to_mcs_powers_nphy(u8 *power, u8 rate_mcs_start, |
996 | extern void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi); | 996 | u8 rate_mcs_end, u8 rate_ofdm_start); |
997 | extern void wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, | 997 | void wlc_phy_mcs_to_ofdm_powers_nphy(u8 *power, u8 rate_ofdm_start, |
998 | u16 max_val, bool iqcalmode); | 998 | u8 rate_ofdm_end, u8 rate_mcs_start); |
999 | 999 | ||
1000 | extern void wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan, | 1000 | u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode); |
1001 | u8 *max_pwr, u8 rate_id); | 1001 | s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode); |
1002 | extern void wlc_phy_ofdm_to_mcs_powers_nphy(u8 *power, u8 rate_mcs_start, | 1002 | s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode); |
1003 | u8 rate_mcs_end, | 1003 | s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode); |
1004 | u8 rate_ofdm_start); | 1004 | void wlc_phy_carrier_suppress_lcnphy(struct brcms_phy *pi); |
1005 | extern void wlc_phy_mcs_to_ofdm_powers_nphy(u8 *power, | 1005 | void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel); |
1006 | u8 rate_ofdm_start, | 1006 | void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode); |
1007 | u8 rate_ofdm_end, | 1007 | void wlc_2064_vco_cal(struct brcms_phy *pi); |
1008 | u8 rate_mcs_start); | 1008 | |
1009 | 1009 | void wlc_phy_txpower_recalc_target(struct brcms_phy *pi); | |
1010 | extern u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode); | ||
1011 | extern s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode); | ||
1012 | extern s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode); | ||
1013 | extern s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode); | ||
1014 | extern void wlc_phy_carrier_suppress_lcnphy(struct brcms_phy *pi); | ||
1015 | extern void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel); | ||
1016 | extern void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode); | ||
1017 | extern void wlc_2064_vco_cal(struct brcms_phy *pi); | ||
1018 | |||
1019 | extern void wlc_phy_txpower_recalc_target(struct brcms_phy *pi); | ||
1020 | 1010 | ||
1021 | #define LCNPHY_TBL_ID_PAPDCOMPDELTATBL 0x18 | 1011 | #define LCNPHY_TBL_ID_PAPDCOMPDELTATBL 0x18 |
1022 | #define LCNPHY_TX_POWER_TABLE_SIZE 128 | 1012 | #define LCNPHY_TX_POWER_TABLE_SIZE 128 |
@@ -1030,26 +1020,24 @@ extern void wlc_phy_txpower_recalc_target(struct brcms_phy *pi); | |||
1030 | 1020 | ||
1031 | #define LCNPHY_TX_PWR_CTRL_TEMPBASED 0xE001 | 1021 | #define LCNPHY_TX_PWR_CTRL_TEMPBASED 0xE001 |
1032 | 1022 | ||
1033 | extern void wlc_lcnphy_write_table(struct brcms_phy *pi, | 1023 | void wlc_lcnphy_write_table(struct brcms_phy *pi, |
1034 | const struct phytbl_info *pti); | 1024 | const struct phytbl_info *pti); |
1035 | extern void wlc_lcnphy_read_table(struct brcms_phy *pi, | 1025 | void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti); |
1036 | struct phytbl_info *pti); | 1026 | void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b); |
1037 | extern void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b); | 1027 | void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq); |
1038 | extern void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq); | 1028 | void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b); |
1039 | extern void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b); | 1029 | u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi); |
1040 | extern u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi); | 1030 | void wlc_lcnphy_get_radio_loft(struct brcms_phy *pi, u8 *ei0, u8 *eq0, u8 *fi0, |
1041 | extern void wlc_lcnphy_get_radio_loft(struct brcms_phy *pi, u8 *ei0, | 1031 | u8 *fq0); |
1042 | u8 *eq0, u8 *fi0, u8 *fq0); | 1032 | void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode); |
1043 | extern void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode); | 1033 | void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode); |
1044 | extern void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode); | 1034 | bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi); |
1045 | extern bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi); | 1035 | void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi); |
1046 | extern void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi); | 1036 | s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1); |
1047 | extern s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1); | 1037 | void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr, s8 *cck_pwr); |
1048 | extern void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr, | 1038 | void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi); |
1049 | s8 *cck_pwr); | 1039 | |
1050 | extern void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi); | 1040 | s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index); |
1051 | |||
1052 | extern s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index); | ||
1053 | 1041 | ||
1054 | #define NPHY_MAX_HPVGA1_INDEX 10 | 1042 | #define NPHY_MAX_HPVGA1_INDEX 10 |
1055 | #define NPHY_DEF_HPVGA1_INDEXLIMIT 7 | 1043 | #define NPHY_DEF_HPVGA1_INDEXLIMIT 7 |
@@ -1060,9 +1048,8 @@ struct phy_iq_est { | |||
1060 | u32 q_pwr; | 1048 | u32 q_pwr; |
1061 | }; | 1049 | }; |
1062 | 1050 | ||
1063 | extern void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi, | 1051 | void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi, bool enable); |
1064 | bool enable); | 1052 | void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode); |
1065 | extern void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode); | ||
1066 | 1053 | ||
1067 | #define wlc_phy_write_table_nphy(pi, pti) \ | 1054 | #define wlc_phy_write_table_nphy(pi, pti) \ |
1068 | wlc_phy_write_table(pi, pti, 0x72, 0x74, 0x73) | 1055 | wlc_phy_write_table(pi, pti, 0x72, 0x74, 0x73) |
@@ -1076,10 +1063,10 @@ extern void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode); | |||
1076 | #define wlc_nphy_table_data_write(pi, w, v) \ | 1063 | #define wlc_nphy_table_data_write(pi, w, v) \ |
1077 | wlc_phy_table_data_write((pi), (w), (v)) | 1064 | wlc_phy_table_data_write((pi), (w), (v)) |
1078 | 1065 | ||
1079 | extern void wlc_phy_table_read_nphy(struct brcms_phy *pi, u32, u32 l, u32 o, | 1066 | void wlc_phy_table_read_nphy(struct brcms_phy *pi, u32, u32 l, u32 o, u32 w, |
1080 | u32 w, void *d); | 1067 | void *d); |
1081 | extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32, | 1068 | void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32, u32, |
1082 | u32, const void *); | 1069 | const void *); |
1083 | 1070 | ||
1084 | #define PHY_IPA(pi) \ | 1071 | #define PHY_IPA(pi) \ |
1085 | ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \ | 1072 | ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \ |
@@ -1089,73 +1076,67 @@ extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32, | |||
1089 | if (NREV_LT((pi)->pubpi.phy_rev, 3)) \ | 1076 | if (NREV_LT((pi)->pubpi.phy_rev, 3)) \ |
1090 | (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) | 1077 | (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) |
1091 | 1078 | ||
1092 | extern void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype); | 1079 | void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype); |
1093 | extern void wlc_phy_aci_reset_nphy(struct brcms_phy *pi); | 1080 | void wlc_phy_aci_reset_nphy(struct brcms_phy *pi); |
1094 | extern void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en); | 1081 | void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en); |
1095 | 1082 | ||
1096 | extern u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint chan); | 1083 | u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint chan); |
1097 | extern void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on); | 1084 | void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on); |
1098 | 1085 | ||
1099 | extern void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi); | 1086 | void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi); |
1100 | 1087 | ||
1101 | extern void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd); | 1088 | void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd); |
1102 | extern s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi); | 1089 | s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi); |
1103 | 1090 | ||
1104 | extern u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val); | 1091 | u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val); |
1105 | 1092 | ||
1106 | extern void wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est, | 1093 | void wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est, |
1107 | u16 num_samps, u8 wait_time, | 1094 | u16 num_samps, u8 wait_time, u8 wait_for_crs); |
1108 | u8 wait_for_crs); | 1095 | |
1109 | 1096 | void wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write, | |
1110 | extern void wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write, | 1097 | struct nphy_iq_comp *comp); |
1111 | struct nphy_iq_comp *comp); | 1098 | void wlc_phy_aci_and_noise_reduction_nphy(struct brcms_phy *pi); |
1112 | extern void wlc_phy_aci_and_noise_reduction_nphy(struct brcms_phy *pi); | 1099 | |
1113 | 1100 | void wlc_phy_rxcore_setstate_nphy(struct brcms_phy_pub *pih, u8 rxcore_bitmask); | |
1114 | extern void wlc_phy_rxcore_setstate_nphy(struct brcms_phy_pub *pih, | 1101 | u8 wlc_phy_rxcore_getstate_nphy(struct brcms_phy_pub *pih); |
1115 | u8 rxcore_bitmask); | 1102 | |
1116 | extern u8 wlc_phy_rxcore_getstate_nphy(struct brcms_phy_pub *pih); | 1103 | void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type); |
1117 | 1104 | void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi); | |
1118 | extern void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type); | 1105 | void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi); |
1119 | extern void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi); | 1106 | void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi); |
1120 | extern void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi); | 1107 | u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi); |
1121 | extern void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi); | 1108 | |
1122 | extern u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi); | 1109 | struct nphy_txgains wlc_phy_get_tx_gain_nphy(struct brcms_phy *pi); |
1123 | 1110 | int wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi, | |
1124 | extern struct nphy_txgains wlc_phy_get_tx_gain_nphy(struct brcms_phy *pi); | 1111 | struct nphy_txgains target_gain, bool full, bool m); |
1125 | extern int wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi, | 1112 | int wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain, |
1126 | struct nphy_txgains target_gain, | 1113 | u8 type, bool d); |
1127 | bool full, bool m); | 1114 | void wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, |
1128 | extern int wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, | 1115 | s8 txpwrindex, bool res); |
1129 | struct nphy_txgains target_gain, | 1116 | void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core, u8 rssi_type); |
1130 | u8 type, bool d); | 1117 | int wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, |
1131 | extern void wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, | 1118 | s32 *rssi_buf, u8 nsamps); |
1132 | s8 txpwrindex, bool res); | 1119 | void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi); |
1133 | extern void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core, u8 rssi_type); | 1120 | int wlc_phy_aci_scan_nphy(struct brcms_phy *pi); |
1134 | extern int wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, | 1121 | void wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi, s32 dBm_targetpower, |
1135 | s32 *rssi_buf, u8 nsamps); | 1122 | bool debug); |
1136 | extern void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi); | 1123 | int wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, u8 mode, |
1137 | extern int wlc_phy_aci_scan_nphy(struct brcms_phy *pi); | 1124 | u8, bool); |
1138 | extern void wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi, | 1125 | void wlc_phy_stopplayback_nphy(struct brcms_phy *pi); |
1139 | s32 dBm_targetpower, bool debug); | 1126 | void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf, |
1140 | extern int wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, | 1127 | u8 num_samps); |
1141 | u8 mode, u8, bool); | 1128 | void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi); |
1142 | extern void wlc_phy_stopplayback_nphy(struct brcms_phy *pi); | 1129 | |
1143 | extern void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf, | 1130 | int wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct d11rxhdr *rxh); |
1144 | u8 num_samps); | ||
1145 | extern void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi); | ||
1146 | |||
1147 | extern int wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, | ||
1148 | struct d11rxhdr *rxh); | ||
1149 | 1131 | ||
1150 | #define NPHY_TESTPATTERN_BPHY_EVM 0 | 1132 | #define NPHY_TESTPATTERN_BPHY_EVM 0 |
1151 | #define NPHY_TESTPATTERN_BPHY_RFCS 1 | 1133 | #define NPHY_TESTPATTERN_BPHY_RFCS 1 |
1152 | 1134 | ||
1153 | extern void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs); | 1135 | void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs); |
1154 | 1136 | ||
1155 | void wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset, | 1137 | void wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset, |
1156 | s8 *ofdmoffset); | 1138 | s8 *ofdmoffset); |
1157 | extern s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi, | 1139 | s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi, u16 chanspec); |
1158 | u16 chanspec); | ||
1159 | 1140 | ||
1160 | extern bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pih); | 1141 | bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pih); |
1161 | #endif /* _BRCM_PHY_INT_H_ */ | 1142 | #endif /* _BRCM_PHY_INT_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h b/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h index 2c5b66b75970..dd8774717ade 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h | |||
@@ -124,56 +124,49 @@ | |||
124 | 124 | ||
125 | struct brcms_phy; | 125 | struct brcms_phy; |
126 | 126 | ||
127 | extern struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw, | 127 | struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw, |
128 | struct brcms_info *wl, | 128 | struct brcms_info *wl, |
129 | struct brcms_c_info *wlc); | 129 | struct brcms_c_info *wlc); |
130 | extern void wlc_phy_shim_detach(struct phy_shim_info *physhim); | 130 | void wlc_phy_shim_detach(struct phy_shim_info *physhim); |
131 | 131 | ||
132 | /* PHY to WL utility functions */ | 132 | /* PHY to WL utility functions */ |
133 | extern struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim, | 133 | struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim, |
134 | void (*fn) (struct brcms_phy *pi), | 134 | void (*fn)(struct brcms_phy *pi), |
135 | void *arg, const char *name); | 135 | void *arg, const char *name); |
136 | extern void wlapi_free_timer(struct wlapi_timer *t); | 136 | void wlapi_free_timer(struct wlapi_timer *t); |
137 | extern void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic); | 137 | void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic); |
138 | extern bool wlapi_del_timer(struct wlapi_timer *t); | 138 | bool wlapi_del_timer(struct wlapi_timer *t); |
139 | extern void wlapi_intrson(struct phy_shim_info *physhim); | 139 | void wlapi_intrson(struct phy_shim_info *physhim); |
140 | extern u32 wlapi_intrsoff(struct phy_shim_info *physhim); | 140 | u32 wlapi_intrsoff(struct phy_shim_info *physhim); |
141 | extern void wlapi_intrsrestore(struct phy_shim_info *physhim, | 141 | void wlapi_intrsrestore(struct phy_shim_info *physhim, u32 macintmask); |
142 | u32 macintmask); | 142 | |
143 | 143 | void wlapi_bmac_write_shm(struct phy_shim_info *physhim, uint offset, u16 v); | |
144 | extern void wlapi_bmac_write_shm(struct phy_shim_info *physhim, uint offset, | 144 | u16 wlapi_bmac_read_shm(struct phy_shim_info *physhim, uint offset); |
145 | u16 v); | 145 | void wlapi_bmac_mhf(struct phy_shim_info *physhim, u8 idx, u16 mask, u16 val, |
146 | extern u16 wlapi_bmac_read_shm(struct phy_shim_info *physhim, uint offset); | 146 | int bands); |
147 | extern void wlapi_bmac_mhf(struct phy_shim_info *physhim, u8 idx, | 147 | void wlapi_bmac_corereset(struct phy_shim_info *physhim, u32 flags); |
148 | u16 mask, u16 val, int bands); | 148 | void wlapi_suspend_mac_and_wait(struct phy_shim_info *physhim); |
149 | extern void wlapi_bmac_corereset(struct phy_shim_info *physhim, u32 flags); | 149 | void wlapi_switch_macfreq(struct phy_shim_info *physhim, u8 spurmode); |
150 | extern void wlapi_suspend_mac_and_wait(struct phy_shim_info *physhim); | 150 | void wlapi_enable_mac(struct phy_shim_info *physhim); |
151 | extern void wlapi_switch_macfreq(struct phy_shim_info *physhim, u8 spurmode); | 151 | void wlapi_bmac_mctrl(struct phy_shim_info *physhim, u32 mask, u32 val); |
152 | extern void wlapi_enable_mac(struct phy_shim_info *physhim); | 152 | void wlapi_bmac_phy_reset(struct phy_shim_info *physhim); |
153 | extern void wlapi_bmac_mctrl(struct phy_shim_info *physhim, u32 mask, | 153 | void wlapi_bmac_bw_set(struct phy_shim_info *physhim, u16 bw); |
154 | u32 val); | 154 | void wlapi_bmac_phyclk_fgc(struct phy_shim_info *physhim, bool clk); |
155 | extern void wlapi_bmac_phy_reset(struct phy_shim_info *physhim); | 155 | void wlapi_bmac_macphyclk_set(struct phy_shim_info *physhim, bool clk); |
156 | extern void wlapi_bmac_bw_set(struct phy_shim_info *physhim, u16 bw); | 156 | void wlapi_bmac_core_phypll_ctl(struct phy_shim_info *physhim, bool on); |
157 | extern void wlapi_bmac_phyclk_fgc(struct phy_shim_info *physhim, bool clk); | 157 | void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim); |
158 | extern void wlapi_bmac_macphyclk_set(struct phy_shim_info *physhim, bool clk); | 158 | void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info *physhim); |
159 | extern void wlapi_bmac_core_phypll_ctl(struct phy_shim_info *physhim, bool on); | 159 | void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info *physhim); |
160 | extern void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim); | 160 | void wlapi_bmac_write_template_ram(struct phy_shim_info *physhim, int o, |
161 | extern void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info * | 161 | int len, void *buf); |
162 | physhim); | 162 | u16 wlapi_bmac_rate_shm_offset(struct phy_shim_info *physhim, u8 rate); |
163 | extern void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info * | 163 | void wlapi_ucode_sample_init(struct phy_shim_info *physhim); |
164 | physhim); | 164 | void wlapi_copyfrom_objmem(struct phy_shim_info *physhim, uint, void *buf, |
165 | extern void wlapi_bmac_write_template_ram(struct phy_shim_info *physhim, int o, | 165 | int, u32 sel); |
166 | int len, void *buf); | 166 | void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, const void *buf, |
167 | extern u16 wlapi_bmac_rate_shm_offset(struct phy_shim_info *physhim, | 167 | int, u32); |
168 | u8 rate); | 168 | |
169 | extern void wlapi_ucode_sample_init(struct phy_shim_info *physhim); | 169 | void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, u32 phy_mode); |
170 | extern void wlapi_copyfrom_objmem(struct phy_shim_info *physhim, uint, | 170 | u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); |
171 | void *buf, int, u32 sel); | ||
172 | extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, | ||
173 | const void *buf, int, u32); | ||
174 | |||
175 | extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, | ||
176 | u32 phy_mode); | ||
177 | extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); | ||
178 | 171 | ||
179 | #endif /* _BRCM_PHY_SHIM_H_ */ | 172 | #endif /* _BRCM_PHY_SHIM_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h index 20e2012d5a3a..a014bbc4f935 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #include "types.h" | 21 | #include "types.h" |
22 | 22 | ||
23 | extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih); | 23 | u16 si_pmu_fast_pwrup_delay(struct si_pub *sih); |
24 | extern u32 si_pmu_measure_alpclk(struct si_pub *sih); | 24 | u32 si_pmu_measure_alpclk(struct si_pub *sih); |
25 | 25 | ||
26 | #endif /* _BRCM_PMU_H_ */ | 26 | #endif /* _BRCM_PMU_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h index d36ea5e1cc49..4da38cb4f318 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h | |||
@@ -266,83 +266,76 @@ struct brcms_antselcfg { | |||
266 | }; | 266 | }; |
267 | 267 | ||
268 | /* common functions for every port */ | 268 | /* common functions for every port */ |
269 | extern struct brcms_c_info * | 269 | struct brcms_c_info *brcms_c_attach(struct brcms_info *wl, |
270 | brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit, | 270 | struct bcma_device *core, uint unit, |
271 | bool piomode, uint *perr); | 271 | bool piomode, uint *perr); |
272 | extern uint brcms_c_detach(struct brcms_c_info *wlc); | 272 | uint brcms_c_detach(struct brcms_c_info *wlc); |
273 | extern int brcms_c_up(struct brcms_c_info *wlc); | 273 | int brcms_c_up(struct brcms_c_info *wlc); |
274 | extern uint brcms_c_down(struct brcms_c_info *wlc); | 274 | uint brcms_c_down(struct brcms_c_info *wlc); |
275 | 275 | ||
276 | extern bool brcms_c_chipmatch(struct bcma_device *core); | 276 | bool brcms_c_chipmatch(struct bcma_device *core); |
277 | extern void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx); | 277 | void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx); |
278 | extern void brcms_c_reset(struct brcms_c_info *wlc); | 278 | void brcms_c_reset(struct brcms_c_info *wlc); |
279 | 279 | ||
280 | extern void brcms_c_intrson(struct brcms_c_info *wlc); | 280 | void brcms_c_intrson(struct brcms_c_info *wlc); |
281 | extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc); | 281 | u32 brcms_c_intrsoff(struct brcms_c_info *wlc); |
282 | extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask); | 282 | void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask); |
283 | extern bool brcms_c_intrsupd(struct brcms_c_info *wlc); | 283 | bool brcms_c_intrsupd(struct brcms_c_info *wlc); |
284 | extern bool brcms_c_isr(struct brcms_c_info *wlc); | 284 | bool brcms_c_isr(struct brcms_c_info *wlc); |
285 | extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded); | 285 | bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded); |
286 | extern bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, | 286 | bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, |
287 | struct sk_buff *sdu, | 287 | struct ieee80211_hw *hw); |
288 | struct ieee80211_hw *hw); | 288 | bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid); |
289 | extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid); | 289 | void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val); |
290 | extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, | 290 | int brcms_c_get_header_len(void); |
291 | int val); | 291 | void brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset, |
292 | extern int brcms_c_get_header_len(void); | 292 | const u8 *addr); |
293 | extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc, | 293 | void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, |
294 | int match_reg_offset, | 294 | const struct ieee80211_tx_queue_params *arg, |
295 | const u8 *addr); | 295 | bool suspend); |
296 | extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, | 296 | struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc); |
297 | const struct ieee80211_tx_queue_params *arg, | 297 | void brcms_c_ampdu_flush(struct brcms_c_info *wlc, struct ieee80211_sta *sta, |
298 | bool suspend); | 298 | u16 tid); |
299 | extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc); | 299 | void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, |
300 | extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, | 300 | u8 ba_wsize, uint max_rx_ampdu_bytes); |
301 | struct ieee80211_sta *sta, u16 tid); | 301 | int brcms_c_module_register(struct brcms_pub *pub, const char *name, |
302 | extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, | 302 | struct brcms_info *hdl, |
303 | u8 ba_wsize, uint max_rx_ampdu_bytes); | 303 | int (*down_fn)(void *handle)); |
304 | extern int brcms_c_module_register(struct brcms_pub *pub, | 304 | int brcms_c_module_unregister(struct brcms_pub *pub, const char *name, |
305 | const char *name, struct brcms_info *hdl, | 305 | struct brcms_info *hdl); |
306 | int (*down_fn)(void *handle)); | 306 | void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc); |
307 | extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name, | 307 | void brcms_c_enable_mac(struct brcms_c_info *wlc); |
308 | struct brcms_info *hdl); | 308 | void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state); |
309 | extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc); | 309 | void brcms_c_scan_start(struct brcms_c_info *wlc); |
310 | extern void brcms_c_enable_mac(struct brcms_c_info *wlc); | 310 | void brcms_c_scan_stop(struct brcms_c_info *wlc); |
311 | extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state); | 311 | int brcms_c_get_curband(struct brcms_c_info *wlc); |
312 | extern void brcms_c_scan_start(struct brcms_c_info *wlc); | 312 | int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel); |
313 | extern void brcms_c_scan_stop(struct brcms_c_info *wlc); | 313 | int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl); |
314 | extern int brcms_c_get_curband(struct brcms_c_info *wlc); | 314 | void brcms_c_get_current_rateset(struct brcms_c_info *wlc, |
315 | extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel); | ||
316 | extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl); | ||
317 | extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc, | ||
318 | struct brcm_rateset *currs); | 315 | struct brcm_rateset *currs); |
319 | extern int brcms_c_set_rateset(struct brcms_c_info *wlc, | 316 | int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs); |
320 | struct brcm_rateset *rs); | 317 | int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period); |
321 | extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period); | 318 | u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx); |
322 | extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx); | 319 | void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, |
323 | extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, | ||
324 | s8 sslot_override); | 320 | s8 sslot_override); |
325 | extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, | 321 | void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval); |
326 | u8 interval); | 322 | u64 brcms_c_tsf_get(struct brcms_c_info *wlc); |
327 | extern u64 brcms_c_tsf_get(struct brcms_c_info *wlc); | 323 | void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf); |
328 | extern void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf); | 324 | int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr); |
329 | extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr); | 325 | int brcms_c_get_tx_power(struct brcms_c_info *wlc); |
330 | extern int brcms_c_get_tx_power(struct brcms_c_info *wlc); | 326 | bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); |
331 | extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); | 327 | void brcms_c_mute(struct brcms_c_info *wlc, bool on); |
332 | extern void brcms_c_mute(struct brcms_c_info *wlc, bool on); | 328 | bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc); |
333 | extern bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc); | 329 | void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr); |
334 | extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr); | 330 | void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid, |
335 | extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, | 331 | u8 *ssid, size_t ssid_len); |
336 | const u8 *bssid, u8 *ssid, size_t ssid_len); | 332 | void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr); |
337 | extern void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr); | 333 | void brcms_c_update_beacon(struct brcms_c_info *wlc); |
338 | extern void brcms_c_update_beacon(struct brcms_c_info *wlc); | 334 | void brcms_c_set_new_beacon(struct brcms_c_info *wlc, struct sk_buff *beacon, |
339 | extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc, | 335 | u16 tim_offset, u16 dtim_period); |
340 | struct sk_buff *beacon, u16 tim_offset, | 336 | void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc, |
341 | u16 dtim_period); | 337 | struct sk_buff *probe_resp); |
342 | extern void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc, | 338 | void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable); |
343 | struct sk_buff *probe_resp); | 339 | void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, size_t ssid_len); |
344 | extern void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable); | ||
345 | extern void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, | ||
346 | size_t ssid_len); | ||
347 | 340 | ||
348 | #endif /* _BRCM_PUB_H_ */ | 341 | #endif /* _BRCM_PUB_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/rate.h b/drivers/net/wireless/brcm80211/brcmsmac/rate.h index 980d578825cc..5bb88b78ed64 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/rate.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/rate.h | |||
@@ -216,34 +216,30 @@ static inline u8 cck_phy2mac_rate(u8 signal) | |||
216 | 216 | ||
217 | /* sanitize, and sort a rateset with the basic bit(s) preserved, validate | 217 | /* sanitize, and sort a rateset with the basic bit(s) preserved, validate |
218 | * rateset */ | 218 | * rateset */ |
219 | extern bool | 219 | bool brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs, |
220 | brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs, | 220 | const struct brcms_c_rateset *hw_rs, |
221 | const struct brcms_c_rateset *hw_rs, | 221 | bool check_brate, u8 txstreams); |
222 | bool check_brate, u8 txstreams); | ||
223 | /* copy rateset src to dst as-is (no masking or sorting) */ | 222 | /* copy rateset src to dst as-is (no masking or sorting) */ |
224 | extern void brcms_c_rateset_copy(const struct brcms_c_rateset *src, | 223 | void brcms_c_rateset_copy(const struct brcms_c_rateset *src, |
225 | struct brcms_c_rateset *dst); | 224 | struct brcms_c_rateset *dst); |
226 | 225 | ||
227 | /* would be nice to have these documented ... */ | 226 | /* would be nice to have these documented ... */ |
228 | extern u32 brcms_c_compute_rspec(struct d11rxhdr *rxh, u8 *plcp); | 227 | u32 brcms_c_compute_rspec(struct d11rxhdr *rxh, u8 *plcp); |
229 | 228 | ||
230 | extern void brcms_c_rateset_filter(struct brcms_c_rateset *src, | 229 | void brcms_c_rateset_filter(struct brcms_c_rateset *src, |
231 | struct brcms_c_rateset *dst, bool basic_only, u8 rates, uint xmask, | 230 | struct brcms_c_rateset *dst, bool basic_only, |
232 | bool mcsallow); | 231 | u8 rates, uint xmask, bool mcsallow); |
233 | 232 | ||
234 | extern void | 233 | void brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt, |
235 | brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt, | 234 | const struct brcms_c_rateset *rs_hw, uint phy_type, |
236 | const struct brcms_c_rateset *rs_hw, uint phy_type, | 235 | int bandtype, bool cck_only, uint rate_mask, |
237 | int bandtype, bool cck_only, uint rate_mask, | 236 | bool mcsallow, u8 bw, u8 txstreams); |
238 | bool mcsallow, u8 bw, u8 txstreams); | 237 | |
239 | 238 | s16 brcms_c_rate_legacy_phyctl(uint rate); | |
240 | extern s16 brcms_c_rate_legacy_phyctl(uint rate); | 239 | |
241 | 240 | void brcms_c_rateset_mcs_upd(struct brcms_c_rateset *rs, u8 txstreams); | |
242 | extern void brcms_c_rateset_mcs_upd(struct brcms_c_rateset *rs, u8 txstreams); | 241 | void brcms_c_rateset_mcs_clear(struct brcms_c_rateset *rateset); |
243 | extern void brcms_c_rateset_mcs_clear(struct brcms_c_rateset *rateset); | 242 | void brcms_c_rateset_mcs_build(struct brcms_c_rateset *rateset, u8 txstreams); |
244 | extern void brcms_c_rateset_mcs_build(struct brcms_c_rateset *rateset, | 243 | void brcms_c_rateset_bw_mcs_filter(struct brcms_c_rateset *rateset, u8 bw); |
245 | u8 txstreams); | ||
246 | extern void brcms_c_rateset_bw_mcs_filter(struct brcms_c_rateset *rateset, | ||
247 | u8 bw); | ||
248 | 244 | ||
249 | #endif /* _BRCM_RATE_H_ */ | 245 | #endif /* _BRCM_RATE_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/stf.h b/drivers/net/wireless/brcm80211/brcmsmac/stf.h index 19f6580f69be..ba9493009a33 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/stf.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/stf.h | |||
@@ -19,24 +19,19 @@ | |||
19 | 19 | ||
20 | #include "types.h" | 20 | #include "types.h" |
21 | 21 | ||
22 | extern int brcms_c_stf_attach(struct brcms_c_info *wlc); | 22 | int brcms_c_stf_attach(struct brcms_c_info *wlc); |
23 | extern void brcms_c_stf_detach(struct brcms_c_info *wlc); | 23 | void brcms_c_stf_detach(struct brcms_c_info *wlc); |
24 | 24 | ||
25 | extern void brcms_c_tempsense_upd(struct brcms_c_info *wlc); | 25 | void brcms_c_tempsense_upd(struct brcms_c_info *wlc); |
26 | extern void brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, | 26 | void brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, |
27 | u16 *ss_algo_channel, | 27 | u16 *ss_algo_channel, u16 chanspec); |
28 | u16 chanspec); | 28 | int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band); |
29 | extern int brcms_c_stf_ss_update(struct brcms_c_info *wlc, | 29 | void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc); |
30 | struct brcms_band *band); | 30 | int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force); |
31 | extern void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc); | 31 | bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val); |
32 | extern int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, | 32 | void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc); |
33 | bool force); | 33 | void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc); |
34 | extern bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val); | 34 | u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, u32 rspec); |
35 | extern void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc); | 35 | u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, u32 rspec); |
36 | extern void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc); | ||
37 | extern u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, | ||
38 | u32 rspec); | ||
39 | extern u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, | ||
40 | u32 rspec); | ||
41 | 36 | ||
42 | #endif /* _BRCM_STF_H_ */ | 37 | #endif /* _BRCM_STF_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h b/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h index 18750a814b4f..c87dd89bcb78 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h | |||
@@ -43,16 +43,14 @@ struct brcms_ucode { | |||
43 | u32 *bcm43xx_bomminor; | 43 | u32 *bcm43xx_bomminor; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern int | 46 | int brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode); |
47 | brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode); | ||
48 | 47 | ||
49 | extern void brcms_ucode_data_free(struct brcms_ucode *ucode); | 48 | void brcms_ucode_data_free(struct brcms_ucode *ucode); |
50 | 49 | ||
51 | extern int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, | 50 | int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, unsigned int idx); |
52 | unsigned int idx); | 51 | int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, |
53 | extern int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, | 52 | unsigned int idx); |
54 | unsigned int idx); | 53 | void brcms_ucode_free_buf(void *); |
55 | extern void brcms_ucode_free_buf(void *); | 54 | int brcms_check_firmwares(struct brcms_info *wl); |
56 | extern int brcms_check_firmwares(struct brcms_info *wl); | ||
57 | 55 | ||
58 | #endif /* _BRCM_UCODE_H_ */ | 56 | #endif /* _BRCM_UCODE_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_d11.h b/drivers/net/wireless/brcm80211/include/brcmu_d11.h index 92623f02b1c0..8660a2cba098 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_d11.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_d11.h | |||
@@ -140,6 +140,6 @@ struct brcmu_d11inf { | |||
140 | void (*decchspec)(struct brcmu_chan *ch); | 140 | void (*decchspec)(struct brcmu_chan *ch); |
141 | }; | 141 | }; |
142 | 142 | ||
143 | extern void brcmu_d11_attach(struct brcmu_d11inf *d11inf); | 143 | void brcmu_d11_attach(struct brcmu_d11inf *d11inf); |
144 | 144 | ||
145 | #endif /* _BRCMU_CHANNELS_H_ */ | 145 | #endif /* _BRCMU_CHANNELS_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_utils.h b/drivers/net/wireless/brcm80211/include/brcmu_utils.h index 898cacb8d01d..8ba445b3fd72 100644 --- a/drivers/net/wireless/brcm80211/include/brcmu_utils.h +++ b/drivers/net/wireless/brcm80211/include/brcmu_utils.h | |||
@@ -114,31 +114,29 @@ static inline struct sk_buff *pktq_ppeek_tail(struct pktq *pq, int prec) | |||
114 | return skb_peek_tail(&pq->q[prec].skblist); | 114 | return skb_peek_tail(&pq->q[prec].skblist); |
115 | } | 115 | } |
116 | 116 | ||
117 | extern struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec, | 117 | struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec, struct sk_buff *p); |
118 | struct sk_buff *p); | 118 | struct sk_buff *brcmu_pktq_penq_head(struct pktq *pq, int prec, |
119 | extern struct sk_buff *brcmu_pktq_penq_head(struct pktq *pq, int prec, | 119 | struct sk_buff *p); |
120 | struct sk_buff *p); | 120 | struct sk_buff *brcmu_pktq_pdeq(struct pktq *pq, int prec); |
121 | extern struct sk_buff *brcmu_pktq_pdeq(struct pktq *pq, int prec); | 121 | struct sk_buff *brcmu_pktq_pdeq_tail(struct pktq *pq, int prec); |
122 | extern struct sk_buff *brcmu_pktq_pdeq_tail(struct pktq *pq, int prec); | 122 | struct sk_buff *brcmu_pktq_pdeq_match(struct pktq *pq, int prec, |
123 | extern struct sk_buff *brcmu_pktq_pdeq_match(struct pktq *pq, int prec, | 123 | bool (*match_fn)(struct sk_buff *p, |
124 | bool (*match_fn)(struct sk_buff *p, | 124 | void *arg), |
125 | void *arg), | 125 | void *arg); |
126 | void *arg); | ||
127 | 126 | ||
128 | /* packet primitives */ | 127 | /* packet primitives */ |
129 | extern struct sk_buff *brcmu_pkt_buf_get_skb(uint len); | 128 | struct sk_buff *brcmu_pkt_buf_get_skb(uint len); |
130 | extern void brcmu_pkt_buf_free_skb(struct sk_buff *skb); | 129 | void brcmu_pkt_buf_free_skb(struct sk_buff *skb); |
131 | 130 | ||
132 | /* Empty the queue at particular precedence level */ | 131 | /* Empty the queue at particular precedence level */ |
133 | /* callback function fn(pkt, arg) returns true if pkt belongs to if */ | 132 | /* callback function fn(pkt, arg) returns true if pkt belongs to if */ |
134 | extern void brcmu_pktq_pflush(struct pktq *pq, int prec, | 133 | void brcmu_pktq_pflush(struct pktq *pq, int prec, bool dir, |
135 | bool dir, bool (*fn)(struct sk_buff *, void *), void *arg); | 134 | bool (*fn)(struct sk_buff *, void *), void *arg); |
136 | 135 | ||
137 | /* operations on a set of precedences in packet queue */ | 136 | /* operations on a set of precedences in packet queue */ |
138 | 137 | ||
139 | extern int brcmu_pktq_mlen(struct pktq *pq, uint prec_bmp); | 138 | int brcmu_pktq_mlen(struct pktq *pq, uint prec_bmp); |
140 | extern struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp, | 139 | struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); |
141 | int *prec_out); | ||
142 | 140 | ||
143 | /* operations on packet queue as a whole */ | 141 | /* operations on packet queue as a whole */ |
144 | 142 | ||
@@ -167,11 +165,11 @@ static inline bool pktq_empty(struct pktq *pq) | |||
167 | return pq->len == 0; | 165 | return pq->len == 0; |
168 | } | 166 | } |
169 | 167 | ||
170 | extern void brcmu_pktq_init(struct pktq *pq, int num_prec, int max_len); | 168 | void brcmu_pktq_init(struct pktq *pq, int num_prec, int max_len); |
171 | /* prec_out may be NULL if caller is not interested in return value */ | 169 | /* prec_out may be NULL if caller is not interested in return value */ |
172 | extern struct sk_buff *brcmu_pktq_peek_tail(struct pktq *pq, int *prec_out); | 170 | struct sk_buff *brcmu_pktq_peek_tail(struct pktq *pq, int *prec_out); |
173 | extern void brcmu_pktq_flush(struct pktq *pq, bool dir, | 171 | void brcmu_pktq_flush(struct pktq *pq, bool dir, |
174 | bool (*fn)(struct sk_buff *, void *), void *arg); | 172 | bool (*fn)(struct sk_buff *, void *), void *arg); |
175 | 173 | ||
176 | /* externs */ | 174 | /* externs */ |
177 | /* ip address */ | 175 | /* ip address */ |
@@ -204,13 +202,13 @@ static inline u16 brcmu_maskget16(u16 var, u16 mask, u8 shift) | |||
204 | /* externs */ | 202 | /* externs */ |
205 | /* format/print */ | 203 | /* format/print */ |
206 | #ifdef DEBUG | 204 | #ifdef DEBUG |
207 | extern void brcmu_prpkt(const char *msg, struct sk_buff *p0); | 205 | void brcmu_prpkt(const char *msg, struct sk_buff *p0); |
208 | #else | 206 | #else |
209 | #define brcmu_prpkt(a, b) | 207 | #define brcmu_prpkt(a, b) |
210 | #endif /* DEBUG */ | 208 | #endif /* DEBUG */ |
211 | 209 | ||
212 | #ifdef DEBUG | 210 | #ifdef DEBUG |
213 | extern __printf(3, 4) | 211 | __printf(3, 4) |
214 | void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...); | 212 | void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...); |
215 | #else | 213 | #else |
216 | __printf(3, 4) | 214 | __printf(3, 4) |
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h index 6eede52ad8c0..5ce2f59d3378 100644 --- a/drivers/net/wireless/ipw2x00/libipw.h +++ b/drivers/net/wireless/ipw2x00/libipw.h | |||
@@ -950,66 +950,55 @@ static inline int libipw_is_cck_rate(u8 rate) | |||
950 | } | 950 | } |
951 | 951 | ||
952 | /* libipw.c */ | 952 | /* libipw.c */ |
953 | extern void free_libipw(struct net_device *dev, int monitor); | 953 | void free_libipw(struct net_device *dev, int monitor); |
954 | extern struct net_device *alloc_libipw(int sizeof_priv, int monitor); | 954 | struct net_device *alloc_libipw(int sizeof_priv, int monitor); |
955 | extern int libipw_change_mtu(struct net_device *dev, int new_mtu); | 955 | int libipw_change_mtu(struct net_device *dev, int new_mtu); |
956 | 956 | ||
957 | extern void libipw_networks_age(struct libipw_device *ieee, | 957 | void libipw_networks_age(struct libipw_device *ieee, unsigned long age_secs); |
958 | unsigned long age_secs); | ||
959 | 958 | ||
960 | extern int libipw_set_encryption(struct libipw_device *ieee); | 959 | int libipw_set_encryption(struct libipw_device *ieee); |
961 | 960 | ||
962 | /* libipw_tx.c */ | 961 | /* libipw_tx.c */ |
963 | extern netdev_tx_t libipw_xmit(struct sk_buff *skb, | 962 | netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev); |
964 | struct net_device *dev); | 963 | void libipw_txb_free(struct libipw_txb *); |
965 | extern void libipw_txb_free(struct libipw_txb *); | ||
966 | 964 | ||
967 | /* libipw_rx.c */ | 965 | /* libipw_rx.c */ |
968 | extern void libipw_rx_any(struct libipw_device *ieee, | 966 | void libipw_rx_any(struct libipw_device *ieee, struct sk_buff *skb, |
969 | struct sk_buff *skb, struct libipw_rx_stats *stats); | 967 | struct libipw_rx_stats *stats); |
970 | extern int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, | 968 | int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, |
971 | struct libipw_rx_stats *rx_stats); | 969 | struct libipw_rx_stats *rx_stats); |
972 | /* make sure to set stats->len */ | 970 | /* make sure to set stats->len */ |
973 | extern void libipw_rx_mgt(struct libipw_device *ieee, | 971 | void libipw_rx_mgt(struct libipw_device *ieee, struct libipw_hdr_4addr *header, |
974 | struct libipw_hdr_4addr *header, | 972 | struct libipw_rx_stats *stats); |
975 | struct libipw_rx_stats *stats); | 973 | void libipw_network_reset(struct libipw_network *network); |
976 | extern void libipw_network_reset(struct libipw_network *network); | ||
977 | 974 | ||
978 | /* libipw_geo.c */ | 975 | /* libipw_geo.c */ |
979 | extern const struct libipw_geo *libipw_get_geo(struct libipw_device | 976 | const struct libipw_geo *libipw_get_geo(struct libipw_device *ieee); |
980 | *ieee); | 977 | void libipw_set_geo(struct libipw_device *ieee, const struct libipw_geo *geo); |
981 | extern void libipw_set_geo(struct libipw_device *ieee, | 978 | |
982 | const struct libipw_geo *geo); | 979 | int libipw_is_valid_channel(struct libipw_device *ieee, u8 channel); |
983 | 980 | int libipw_channel_to_index(struct libipw_device *ieee, u8 channel); | |
984 | extern int libipw_is_valid_channel(struct libipw_device *ieee, | 981 | u8 libipw_freq_to_channel(struct libipw_device *ieee, u32 freq); |
985 | u8 channel); | 982 | u8 libipw_get_channel_flags(struct libipw_device *ieee, u8 channel); |
986 | extern int libipw_channel_to_index(struct libipw_device *ieee, | 983 | const struct libipw_channel *libipw_get_channel(struct libipw_device *ieee, |
987 | u8 channel); | 984 | u8 channel); |
988 | extern u8 libipw_freq_to_channel(struct libipw_device *ieee, u32 freq); | 985 | u32 libipw_channel_to_freq(struct libipw_device *ieee, u8 channel); |
989 | extern u8 libipw_get_channel_flags(struct libipw_device *ieee, | ||
990 | u8 channel); | ||
991 | extern const struct libipw_channel *libipw_get_channel(struct | ||
992 | libipw_device | ||
993 | *ieee, u8 channel); | ||
994 | extern u32 libipw_channel_to_freq(struct libipw_device * ieee, | ||
995 | u8 channel); | ||
996 | 986 | ||
997 | /* libipw_wx.c */ | 987 | /* libipw_wx.c */ |
998 | extern int libipw_wx_get_scan(struct libipw_device *ieee, | 988 | int libipw_wx_get_scan(struct libipw_device *ieee, struct iw_request_info *info, |
999 | struct iw_request_info *info, | 989 | union iwreq_data *wrqu, char *key); |
1000 | union iwreq_data *wrqu, char *key); | 990 | int libipw_wx_set_encode(struct libipw_device *ieee, |
1001 | extern int libipw_wx_set_encode(struct libipw_device *ieee, | 991 | struct iw_request_info *info, union iwreq_data *wrqu, |
1002 | struct iw_request_info *info, | 992 | char *key); |
1003 | union iwreq_data *wrqu, char *key); | 993 | int libipw_wx_get_encode(struct libipw_device *ieee, |
1004 | extern int libipw_wx_get_encode(struct libipw_device *ieee, | 994 | struct iw_request_info *info, union iwreq_data *wrqu, |
1005 | struct iw_request_info *info, | 995 | char *key); |
1006 | union iwreq_data *wrqu, char *key); | 996 | int libipw_wx_set_encodeext(struct libipw_device *ieee, |
1007 | extern int libipw_wx_set_encodeext(struct libipw_device *ieee, | 997 | struct iw_request_info *info, |
1008 | struct iw_request_info *info, | 998 | union iwreq_data *wrqu, char *extra); |
1009 | union iwreq_data *wrqu, char *extra); | 999 | int libipw_wx_get_encodeext(struct libipw_device *ieee, |
1010 | extern int libipw_wx_get_encodeext(struct libipw_device *ieee, | 1000 | struct iw_request_info *info, |
1011 | struct iw_request_info *info, | 1001 | union iwreq_data *wrqu, char *extra); |
1012 | union iwreq_data *wrqu, char *extra); | ||
1013 | 1002 | ||
1014 | static inline void libipw_increment_scans(struct libipw_device *ieee) | 1003 | static inline void libipw_increment_scans(struct libipw_device *ieee) |
1015 | { | 1004 | { |
diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h index 9a8703def0ba..00030d43a194 100644 --- a/drivers/net/wireless/iwlegacy/3945.h +++ b/drivers/net/wireless/iwlegacy/3945.h | |||
@@ -189,15 +189,14 @@ struct il3945_ibss_seq { | |||
189 | * for use by iwl-*.c | 189 | * for use by iwl-*.c |
190 | * | 190 | * |
191 | *****************************************************************************/ | 191 | *****************************************************************************/ |
192 | extern int il3945_calc_db_from_ratio(int sig_ratio); | 192 | int il3945_calc_db_from_ratio(int sig_ratio); |
193 | extern void il3945_rx_replenish(void *data); | 193 | void il3945_rx_replenish(void *data); |
194 | extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); | 194 | void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); |
195 | extern unsigned int il3945_fill_beacon_frame(struct il_priv *il, | 195 | unsigned int il3945_fill_beacon_frame(struct il_priv *il, |
196 | struct ieee80211_hdr *hdr, | 196 | struct ieee80211_hdr *hdr, int left); |
197 | int left); | 197 | int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, char **buf, |
198 | extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, | 198 | bool display); |
199 | char **buf, bool display); | 199 | void il3945_dump_nic_error_log(struct il_priv *il); |
200 | extern void il3945_dump_nic_error_log(struct il_priv *il); | ||
201 | 200 | ||
202 | /****************************************************************************** | 201 | /****************************************************************************** |
203 | * | 202 | * |
@@ -215,39 +214,36 @@ extern void il3945_dump_nic_error_log(struct il_priv *il); | |||
215 | * il3945_mac_ <-- mac80211 callback | 214 | * il3945_mac_ <-- mac80211 callback |
216 | * | 215 | * |
217 | ****************************************************************************/ | 216 | ****************************************************************************/ |
218 | extern void il3945_hw_handler_setup(struct il_priv *il); | 217 | void il3945_hw_handler_setup(struct il_priv *il); |
219 | extern void il3945_hw_setup_deferred_work(struct il_priv *il); | 218 | void il3945_hw_setup_deferred_work(struct il_priv *il); |
220 | extern void il3945_hw_cancel_deferred_work(struct il_priv *il); | 219 | void il3945_hw_cancel_deferred_work(struct il_priv *il); |
221 | extern int il3945_hw_rxq_stop(struct il_priv *il); | 220 | int il3945_hw_rxq_stop(struct il_priv *il); |
222 | extern int il3945_hw_set_hw_params(struct il_priv *il); | 221 | int il3945_hw_set_hw_params(struct il_priv *il); |
223 | extern int il3945_hw_nic_init(struct il_priv *il); | 222 | int il3945_hw_nic_init(struct il_priv *il); |
224 | extern int il3945_hw_nic_stop_master(struct il_priv *il); | 223 | int il3945_hw_nic_stop_master(struct il_priv *il); |
225 | extern void il3945_hw_txq_ctx_free(struct il_priv *il); | 224 | void il3945_hw_txq_ctx_free(struct il_priv *il); |
226 | extern void il3945_hw_txq_ctx_stop(struct il_priv *il); | 225 | void il3945_hw_txq_ctx_stop(struct il_priv *il); |
227 | extern int il3945_hw_nic_reset(struct il_priv *il); | 226 | int il3945_hw_nic_reset(struct il_priv *il); |
228 | extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, | 227 | int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq, |
229 | struct il_tx_queue *txq, | 228 | dma_addr_t addr, u16 len, u8 reset, u8 pad); |
230 | dma_addr_t addr, u16 len, u8 reset, | 229 | void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq); |
231 | u8 pad); | 230 | int il3945_hw_get_temperature(struct il_priv *il); |
232 | extern void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq); | 231 | int il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq); |
233 | extern int il3945_hw_get_temperature(struct il_priv *il); | 232 | unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, |
234 | extern int il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq); | 233 | struct il3945_frame *frame, u8 rate); |
235 | extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, | ||
236 | struct il3945_frame *frame, | ||
237 | u8 rate); | ||
238 | void il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd, | 234 | void il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd, |
239 | struct ieee80211_tx_info *info, | 235 | struct ieee80211_tx_info *info, |
240 | struct ieee80211_hdr *hdr, int sta_id); | 236 | struct ieee80211_hdr *hdr, int sta_id); |
241 | extern int il3945_hw_reg_send_txpower(struct il_priv *il); | 237 | int il3945_hw_reg_send_txpower(struct il_priv *il); |
242 | extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); | 238 | int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); |
243 | extern void il3945_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb); | 239 | void il3945_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb); |
244 | void il3945_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb); | 240 | void il3945_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb); |
245 | extern void il3945_disable_events(struct il_priv *il); | 241 | void il3945_disable_events(struct il_priv *il); |
246 | extern int il4965_get_temperature(const struct il_priv *il); | 242 | int il4965_get_temperature(const struct il_priv *il); |
247 | extern void il3945_post_associate(struct il_priv *il); | 243 | void il3945_post_associate(struct il_priv *il); |
248 | extern void il3945_config_ap(struct il_priv *il); | 244 | void il3945_config_ap(struct il_priv *il); |
249 | 245 | ||
250 | extern int il3945_commit_rxon(struct il_priv *il); | 246 | int il3945_commit_rxon(struct il_priv *il); |
251 | 247 | ||
252 | /** | 248 | /** |
253 | * il3945_hw_find_station - Find station id for a given BSSID | 249 | * il3945_hw_find_station - Find station id for a given BSSID |
@@ -257,14 +253,14 @@ extern int il3945_commit_rxon(struct il_priv *il); | |||
257 | * not yet been merged into a single common layer for managing the | 253 | * not yet been merged into a single common layer for managing the |
258 | * station tables. | 254 | * station tables. |
259 | */ | 255 | */ |
260 | extern u8 il3945_hw_find_station(struct il_priv *il, const u8 * bssid); | 256 | u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid); |
261 | 257 | ||
262 | extern __le32 il3945_get_antenna_flags(const struct il_priv *il); | 258 | __le32 il3945_get_antenna_flags(const struct il_priv *il); |
263 | extern int il3945_init_hw_rate_table(struct il_priv *il); | 259 | int il3945_init_hw_rate_table(struct il_priv *il); |
264 | extern void il3945_reg_txpower_periodic(struct il_priv *il); | 260 | void il3945_reg_txpower_periodic(struct il_priv *il); |
265 | extern int il3945_txpower_set_from_eeprom(struct il_priv *il); | 261 | int il3945_txpower_set_from_eeprom(struct il_priv *il); |
266 | 262 | ||
267 | extern int il3945_rs_next_rate(struct il_priv *il, int rate); | 263 | int il3945_rs_next_rate(struct il_priv *il, int rate); |
268 | 264 | ||
269 | /* scanning */ | 265 | /* scanning */ |
270 | int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); | 266 | int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); |
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h index 1b15b0b2292b..337dfcf3bbde 100644 --- a/drivers/net/wireless/iwlegacy/4965.h +++ b/drivers/net/wireless/iwlegacy/4965.h | |||
@@ -272,7 +272,7 @@ il4965_hw_valid_rtc_data_addr(u32 addr) | |||
272 | ((t) < IL_TX_POWER_TEMPERATURE_MIN || \ | 272 | ((t) < IL_TX_POWER_TEMPERATURE_MIN || \ |
273 | (t) > IL_TX_POWER_TEMPERATURE_MAX) | 273 | (t) > IL_TX_POWER_TEMPERATURE_MAX) |
274 | 274 | ||
275 | extern void il4965_temperature_calib(struct il_priv *il); | 275 | void il4965_temperature_calib(struct il_priv *il); |
276 | /********************* END TEMPERATURE ***************************************/ | 276 | /********************* END TEMPERATURE ***************************************/ |
277 | 277 | ||
278 | /********************* START TXPOWER *****************************************/ | 278 | /********************* START TXPOWER *****************************************/ |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 83f8ed8a5528..ad123d66ab6c 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -858,9 +858,9 @@ struct il_hw_params { | |||
858 | * il4965_mac_ <-- mac80211 callback | 858 | * il4965_mac_ <-- mac80211 callback |
859 | * | 859 | * |
860 | ****************************************************************************/ | 860 | ****************************************************************************/ |
861 | extern void il4965_update_chain_flags(struct il_priv *il); | 861 | void il4965_update_chain_flags(struct il_priv *il); |
862 | extern const u8 il_bcast_addr[ETH_ALEN]; | 862 | extern const u8 il_bcast_addr[ETH_ALEN]; |
863 | extern int il_queue_space(const struct il_queue *q); | 863 | int il_queue_space(const struct il_queue *q); |
864 | static inline int | 864 | static inline int |
865 | il_queue_used(const struct il_queue *q, int i) | 865 | il_queue_used(const struct il_queue *q, int i) |
866 | { | 866 | { |
@@ -1727,7 +1727,7 @@ int il_alloc_txq_mem(struct il_priv *il); | |||
1727 | void il_free_txq_mem(struct il_priv *il); | 1727 | void il_free_txq_mem(struct il_priv *il); |
1728 | 1728 | ||
1729 | #ifdef CONFIG_IWLEGACY_DEBUGFS | 1729 | #ifdef CONFIG_IWLEGACY_DEBUGFS |
1730 | extern void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len); | 1730 | void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len); |
1731 | #else | 1731 | #else |
1732 | static inline void | 1732 | static inline void |
1733 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) | 1733 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) |
@@ -1760,12 +1760,12 @@ void il_chswitch_done(struct il_priv *il, bool is_success); | |||
1760 | /***************************************************** | 1760 | /***************************************************** |
1761 | * TX | 1761 | * TX |
1762 | ******************************************************/ | 1762 | ******************************************************/ |
1763 | extern void il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq); | 1763 | void il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq); |
1764 | extern int il_tx_queue_init(struct il_priv *il, u32 txq_id); | 1764 | int il_tx_queue_init(struct il_priv *il, u32 txq_id); |
1765 | extern void il_tx_queue_reset(struct il_priv *il, u32 txq_id); | 1765 | void il_tx_queue_reset(struct il_priv *il, u32 txq_id); |
1766 | extern void il_tx_queue_unmap(struct il_priv *il, int txq_id); | 1766 | void il_tx_queue_unmap(struct il_priv *il, int txq_id); |
1767 | extern void il_tx_queue_free(struct il_priv *il, int txq_id); | 1767 | void il_tx_queue_free(struct il_priv *il, int txq_id); |
1768 | extern void il_setup_watchdog(struct il_priv *il); | 1768 | void il_setup_watchdog(struct il_priv *il); |
1769 | /***************************************************** | 1769 | /***************************************************** |
1770 | * TX power | 1770 | * TX power |
1771 | ****************************************************/ | 1771 | ****************************************************/ |
@@ -1931,10 +1931,10 @@ il_is_ready_rf(struct il_priv *il) | |||
1931 | return il_is_ready(il); | 1931 | return il_is_ready(il); |
1932 | } | 1932 | } |
1933 | 1933 | ||
1934 | extern void il_send_bt_config(struct il_priv *il); | 1934 | void il_send_bt_config(struct il_priv *il); |
1935 | extern int il_send_stats_request(struct il_priv *il, u8 flags, bool clear); | 1935 | int il_send_stats_request(struct il_priv *il, u8 flags, bool clear); |
1936 | extern void il_apm_stop(struct il_priv *il); | 1936 | void il_apm_stop(struct il_priv *il); |
1937 | extern void _il_apm_stop(struct il_priv *il); | 1937 | void _il_apm_stop(struct il_priv *il); |
1938 | 1938 | ||
1939 | int il_apm_init(struct il_priv *il); | 1939 | int il_apm_init(struct il_priv *il); |
1940 | 1940 | ||
@@ -1968,15 +1968,15 @@ void il_tx_cmd_protection(struct il_priv *il, struct ieee80211_tx_info *info, | |||
1968 | 1968 | ||
1969 | irqreturn_t il_isr(int irq, void *data); | 1969 | irqreturn_t il_isr(int irq, void *data); |
1970 | 1970 | ||
1971 | extern void il_set_bit(struct il_priv *p, u32 r, u32 m); | 1971 | void il_set_bit(struct il_priv *p, u32 r, u32 m); |
1972 | extern void il_clear_bit(struct il_priv *p, u32 r, u32 m); | 1972 | void il_clear_bit(struct il_priv *p, u32 r, u32 m); |
1973 | extern bool _il_grab_nic_access(struct il_priv *il); | 1973 | bool _il_grab_nic_access(struct il_priv *il); |
1974 | extern int _il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout); | 1974 | int _il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout); |
1975 | extern int il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout); | 1975 | int il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout); |
1976 | extern u32 il_rd_prph(struct il_priv *il, u32 reg); | 1976 | u32 il_rd_prph(struct il_priv *il, u32 reg); |
1977 | extern void il_wr_prph(struct il_priv *il, u32 addr, u32 val); | 1977 | void il_wr_prph(struct il_priv *il, u32 addr, u32 val); |
1978 | extern u32 il_read_targ_mem(struct il_priv *il, u32 addr); | 1978 | u32 il_read_targ_mem(struct il_priv *il, u32 addr); |
1979 | extern void il_write_targ_mem(struct il_priv *il, u32 addr, u32 val); | 1979 | void il_write_targ_mem(struct il_priv *il, u32 addr, u32 val); |
1980 | 1980 | ||
1981 | static inline void | 1981 | static inline void |
1982 | _il_write8(struct il_priv *il, u32 ofs, u8 val) | 1982 | _il_write8(struct il_priv *il, u32 ofs, u8 val) |
@@ -2868,13 +2868,13 @@ il4965_first_antenna(u8 mask) | |||
2868 | * The specific throughput table used is based on the type of network | 2868 | * The specific throughput table used is based on the type of network |
2869 | * the associated with, including A, B, G, and G w/ TGG protection | 2869 | * the associated with, including A, B, G, and G w/ TGG protection |
2870 | */ | 2870 | */ |
2871 | extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); | 2871 | void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); |
2872 | 2872 | ||
2873 | /* Initialize station's rate scaling information after adding station */ | 2873 | /* Initialize station's rate scaling information after adding station */ |
2874 | extern void il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, | 2874 | void il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, |
2875 | u8 sta_id); | 2875 | u8 sta_id); |
2876 | extern void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, | 2876 | void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, |
2877 | u8 sta_id); | 2877 | u8 sta_id); |
2878 | 2878 | ||
2879 | /** | 2879 | /** |
2880 | * il_rate_control_register - Register the rate control algorithm callbacks | 2880 | * il_rate_control_register - Register the rate control algorithm callbacks |
@@ -2886,8 +2886,8 @@ extern void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, | |||
2886 | * ieee80211_register_hw | 2886 | * ieee80211_register_hw |
2887 | * | 2887 | * |
2888 | */ | 2888 | */ |
2889 | extern int il4965_rate_control_register(void); | 2889 | int il4965_rate_control_register(void); |
2890 | extern int il3945_rate_control_register(void); | 2890 | int il3945_rate_control_register(void); |
2891 | 2891 | ||
2892 | /** | 2892 | /** |
2893 | * il_rate_control_unregister - Unregister the rate control callbacks | 2893 | * il_rate_control_unregister - Unregister the rate control callbacks |
@@ -2895,11 +2895,11 @@ extern int il3945_rate_control_register(void); | |||
2895 | * This should be called after calling ieee80211_unregister_hw, but before | 2895 | * This should be called after calling ieee80211_unregister_hw, but before |
2896 | * the driver is unloaded. | 2896 | * the driver is unloaded. |
2897 | */ | 2897 | */ |
2898 | extern void il4965_rate_control_unregister(void); | 2898 | void il4965_rate_control_unregister(void); |
2899 | extern void il3945_rate_control_unregister(void); | 2899 | void il3945_rate_control_unregister(void); |
2900 | 2900 | ||
2901 | extern int il_power_update_mode(struct il_priv *il, bool force); | 2901 | int il_power_update_mode(struct il_priv *il, bool force); |
2902 | extern void il_power_initialize(struct il_priv *il); | 2902 | void il_power_initialize(struct il_priv *il); |
2903 | 2903 | ||
2904 | extern u32 il_debug_level; | 2904 | extern u32 il_debug_level; |
2905 | 2905 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h index f2a86ffc3b4c..23d5f0275ce9 100644 --- a/drivers/net/wireless/iwlwifi/dvm/agn.h +++ b/drivers/net/wireless/iwlwifi/dvm/agn.h | |||
@@ -397,7 +397,7 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) | |||
397 | return cpu_to_le32(flags|(u32)rate); | 397 | return cpu_to_le32(flags|(u32)rate); |
398 | } | 398 | } |
399 | 399 | ||
400 | extern int iwl_alive_start(struct iwl_priv *priv); | 400 | int iwl_alive_start(struct iwl_priv *priv); |
401 | 401 | ||
402 | #ifdef CONFIG_IWLWIFI_DEBUG | 402 | #ifdef CONFIG_IWLWIFI_DEBUG |
403 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, | 403 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h index a79fdd137f95..7434d9edf3b7 100644 --- a/drivers/net/wireless/iwlwifi/dvm/dev.h +++ b/drivers/net/wireless/iwlwifi/dvm/dev.h | |||
@@ -270,7 +270,7 @@ struct iwl_sensitivity_ranges { | |||
270 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) | 270 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) |
271 | * | 271 | * |
272 | ****************************************************************************/ | 272 | ****************************************************************************/ |
273 | extern void iwl_update_chain_flags(struct iwl_priv *priv); | 273 | void iwl_update_chain_flags(struct iwl_priv *priv); |
274 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | 274 | extern const u8 iwl_bcast_addr[ETH_ALEN]; |
275 | 275 | ||
276 | #define IWL_OPERATION_MODE_AUTO 0 | 276 | #define IWL_OPERATION_MODE_AUTO 0 |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.h b/drivers/net/wireless/iwlwifi/dvm/rs.h index 5d83cab22d62..26fc550cd68c 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rs.h +++ b/drivers/net/wireless/iwlwifi/dvm/rs.h | |||
@@ -407,8 +407,8 @@ static inline u8 first_antenna(u8 mask) | |||
407 | 407 | ||
408 | 408 | ||
409 | /* Initialize station's rate scaling information after adding station */ | 409 | /* Initialize station's rate scaling information after adding station */ |
410 | extern void iwl_rs_rate_init(struct iwl_priv *priv, | 410 | void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, |
411 | struct ieee80211_sta *sta, u8 sta_id); | 411 | u8 sta_id); |
412 | 412 | ||
413 | /** | 413 | /** |
414 | * iwl_rate_control_register - Register the rate control algorithm callbacks | 414 | * iwl_rate_control_register - Register the rate control algorithm callbacks |
@@ -420,7 +420,7 @@ extern void iwl_rs_rate_init(struct iwl_priv *priv, | |||
420 | * ieee80211_register_hw | 420 | * ieee80211_register_hw |
421 | * | 421 | * |
422 | */ | 422 | */ |
423 | extern int iwlagn_rate_control_register(void); | 423 | int iwlagn_rate_control_register(void); |
424 | 424 | ||
425 | /** | 425 | /** |
426 | * iwl_rate_control_unregister - Unregister the rate control callbacks | 426 | * iwl_rate_control_unregister - Unregister the rate control callbacks |
@@ -428,6 +428,6 @@ extern int iwlagn_rate_control_register(void); | |||
428 | * This should be called after calling ieee80211_unregister_hw, but before | 428 | * This should be called after calling ieee80211_unregister_hw, but before |
429 | * the driver is unloaded. | 429 | * the driver is unloaded. |
430 | */ | 430 | */ |
431 | extern void iwlagn_rate_control_unregister(void); | 431 | void iwlagn_rate_control_unregister(void); |
432 | 432 | ||
433 | #endif /* __iwl_agn__rs__ */ | 433 | #endif /* __iwl_agn__rs__ */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h index 335cf1682902..465d40ee176f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.h +++ b/drivers/net/wireless/iwlwifi/mvm/rs.h | |||
@@ -314,9 +314,8 @@ static inline u8 num_of_ant(u8 mask) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | /* Initialize station's rate scaling information after adding station */ | 316 | /* Initialize station's rate scaling information after adding station */ |
317 | extern void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, | 317 | void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
318 | struct ieee80211_sta *sta, | 318 | enum ieee80211_band band); |
319 | enum ieee80211_band band); | ||
320 | 319 | ||
321 | /** | 320 | /** |
322 | * iwl_rate_control_register - Register the rate control algorithm callbacks | 321 | * iwl_rate_control_register - Register the rate control algorithm callbacks |
@@ -328,7 +327,7 @@ extern void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, | |||
328 | * ieee80211_register_hw | 327 | * ieee80211_register_hw |
329 | * | 328 | * |
330 | */ | 329 | */ |
331 | extern int iwl_mvm_rate_control_register(void); | 330 | int iwl_mvm_rate_control_register(void); |
332 | 331 | ||
333 | /** | 332 | /** |
334 | * iwl_rate_control_unregister - Unregister the rate control callbacks | 333 | * iwl_rate_control_unregister - Unregister the rate control callbacks |
@@ -336,7 +335,7 @@ extern int iwl_mvm_rate_control_register(void); | |||
336 | * This should be called after calling ieee80211_unregister_hw, but before | 335 | * This should be called after calling ieee80211_unregister_hw, but before |
337 | * the driver is unloaded. | 336 | * the driver is unloaded. |
338 | */ | 337 | */ |
339 | extern void iwl_mvm_rate_control_unregister(void); | 338 | void iwl_mvm_rate_control_unregister(void); |
340 | 339 | ||
341 | struct iwl_mvm_sta; | 340 | struct iwl_mvm_sta; |
342 | 341 | ||
diff --git a/drivers/net/wireless/mwifiex/wmm.h b/drivers/net/wireless/mwifiex/wmm.h index 644d6e0c51cc..0f129d498fb1 100644 --- a/drivers/net/wireless/mwifiex/wmm.h +++ b/drivers/net/wireless/mwifiex/wmm.h | |||
@@ -83,11 +83,10 @@ mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, | 85 | void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, |
86 | struct sk_buff *skb); | 86 | struct sk_buff *skb); |
87 | void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra); | 87 | void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra); |
88 | void mwifiex_rotate_priolists(struct mwifiex_private *priv, | 88 | void mwifiex_rotate_priolists(struct mwifiex_private *priv, |
89 | struct mwifiex_ra_list_tbl *ra, | 89 | struct mwifiex_ra_list_tbl *ra, int tid); |
90 | int tid); | ||
91 | 90 | ||
92 | int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter); | 91 | int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter); |
93 | void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter); | 92 | void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter); |
@@ -95,21 +94,18 @@ int mwifiex_is_ralist_valid(struct mwifiex_private *priv, | |||
95 | struct mwifiex_ra_list_tbl *ra_list, int tid); | 94 | struct mwifiex_ra_list_tbl *ra_list, int tid); |
96 | 95 | ||
97 | u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv, | 96 | u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv, |
98 | const struct sk_buff *skb); | 97 | const struct sk_buff *skb); |
99 | void mwifiex_wmm_init(struct mwifiex_adapter *adapter); | 98 | void mwifiex_wmm_init(struct mwifiex_adapter *adapter); |
100 | 99 | ||
101 | extern u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv, | 100 | u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv, |
102 | u8 **assoc_buf, | 101 | u8 **assoc_buf, |
103 | struct ieee_types_wmm_parameter | 102 | struct ieee_types_wmm_parameter *wmmie, |
104 | *wmmie, | 103 | struct ieee80211_ht_cap *htcap); |
105 | struct ieee80211_ht_cap | ||
106 | *htcap); | ||
107 | 104 | ||
108 | void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv, | 105 | void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv, |
109 | struct ieee_types_wmm_parameter | 106 | struct ieee_types_wmm_parameter *wmm_ie); |
110 | *wmm_ie); | ||
111 | void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv); | 107 | void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv); |
112 | extern int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, | 108 | int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, |
113 | const struct host_cmd_ds_command *resp); | 109 | const struct host_cmd_ds_command *resp); |
114 | 110 | ||
115 | #endif /* !_MWIFIEX_WMM_H_ */ | 111 | #endif /* !_MWIFIEX_WMM_H_ */ |
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h index 3bb936b9558c..eebd2be21ee9 100644 --- a/drivers/net/wireless/orinoco/orinoco.h +++ b/drivers/net/wireless/orinoco/orinoco.h | |||
@@ -182,23 +182,20 @@ extern int orinoco_debug; | |||
182 | /* Exported prototypes */ | 182 | /* Exported prototypes */ |
183 | /********************************************************************/ | 183 | /********************************************************************/ |
184 | 184 | ||
185 | extern struct orinoco_private *alloc_orinocodev( | 185 | struct orinoco_private *alloc_orinocodev(int sizeof_card, struct device *device, |
186 | int sizeof_card, struct device *device, | 186 | int (*hard_reset)(struct orinoco_private *), |
187 | int (*hard_reset)(struct orinoco_private *), | 187 | int (*stop_fw)(struct orinoco_private *, int)); |
188 | int (*stop_fw)(struct orinoco_private *, int)); | 188 | void free_orinocodev(struct orinoco_private *priv); |
189 | extern void free_orinocodev(struct orinoco_private *priv); | 189 | int orinoco_init(struct orinoco_private *priv); |
190 | extern int orinoco_init(struct orinoco_private *priv); | 190 | int orinoco_if_add(struct orinoco_private *priv, unsigned long base_addr, |
191 | extern int orinoco_if_add(struct orinoco_private *priv, | 191 | unsigned int irq, const struct net_device_ops *ops); |
192 | unsigned long base_addr, | 192 | void orinoco_if_del(struct orinoco_private *priv); |
193 | unsigned int irq, | 193 | int orinoco_up(struct orinoco_private *priv); |
194 | const struct net_device_ops *ops); | 194 | void orinoco_down(struct orinoco_private *priv); |
195 | extern void orinoco_if_del(struct orinoco_private *priv); | 195 | irqreturn_t orinoco_interrupt(int irq, void *dev_id); |
196 | extern int orinoco_up(struct orinoco_private *priv); | 196 | |
197 | extern void orinoco_down(struct orinoco_private *priv); | 197 | void __orinoco_ev_info(struct net_device *dev, struct hermes *hw); |
198 | extern irqreturn_t orinoco_interrupt(int irq, void *dev_id); | 198 | void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw); |
199 | |||
200 | extern void __orinoco_ev_info(struct net_device *dev, struct hermes *hw); | ||
201 | extern void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw); | ||
202 | 199 | ||
203 | int orinoco_process_xmit_skb(struct sk_buff *skb, | 200 | int orinoco_process_xmit_skb(struct sk_buff *skb, |
204 | struct net_device *dev, | 201 | struct net_device *dev, |
diff --git a/drivers/net/wireless/rtlwifi/cam.h b/drivers/net/wireless/rtlwifi/cam.h index 35e00086a520..0105e6c1901e 100644 --- a/drivers/net/wireless/rtlwifi/cam.h +++ b/drivers/net/wireless/rtlwifi/cam.h | |||
@@ -41,12 +41,12 @@ | |||
41 | #define CAM_CONFIG_USEDK 1 | 41 | #define CAM_CONFIG_USEDK 1 |
42 | #define CAM_CONFIG_NO_USEDK 0 | 42 | #define CAM_CONFIG_NO_USEDK 0 |
43 | 43 | ||
44 | extern void rtl_cam_reset_all_entry(struct ieee80211_hw *hw); | 44 | void rtl_cam_reset_all_entry(struct ieee80211_hw *hw); |
45 | extern u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, | 45 | u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, |
46 | u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg, | 46 | u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg, |
47 | u32 ul_default_key, u8 *key_content); | 47 | u32 ul_default_key, u8 *key_content); |
48 | int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, | 48 | int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, |
49 | u32 ul_key_id); | 49 | u32 ul_key_id); |
50 | void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index); | 50 | void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index); |
51 | void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index); | 51 | void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index); |
52 | void rtl_cam_reset_sec_info(struct ieee80211_hw *hw); | 52 | void rtl_cam_reset_sec_info(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/efuse.h b/drivers/net/wireless/rtlwifi/efuse.h index 395a326acfb4..1663b3afd41e 100644 --- a/drivers/net/wireless/rtlwifi/efuse.h +++ b/drivers/net/wireless/rtlwifi/efuse.h | |||
@@ -104,20 +104,19 @@ struct efuse_priv { | |||
104 | u8 tx_power_g[14]; | 104 | u8 tx_power_g[14]; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | extern void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); | 107 | void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); |
108 | extern void efuse_initialize(struct ieee80211_hw *hw); | 108 | void efuse_initialize(struct ieee80211_hw *hw); |
109 | extern u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address); | 109 | u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address); |
110 | extern void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value); | 110 | void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value); |
111 | extern void read_efuse(struct ieee80211_hw *hw, u16 _offset, | 111 | void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf); |
112 | u16 _size_byte, u8 *pbuf); | 112 | void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, u16 offset, |
113 | extern void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, | 113 | u32 *value); |
114 | u16 offset, u32 *value); | 114 | void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, u16 offset, |
115 | extern void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, | 115 | u32 value); |
116 | u16 offset, u32 value); | 116 | bool efuse_shadow_update(struct ieee80211_hw *hw); |
117 | extern bool efuse_shadow_update(struct ieee80211_hw *hw); | 117 | bool efuse_shadow_update_chk(struct ieee80211_hw *hw); |
118 | extern bool efuse_shadow_update_chk(struct ieee80211_hw *hw); | 118 | void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); |
119 | extern void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); | 119 | void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); |
120 | extern void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); | 120 | void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); |
121 | extern void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); | ||
122 | 121 | ||
123 | #endif | 122 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h index f1acd6d27e44..71ddf4f3f6cc 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h | |||
@@ -200,37 +200,32 @@ enum _ANT_DIV_TYPE { | |||
200 | CGCS_RX_SW_ANTDIV = 0x05, | 200 | CGCS_RX_SW_ANTDIV = 0x05, |
201 | }; | 201 | }; |
202 | 202 | ||
203 | extern u32 rtl88e_phy_query_bb_reg(struct ieee80211_hw *hw, | 203 | u32 rtl88e_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); |
204 | u32 regaddr, u32 bitmask); | 204 | void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, |
205 | extern void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw, | 205 | u32 data); |
206 | u32 regaddr, u32 bitmask, u32 data); | 206 | u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, |
207 | extern u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw, | 207 | u32 regaddr, u32 bitmask); |
208 | enum radio_path rfpath, u32 regaddr, | 208 | void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, |
209 | u32 bitmask); | 209 | u32 regaddr, u32 bitmask, u32 data); |
210 | extern void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw, | 210 | bool rtl88e_phy_mac_config(struct ieee80211_hw *hw); |
211 | enum radio_path rfpath, u32 regaddr, | 211 | bool rtl88e_phy_bb_config(struct ieee80211_hw *hw); |
212 | u32 bitmask, u32 data); | 212 | bool rtl88e_phy_rf_config(struct ieee80211_hw *hw); |
213 | extern bool rtl88e_phy_mac_config(struct ieee80211_hw *hw); | 213 | void rtl88e_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); |
214 | extern bool rtl88e_phy_bb_config(struct ieee80211_hw *hw); | 214 | void rtl88e_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel); |
215 | extern bool rtl88e_phy_rf_config(struct ieee80211_hw *hw); | 215 | void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); |
216 | extern void rtl88e_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); | 216 | void rtl88e_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); |
217 | extern void rtl88e_phy_get_txpower_level(struct ieee80211_hw *hw, | 217 | void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw); |
218 | long *powerlevel); | 218 | void rtl88e_phy_set_bw_mode(struct ieee80211_hw *hw, |
219 | extern void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); | 219 | enum nl80211_channel_type ch_type); |
220 | extern void rtl88e_phy_scan_operation_backup(struct ieee80211_hw *hw, | 220 | void rtl88e_phy_sw_chnl_callback(struct ieee80211_hw *hw); |
221 | u8 operation); | 221 | u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw); |
222 | extern void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw); | 222 | void rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
223 | extern void rtl88e_phy_set_bw_mode(struct ieee80211_hw *hw, | ||
224 | enum nl80211_channel_type ch_type); | ||
225 | extern void rtl88e_phy_sw_chnl_callback(struct ieee80211_hw *hw); | ||
226 | extern u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw); | ||
227 | extern void rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | ||
228 | void rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw); | 223 | void rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw); |
229 | void rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 224 | void rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
230 | bool rtl88e_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 225 | bool rtl88e_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
231 | enum radio_path rfpath); | 226 | enum radio_path rfpath); |
232 | bool rtl88e_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | 227 | bool rtl88e_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); |
233 | extern bool rtl88e_phy_set_rf_power_state(struct ieee80211_hw *hw, | 228 | bool rtl88e_phy_set_rf_power_state(struct ieee80211_hw *hw, |
234 | enum rf_pwrstate rfpwr_state); | 229 | enum rf_pwrstate rfpwr_state); |
235 | 230 | ||
236 | #endif | 231 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h index d5e3b704f930..f8973e58c173 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h | |||
@@ -188,65 +188,55 @@ struct tx_power_struct { | |||
188 | }; | 188 | }; |
189 | 189 | ||
190 | bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); | 190 | bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); |
191 | u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, | 191 | u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); |
192 | u32 regaddr, u32 bitmask); | 192 | void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, |
193 | void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, | 193 | u32 data); |
194 | u32 regaddr, u32 bitmask, u32 data); | 194 | u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, |
195 | u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, | 195 | u32 regaddr, u32 bitmask); |
196 | enum radio_path rfpath, u32 regaddr, | 196 | void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, |
197 | u32 bitmask); | 197 | u32 regaddr, u32 bitmask, u32 data); |
198 | extern void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, | ||
199 | enum radio_path rfpath, u32 regaddr, | ||
200 | u32 bitmask, u32 data); | ||
201 | bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); | 198 | bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); |
202 | bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw); | 199 | bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw); |
203 | bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); | 200 | bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); |
204 | bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, | 201 | bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, |
205 | enum radio_path rfpath); | 202 | enum radio_path rfpath); |
206 | void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); | 203 | void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); |
207 | void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, | 204 | void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel); |
208 | long *powerlevel); | ||
209 | void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); | 205 | void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); |
210 | bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, | 206 | bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm); |
211 | long power_indbm); | 207 | void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); |
212 | void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, | ||
213 | u8 operation); | ||
214 | void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, | 208 | void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, |
215 | enum nl80211_channel_type ch_type); | 209 | enum nl80211_channel_type ch_type); |
216 | void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); | 210 | void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); |
217 | u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); | 211 | u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); |
218 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | 212 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
219 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, | 213 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval); |
220 | u16 beaconinterval); | ||
221 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 214 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); |
222 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 215 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
223 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); | 216 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); |
224 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 217 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
225 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 218 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
226 | enum radio_path rfpath); | 219 | enum radio_path rfpath); |
227 | bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, | 220 | bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath); |
228 | u32 rfpath); | ||
229 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | 221 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); |
230 | bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | 222 | bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, |
231 | enum rf_pwrstate rfpwr_state); | 223 | enum rf_pwrstate rfpwr_state); |
232 | void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); | 224 | void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); |
233 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | 225 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); |
234 | void rtl92c_phy_set_io(struct ieee80211_hw *hw); | 226 | void rtl92c_phy_set_io(struct ieee80211_hw *hw); |
235 | void rtl92c_bb_block_on(struct ieee80211_hw *hw); | 227 | void rtl92c_bb_block_on(struct ieee80211_hw *hw); |
236 | u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, | 228 | u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath, |
237 | enum radio_path rfpath, u32 offset); | 229 | u32 offset); |
238 | u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, | 230 | u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, |
239 | enum radio_path rfpath, u32 offset); | 231 | enum radio_path rfpath, u32 offset); |
240 | u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); | 232 | u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); |
241 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, | 233 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, |
242 | enum radio_path rfpath, u32 offset, | 234 | enum radio_path rfpath, u32 offset, u32 data); |
243 | u32 data); | ||
244 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, | 235 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, |
245 | enum radio_path rfpath, u32 offset, | 236 | enum radio_path rfpath, u32 offset, |
246 | u32 data); | 237 | u32 data); |
247 | void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, | 238 | void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, |
248 | u32 regaddr, u32 bitmask, | 239 | u32 regaddr, u32 bitmask, u32 data); |
249 | u32 data); | ||
250 | bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); | 240 | bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); |
251 | void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); | 241 | void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); |
252 | bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); | 242 | bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h index 6c8d56efceae..d8fe68b389d2 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h | |||
@@ -34,11 +34,10 @@ | |||
34 | #define RF6052_MAX_REG 0x3F | 34 | #define RF6052_MAX_REG 0x3F |
35 | #define RF6052_MAX_PATH 2 | 35 | #define RF6052_MAX_PATH 2 |
36 | 36 | ||
37 | extern void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, | 37 | void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth); |
38 | u8 bandwidth); | 38 | void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
39 | extern void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 39 | u8 *ppowerlevel); |
40 | u8 *ppowerlevel); | 40 | void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, |
41 | extern void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, | 41 | u8 *ppowerlevel, u8 channel); |
42 | u8 *ppowerlevel, u8 channel); | 42 | bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw); |
43 | extern bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw); | ||
44 | #endif | 43 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h index 090fd33a158d..11b439d6b671 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h | |||
@@ -34,15 +34,14 @@ | |||
34 | #define RF6052_MAX_REG 0x3F | 34 | #define RF6052_MAX_REG 0x3F |
35 | #define RF6052_MAX_PATH 2 | 35 | #define RF6052_MAX_PATH 2 |
36 | 36 | ||
37 | extern void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, | 37 | void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth); |
38 | u8 bandwidth); | 38 | void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
39 | extern void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 39 | u8 *ppowerlevel); |
40 | u8 *ppowerlevel); | 40 | void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, |
41 | extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, | 41 | u8 *ppowerlevel, u8 channel); |
42 | u8 *ppowerlevel, u8 channel); | ||
43 | bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw); | 42 | bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw); |
44 | bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 43 | bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
45 | enum radio_path rfpath); | 44 | enum radio_path rfpath); |
46 | void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 45 | void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
47 | u8 *ppowerlevel); | 46 | u8 *ppowerlevel); |
48 | void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, | 47 | void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h index 7c9f7a2f1e42..1bc7b1a96d4a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h | |||
@@ -55,10 +55,9 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index, | |||
55 | u8 *p_macaddr, bool is_group, u8 enc_algo, | 55 | u8 *p_macaddr, bool is_group, u8 enc_algo, |
56 | bool is_wepkey, bool clear_all); | 56 | bool is_wepkey, bool clear_all); |
57 | 57 | ||
58 | extern void rtl92de_write_dword_dbi(struct ieee80211_hw *hw, u16 offset, | 58 | void rtl92de_write_dword_dbi(struct ieee80211_hw *hw, u16 offset, u32 value, |
59 | u32 value, u8 direct); | 59 | u8 direct); |
60 | extern u32 rtl92de_read_dword_dbi(struct ieee80211_hw *hw, u16 offset, | 60 | u32 rtl92de_read_dword_dbi(struct ieee80211_hw *hw, u16 offset, u8 direct); |
61 | u8 direct); | ||
62 | void rtl92de_suspend(struct ieee80211_hw *hw); | 61 | void rtl92de_suspend(struct ieee80211_hw *hw); |
63 | void rtl92de_resume(struct ieee80211_hw *hw); | 62 | void rtl92de_resume(struct ieee80211_hw *hw); |
64 | void rtl92d_linked_set_reg(struct ieee80211_hw *hw); | 63 | void rtl92d_linked_set_reg(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h index f074952bf25c..0f993f451cdb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h | |||
@@ -127,34 +127,30 @@ static inline void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw, | |||
127 | *flag); | 127 | *flag); |
128 | } | 128 | } |
129 | 129 | ||
130 | extern u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, | 130 | u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); |
131 | u32 regaddr, u32 bitmask); | 131 | void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, |
132 | extern void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw, | 132 | u32 data); |
133 | u32 regaddr, u32 bitmask, u32 data); | 133 | u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, |
134 | extern u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, | 134 | u32 regaddr, u32 bitmask); |
135 | enum radio_path rfpath, u32 regaddr, | 135 | void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, |
136 | u32 bitmask); | 136 | u32 regaddr, u32 bitmask, u32 data); |
137 | extern void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, | 137 | bool rtl92d_phy_mac_config(struct ieee80211_hw *hw); |
138 | enum radio_path rfpath, u32 regaddr, | 138 | bool rtl92d_phy_bb_config(struct ieee80211_hw *hw); |
139 | u32 bitmask, u32 data); | 139 | bool rtl92d_phy_rf_config(struct ieee80211_hw *hw); |
140 | extern bool rtl92d_phy_mac_config(struct ieee80211_hw *hw); | 140 | bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, |
141 | extern bool rtl92d_phy_bb_config(struct ieee80211_hw *hw); | 141 | enum radio_path rfpath); |
142 | extern bool rtl92d_phy_rf_config(struct ieee80211_hw *hw); | 142 | void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); |
143 | extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, | 143 | void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); |
144 | enum radio_path rfpath); | 144 | void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); |
145 | extern void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); | 145 | void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw, |
146 | extern void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); | 146 | enum nl80211_channel_type ch_type); |
147 | extern void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, | 147 | u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw); |
148 | u8 operation); | ||
149 | extern void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw, | ||
150 | enum nl80211_channel_type ch_type); | ||
151 | extern u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw); | ||
152 | bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 148 | bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
153 | enum rf_content content, | 149 | enum rf_content content, |
154 | enum radio_path rfpath); | 150 | enum radio_path rfpath); |
155 | bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | 151 | bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); |
156 | extern bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw, | 152 | bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw, |
157 | enum rf_pwrstate rfpwr_state); | 153 | enum rf_pwrstate rfpwr_state); |
158 | 154 | ||
159 | void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw); | 155 | void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw); |
160 | void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw); | 156 | void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h index 0fe1a48593e8..7303d12c266f 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h +++ b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h | |||
@@ -30,15 +30,13 @@ | |||
30 | #ifndef __RTL92D_RF_H__ | 30 | #ifndef __RTL92D_RF_H__ |
31 | #define __RTL92D_RF_H__ | 31 | #define __RTL92D_RF_H__ |
32 | 32 | ||
33 | extern void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, | 33 | void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth); |
34 | u8 bandwidth); | 34 | void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
35 | extern void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 35 | u8 *ppowerlevel); |
36 | u8 *ppowerlevel); | 36 | void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, |
37 | extern void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, | 37 | u8 *ppowerlevel, u8 channel); |
38 | u8 *ppowerlevel, u8 channel); | 38 | bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw); |
39 | extern bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw); | 39 | bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0); |
40 | extern bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0); | 40 | void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw, bool bmac0); |
41 | extern void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw, | ||
42 | bool bmac0); | ||
43 | 41 | ||
44 | #endif | 42 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h index e7a59eba351a..bbb950dac5ba 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h | |||
@@ -183,42 +183,39 @@ struct tx_power_struct { | |||
183 | u32 mcs_original_offset[4][16]; | 183 | u32 mcs_original_offset[4][16]; |
184 | }; | 184 | }; |
185 | 185 | ||
186 | extern u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw, | 186 | u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, |
187 | u32 regaddr, u32 bitmask); | 187 | u32 bitmask); |
188 | extern void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw, | 188 | void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, |
189 | u32 regaddr, u32 bitmask, u32 data); | 189 | u32 data); |
190 | extern u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw, | 190 | u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw, |
191 | enum radio_path rfpath, u32 regaddr, | 191 | enum radio_path rfpath, u32 regaddr, |
192 | u32 bitmask); | 192 | u32 bitmask); |
193 | extern void rtl8723ae_phy_set_rf_reg(struct ieee80211_hw *hw, | 193 | void rtl8723ae_phy_set_rf_reg(struct ieee80211_hw *hw, |
194 | enum radio_path rfpath, u32 regaddr, | 194 | enum radio_path rfpath, u32 regaddr, u32 bitmask, |
195 | u32 bitmask, u32 data); | 195 | u32 data); |
196 | extern bool rtl8723ae_phy_mac_config(struct ieee80211_hw *hw); | 196 | bool rtl8723ae_phy_mac_config(struct ieee80211_hw *hw); |
197 | extern bool rtl8723ae_phy_bb_config(struct ieee80211_hw *hw); | 197 | bool rtl8723ae_phy_bb_config(struct ieee80211_hw *hw); |
198 | extern bool rtl8723ae_phy_rf_config(struct ieee80211_hw *hw); | 198 | bool rtl8723ae_phy_rf_config(struct ieee80211_hw *hw); |
199 | extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, | 199 | bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, |
200 | enum radio_path rfpath); | 200 | enum radio_path rfpath); |
201 | extern void rtl8723ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); | 201 | void rtl8723ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); |
202 | extern void rtl8723ae_phy_get_txpower_level(struct ieee80211_hw *hw, | 202 | void rtl8723ae_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel); |
203 | long *powerlevel); | 203 | void rtl8723ae_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); |
204 | extern void rtl8723ae_phy_set_txpower_level(struct ieee80211_hw *hw, | 204 | bool rtl8723ae_phy_update_txpower_dbm(struct ieee80211_hw *hw, |
205 | u8 channel); | 205 | long power_indbm); |
206 | extern bool rtl8723ae_phy_update_txpower_dbm(struct ieee80211_hw *hw, | 206 | void rtl8723ae_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); |
207 | long power_indbm); | 207 | void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw); |
208 | extern void rtl8723ae_phy_scan_operation_backup(struct ieee80211_hw *hw, | 208 | void rtl8723ae_phy_set_bw_mode(struct ieee80211_hw *hw, |
209 | u8 operation); | 209 | enum nl80211_channel_type ch_type); |
210 | extern void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw); | 210 | void rtl8723ae_phy_sw_chnl_callback(struct ieee80211_hw *hw); |
211 | extern void rtl8723ae_phy_set_bw_mode(struct ieee80211_hw *hw, | 211 | u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw); |
212 | enum nl80211_channel_type ch_type); | 212 | void rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); |
213 | extern void rtl8723ae_phy_sw_chnl_callback(struct ieee80211_hw *hw); | ||
214 | extern u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw); | ||
215 | extern void rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); | ||
216 | void rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw); | 213 | void rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw); |
217 | void rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 214 | void rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
218 | bool rtl8723ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 215 | bool rtl8723ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
219 | enum radio_path rfpath); | 216 | enum radio_path rfpath); |
220 | bool rtl8723ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | 217 | bool rtl8723ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); |
221 | extern bool rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw, | 218 | bool rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw, |
222 | enum rf_pwrstate rfpwr_state); | 219 | enum rf_pwrstate rfpwr_state); |
223 | 220 | ||
224 | #endif | 221 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h index d0f9dd79abea..57f1933ee663 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h | |||
@@ -32,12 +32,11 @@ | |||
32 | 32 | ||
33 | #define RF6052_MAX_TX_PWR 0x3F | 33 | #define RF6052_MAX_TX_PWR 0x3F |
34 | 34 | ||
35 | extern void rtl8723ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, | 35 | void rtl8723ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth); |
36 | u8 bandwidth); | 36 | void rtl8723ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
37 | extern void rtl8723ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 37 | u8 *ppowerlevel); |
38 | u8 *ppowerlevel); | 38 | void rtl8723ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, |
39 | extern void rtl8723ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, | 39 | u8 *ppowerlevel, u8 channel); |
40 | u8 *ppowerlevel, u8 channel); | 40 | bool rtl8723ae_phy_rf6052_config(struct ieee80211_hw *hw); |
41 | extern bool rtl8723ae_phy_rf6052_config(struct ieee80211_hw *hw); | ||
42 | 41 | ||
43 | #endif | 42 | #endif |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index f3e591c611de..d0b0feb035fb 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -47,6 +47,14 @@ | |||
47 | #include <asm/xen/hypercall.h> | 47 | #include <asm/xen/hypercall.h> |
48 | #include <asm/xen/page.h> | 48 | #include <asm/xen/page.h> |
49 | 49 | ||
50 | /* SKB control block overlay is used to store useful information when | ||
51 | * doing guest RX. | ||
52 | */ | ||
53 | struct skb_cb_overlay { | ||
54 | int meta_slots_used; | ||
55 | int peek_slots_count; | ||
56 | }; | ||
57 | |||
50 | /* Provide an option to disable split event channels at load time as | 58 | /* Provide an option to disable split event channels at load time as |
51 | * event channels are limited resource. Split event channels are | 59 | * event channels are limited resource. Split event channels are |
52 | * enabled by default. | 60 | * enabled by default. |
@@ -212,49 +220,6 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head) | |||
212 | return false; | 220 | return false; |
213 | } | 221 | } |
214 | 222 | ||
215 | struct xenvif_count_slot_state { | ||
216 | unsigned long copy_off; | ||
217 | bool head; | ||
218 | }; | ||
219 | |||
220 | unsigned int xenvif_count_frag_slots(struct xenvif *vif, | ||
221 | unsigned long offset, unsigned long size, | ||
222 | struct xenvif_count_slot_state *state) | ||
223 | { | ||
224 | unsigned count = 0; | ||
225 | |||
226 | offset &= ~PAGE_MASK; | ||
227 | |||
228 | while (size > 0) { | ||
229 | unsigned long bytes; | ||
230 | |||
231 | bytes = PAGE_SIZE - offset; | ||
232 | |||
233 | if (bytes > size) | ||
234 | bytes = size; | ||
235 | |||
236 | if (start_new_rx_buffer(state->copy_off, bytes, state->head)) { | ||
237 | count++; | ||
238 | state->copy_off = 0; | ||
239 | } | ||
240 | |||
241 | if (state->copy_off + bytes > MAX_BUFFER_OFFSET) | ||
242 | bytes = MAX_BUFFER_OFFSET - state->copy_off; | ||
243 | |||
244 | state->copy_off += bytes; | ||
245 | |||
246 | offset += bytes; | ||
247 | size -= bytes; | ||
248 | |||
249 | if (offset == PAGE_SIZE) | ||
250 | offset = 0; | ||
251 | |||
252 | state->head = false; | ||
253 | } | ||
254 | |||
255 | return count; | ||
256 | } | ||
257 | |||
258 | /* | 223 | /* |
259 | * Figure out how many ring slots we're going to need to send @skb to | 224 | * Figure out how many ring slots we're going to need to send @skb to |
260 | * the guest. This function is essentially a dry run of | 225 | * the guest. This function is essentially a dry run of |
@@ -262,40 +227,53 @@ unsigned int xenvif_count_frag_slots(struct xenvif *vif, | |||
262 | */ | 227 | */ |
263 | unsigned int xenvif_count_skb_slots(struct xenvif *vif, struct sk_buff *skb) | 228 | unsigned int xenvif_count_skb_slots(struct xenvif *vif, struct sk_buff *skb) |
264 | { | 229 | { |
265 | struct xenvif_count_slot_state state; | ||
266 | unsigned int count; | 230 | unsigned int count; |
267 | unsigned char *data; | 231 | int i, copy_off; |
268 | unsigned i; | 232 | struct skb_cb_overlay *sco; |
269 | 233 | ||
270 | state.head = true; | 234 | count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE); |
271 | state.copy_off = 0; | ||
272 | 235 | ||
273 | /* Slot for the first (partial) page of data. */ | 236 | copy_off = skb_headlen(skb) % PAGE_SIZE; |
274 | count = 1; | ||
275 | 237 | ||
276 | /* Need a slot for the GSO prefix for GSO extra data? */ | ||
277 | if (skb_shinfo(skb)->gso_size) | 238 | if (skb_shinfo(skb)->gso_size) |
278 | count++; | 239 | count++; |
279 | 240 | ||
280 | data = skb->data; | 241 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
281 | while (data < skb_tail_pointer(skb)) { | 242 | unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); |
282 | unsigned long offset = offset_in_page(data); | 243 | unsigned long offset = skb_shinfo(skb)->frags[i].page_offset; |
283 | unsigned long size = PAGE_SIZE - offset; | 244 | unsigned long bytes; |
284 | 245 | ||
285 | if (data + size > skb_tail_pointer(skb)) | 246 | offset &= ~PAGE_MASK; |
286 | size = skb_tail_pointer(skb) - data; | ||
287 | 247 | ||
288 | count += xenvif_count_frag_slots(vif, offset, size, &state); | 248 | while (size > 0) { |
249 | BUG_ON(offset >= PAGE_SIZE); | ||
250 | BUG_ON(copy_off > MAX_BUFFER_OFFSET); | ||
289 | 251 | ||
290 | data += size; | 252 | bytes = PAGE_SIZE - offset; |
291 | } | ||
292 | 253 | ||
293 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 254 | if (bytes > size) |
294 | unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); | 255 | bytes = size; |
295 | unsigned long offset = skb_shinfo(skb)->frags[i].page_offset; | 256 | |
257 | if (start_new_rx_buffer(copy_off, bytes, 0)) { | ||
258 | count++; | ||
259 | copy_off = 0; | ||
260 | } | ||
296 | 261 | ||
297 | count += xenvif_count_frag_slots(vif, offset, size, &state); | 262 | if (copy_off + bytes > MAX_BUFFER_OFFSET) |
263 | bytes = MAX_BUFFER_OFFSET - copy_off; | ||
264 | |||
265 | copy_off += bytes; | ||
266 | |||
267 | offset += bytes; | ||
268 | size -= bytes; | ||
269 | |||
270 | if (offset == PAGE_SIZE) | ||
271 | offset = 0; | ||
272 | } | ||
298 | } | 273 | } |
274 | |||
275 | sco = (struct skb_cb_overlay *)skb->cb; | ||
276 | sco->peek_slots_count = count; | ||
299 | return count; | 277 | return count; |
300 | } | 278 | } |
301 | 279 | ||
@@ -327,14 +305,11 @@ static struct xenvif_rx_meta *get_next_rx_buffer(struct xenvif *vif, | |||
327 | return meta; | 305 | return meta; |
328 | } | 306 | } |
329 | 307 | ||
330 | /* | 308 | /* Set up the grant operations for this fragment. */ |
331 | * Set up the grant operations for this fragment. If it's a flipping | ||
332 | * interface, we also set up the unmap request from here. | ||
333 | */ | ||
334 | static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, | 309 | static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, |
335 | struct netrx_pending_operations *npo, | 310 | struct netrx_pending_operations *npo, |
336 | struct page *page, unsigned long size, | 311 | struct page *page, unsigned long size, |
337 | unsigned long offset, int *head) | 312 | unsigned long offset, int head, int *first) |
338 | { | 313 | { |
339 | struct gnttab_copy *copy_gop; | 314 | struct gnttab_copy *copy_gop; |
340 | struct xenvif_rx_meta *meta; | 315 | struct xenvif_rx_meta *meta; |
@@ -358,12 +333,12 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, | |||
358 | if (bytes > size) | 333 | if (bytes > size) |
359 | bytes = size; | 334 | bytes = size; |
360 | 335 | ||
361 | if (start_new_rx_buffer(npo->copy_off, bytes, *head)) { | 336 | if (start_new_rx_buffer(npo->copy_off, bytes, head)) { |
362 | /* | 337 | /* |
363 | * Netfront requires there to be some data in the head | 338 | * Netfront requires there to be some data in the head |
364 | * buffer. | 339 | * buffer. |
365 | */ | 340 | */ |
366 | BUG_ON(*head); | 341 | BUG_ON(*first); |
367 | 342 | ||
368 | meta = get_next_rx_buffer(vif, npo); | 343 | meta = get_next_rx_buffer(vif, npo); |
369 | } | 344 | } |
@@ -397,10 +372,10 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, | |||
397 | } | 372 | } |
398 | 373 | ||
399 | /* Leave a gap for the GSO descriptor. */ | 374 | /* Leave a gap for the GSO descriptor. */ |
400 | if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix) | 375 | if (*first && skb_shinfo(skb)->gso_size && !vif->gso_prefix) |
401 | vif->rx.req_cons++; | 376 | vif->rx.req_cons++; |
402 | 377 | ||
403 | *head = 0; /* There must be something in this buffer now. */ | 378 | *first = 0; /* There must be something in this buffer now. */ |
404 | 379 | ||
405 | } | 380 | } |
406 | } | 381 | } |
@@ -426,7 +401,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
426 | struct xen_netif_rx_request *req; | 401 | struct xen_netif_rx_request *req; |
427 | struct xenvif_rx_meta *meta; | 402 | struct xenvif_rx_meta *meta; |
428 | unsigned char *data; | 403 | unsigned char *data; |
429 | int head = 1; | 404 | int first = 1; |
430 | int old_meta_prod; | 405 | int old_meta_prod; |
431 | 406 | ||
432 | old_meta_prod = npo->meta_prod; | 407 | old_meta_prod = npo->meta_prod; |
@@ -462,7 +437,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
462 | len = skb_tail_pointer(skb) - data; | 437 | len = skb_tail_pointer(skb) - data; |
463 | 438 | ||
464 | xenvif_gop_frag_copy(vif, skb, npo, | 439 | xenvif_gop_frag_copy(vif, skb, npo, |
465 | virt_to_page(data), len, offset, &head); | 440 | virt_to_page(data), len, offset, 1, &first); |
466 | data += len; | 441 | data += len; |
467 | } | 442 | } |
468 | 443 | ||
@@ -471,7 +446,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
471 | skb_frag_page(&skb_shinfo(skb)->frags[i]), | 446 | skb_frag_page(&skb_shinfo(skb)->frags[i]), |
472 | skb_frag_size(&skb_shinfo(skb)->frags[i]), | 447 | skb_frag_size(&skb_shinfo(skb)->frags[i]), |
473 | skb_shinfo(skb)->frags[i].page_offset, | 448 | skb_shinfo(skb)->frags[i].page_offset, |
474 | &head); | 449 | 0, &first); |
475 | } | 450 | } |
476 | 451 | ||
477 | return npo->meta_prod - old_meta_prod; | 452 | return npo->meta_prod - old_meta_prod; |
@@ -529,10 +504,6 @@ static void xenvif_add_frag_responses(struct xenvif *vif, int status, | |||
529 | } | 504 | } |
530 | } | 505 | } |
531 | 506 | ||
532 | struct skb_cb_overlay { | ||
533 | int meta_slots_used; | ||
534 | }; | ||
535 | |||
536 | static void xenvif_kick_thread(struct xenvif *vif) | 507 | static void xenvif_kick_thread(struct xenvif *vif) |
537 | { | 508 | { |
538 | wake_up(&vif->wq); | 509 | wake_up(&vif->wq); |
@@ -563,19 +534,26 @@ void xenvif_rx_action(struct xenvif *vif) | |||
563 | count = 0; | 534 | count = 0; |
564 | 535 | ||
565 | while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) { | 536 | while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) { |
537 | RING_IDX old_rx_req_cons; | ||
538 | |||
566 | vif = netdev_priv(skb->dev); | 539 | vif = netdev_priv(skb->dev); |
567 | nr_frags = skb_shinfo(skb)->nr_frags; | 540 | nr_frags = skb_shinfo(skb)->nr_frags; |
568 | 541 | ||
542 | old_rx_req_cons = vif->rx.req_cons; | ||
569 | sco = (struct skb_cb_overlay *)skb->cb; | 543 | sco = (struct skb_cb_overlay *)skb->cb; |
570 | sco->meta_slots_used = xenvif_gop_skb(skb, &npo); | 544 | sco->meta_slots_used = xenvif_gop_skb(skb, &npo); |
571 | 545 | ||
572 | count += nr_frags + 1; | 546 | count += vif->rx.req_cons - old_rx_req_cons; |
573 | 547 | ||
574 | __skb_queue_tail(&rxq, skb); | 548 | __skb_queue_tail(&rxq, skb); |
575 | 549 | ||
550 | skb = skb_peek(&vif->rx_queue); | ||
551 | if (skb == NULL) | ||
552 | break; | ||
553 | sco = (struct skb_cb_overlay *)skb->cb; | ||
554 | |||
576 | /* Filled the batch queue? */ | 555 | /* Filled the batch queue? */ |
577 | /* XXX FIXME: RX path dependent on MAX_SKB_FRAGS */ | 556 | if (count + sco->peek_slots_count >= XEN_NETIF_RX_RING_SIZE) |
578 | if (count + MAX_SKB_FRAGS >= XEN_NETIF_RX_RING_SIZE) | ||
579 | break; | 557 | break; |
580 | } | 558 | } |
581 | 559 | ||