libcxgb,iw_cxgb4,cxgbit: add cxgb_compute_wscale()

Add cxgb_compute_wscale() in libcxgb_cm.h to remove
it's duplicate definitions from cxgb4/cm.c and
cxgbit/cxgbit_cm.c.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Varun Prakash
2016-09-13 21:24:01 +05:30
committed by David S. Miller
parent 44c6d06992
commit cc516700c7
4 changed files with 16 additions and 25 deletions

View File

@@ -74,4 +74,13 @@ cxgb_best_mtu(const unsigned short *mtus, unsigned short mtu,
cxgb4_best_aligned_mtu(mtus, hdr_size, data_size, 8, idx);
}
static inline u32 cxgb_compute_wscale(u32 win)
{
u32 wscale = 0;
while (wscale < 14 && (65535 << wscale) < win)
wscale++;
return wscale;
}
#endif