Don't check if an interface can do tcp offload if there are no offload devices registered on the system.

Suggested by: rwatson
MFC after:	3 days
This commit is contained in:
Kip Macy 2008-09-01 05:30:22 +00:00
parent 32364a7ddb
commit 7c80e4f37f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182591
3 changed files with 9 additions and 1 deletions

View File

@ -119,6 +119,7 @@ int
register_tom(struct tom_info *t)
{
mtx_lock(&offload_db_lock);
toedev_registration_count++;
TAILQ_INSERT_HEAD(&offload_module_list, t, entry);
mtx_unlock(&offload_db_lock);
return 0;

View File

@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
#include <netinet/tcp_offload.h>
#include <netinet/toedev.h>
uint32_t toedev_registration_count;
int
tcp_offload_connect(struct socket *so, struct sockaddr *nam)
{
@ -59,12 +61,15 @@ tcp_offload_connect(struct socket *so, struct sockaddr *nam)
struct rtentry *rt;
int error;
if (toedev_registration_count == 0)
return (EINVAL);
/*
* Look up the route used for the connection to
* determine if it uses an interface capable of
* offloading the connection.
*/
rt = rtalloc1(nam, 1 /*report*/, 0 /*ignflags*/);
rt = rtalloc1(nam, 0 /*report*/, 0 /*ignflags*/);
if (rt)
RT_UNLOCK(rt);
else

View File

@ -34,6 +34,8 @@
#error "no user-serviceable parts inside"
#endif
extern uint32_t toedev_registration_count;
/* Parameter values for offload_get_phys_egress(). */
enum {
TOE_OPEN,