Thanks for your query,based on the facts that you have posted it appears that you have been operated for hernia repair
3 weeks back and had haematoma
just above the testis which was drained out by the operating surgeon.
Now you have developed hardness above the testis,
this could be due to either
1) Recurrent haematoma
2) Induration of the cord structures due to infection .
Please consult the operating surgeon and get ultrasound
scanning of the scrotum
done to confirm the cause of this hardness.
You need to take broad spectrum antibiotic like Cefexine along with anti inflammatory drug like Diclofenac