From cc516700c7edab4197d08998ac023c3043369391 Mon Sep 17 00:00:00 2001 From: Varun Prakash Date: Tue, 13 Sep 2016 21:24:01 +0530 Subject: 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 Signed-off-by: David S. Miller --- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/net/ethernet/chelsio') diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h index 7fb4feb3c221..ecf3baa940b9 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h @@ -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 -- cgit v1.2.3