sobomax created this revision.
sobomax added a reviewer: freebsd-net-list.
sobomax set the repository for this revision to rS FreeBSD src repository.
Herald added a subscriber: imp.
Herald added a reviewer: transport.

REVISION SUMMARY
  Current storage format for the so_options is short and we are already have 16 
options defined, which makes it impossible to add new and experimental options. 
There is very little sense to save 2 bytes of memory per socket in 2016, hence 
this change.

TEST PLAN
  I've run world and kernel (GENERIC) twice one with this change and one 
without. No errors or new warnings, so it looks good.

REPOSITORY
  rS FreeBSD src repository

REVISION DETAIL
  https://reviews.freebsd.org/D8582

AFFECTED FILES
  share/doc/smm/18.net/6.t
  sys/kern/uipc_debug.c
  sys/netinet/in_pcb.c
  sys/netinet/in_pcb.h
  sys/netinet/tcp_var.h
  sys/sys/socketvar.h

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: sobomax, #transport, freebsd-net-list
Cc: imp
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -72,7 +72,7 @@
 struct socket {
 	int	so_count;		/* (b) reference count */
 	short	so_type;		/* (a) generic type, see socket.h */
-	short	so_options;		/* from socket call, see socket.h */
+	int	so_options;		/* from socket call, see socket.h */
 	short	so_linger;		/* time to linger while closing */
 	short	so_state;		/* (b) internal state flags SS_* */
 	int	so_qstate;		/* (e) internal state flags SQ_* */
@@ -167,7 +167,7 @@
 	size_t	xso_len;	/* length of this structure */
 	struct	socket *xso_so;	/* makes a convenient handle sometimes */
 	short	so_type;
-	short	so_options;
+	int	so_options;
 	short	so_linger;
 	short	so_state;
 	caddr_t	so_pcb;		/* another convenient handle */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -452,7 +452,7 @@
 	tcp_seq		iss;
 	tcp_seq		irs;
 	u_short		last_win;	/* cached window value */
-	u_short		tw_so_options;	/* copy of so_options */
+	int		tw_so_options;	/* copy of so_options */
 	struct ucred	*tw_cred;	/* user credentials */
 	u_int32_t	t_recent;
 	u_int32_t	ts_offset;	/* our timestamp offset */
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -488,7 +488,7 @@
 	inp_inpcbtotcpcb(struct inpcb *inp);
 void 	inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
 		uint32_t *faddr, uint16_t *fp);
-short	inp_so_options(const struct inpcb *inp);
+int	inp_so_options(const struct inpcb *inp);
 
 #endif /* _KERNEL */
 
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -493,10 +493,10 @@
 /*
  * Return cached socket options.
  */
-short
+int
 inp_so_options(const struct inpcb *inp)
 {
-   short so_options;
+   int so_options;
 
    so_options = 0;
 
diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c
--- a/sys/kern/uipc_debug.c
+++ b/sys/kern/uipc_debug.c
@@ -75,7 +75,7 @@
 }
 
 static void
-db_print_sooptions(short so_options)
+db_print_sooptions(int so_options)
 {
 	int comma;
 
diff --git a/share/doc/smm/18.net/6.t b/share/doc/smm/18.net/6.t
--- a/share/doc/smm/18.net/6.t
+++ b/share/doc/smm/18.net/6.t
@@ -61,7 +61,7 @@
 ._f
 struct socket {
 	short	so_type;		/* generic type */
-	short	so_options;		/* from socket call */
+	int	so_options;		/* from socket call */
 	short	so_linger;		/* time to linger while closing */
 	short	so_state;		/* internal state flags */
 	caddr_t	so_pcb;			/* protocol control block */

_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to