summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2016-09-13 21:24:01 +0530
committerDavid S. Miller <davem@davemloft.net>2016-09-15 20:49:20 -0400
commitcc516700c7edab4197d08998ac023c3043369391 (patch)
tree7066c61e5639f393e5edf15e36d1c8712d78c1ea /drivers/net/ethernet/chelsio
parent44c6d06992ac663e5163bdbe00844cb845ed5703 (diff)
downloadblackbird-obmc-linux-cc516700c7edab4197d08998ac023c3043369391.tar.gz
blackbird-obmc-linux-cc516700c7edab4197d08998ac023c3043369391.zip
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>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r--drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h9
1 files changed, 9 insertions, 0 deletions
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
OpenPOWER on IntegriCloud