code optimization

Change-Id: I5d1d7592b74ded54e5e8d0343c2732b3837d607a
Signed-off-by: Eyal Salomon <esalomon@mellanox.com>