moving counter to start of the code.

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