Sorry, but your submission has been removed because we don't allow hypothetical questions. If possible, please feel free to rephrase the question so that it does not call for such speculation, and resubmit Otherwise, this sort of thing is better suited for /r/HistoryWhatIf.
The Soviets didn't enter Afghanistan to fight militants and tribals; they intervened to overthrow one Communist faction, led by Hafizullah Amin, to install another, led by Babrak Karmal.
The Soviets, much like the Americans today, could not achieve "victory" because their goals kept shifting. First it was just about overthrowing Amin to install Karmal. Then it was about helping Karmal secure his power base. When it became clear that this could not be done without more Soviet involvement, the Soviets increased their commitment, and were drawn in deeper step-by-step over the years.
"Victory" in war does not necessarily mean that you crush the enemy or make him sign a document of surrender. It simply means that you achieve a set of well-defined objectives. Since the objectives were not well-defined, victory was by definition impossible.
As for whether the Soviets could have suppressed the various factions of Afghanistan, I doubt it.
First of all, the US was not the only country interested in the region. Pakistan, Saudi Arabia, China, etc. all backed the Mujahideen for one reason or another, though their levels of support varied. There were a lot of players who did not want the Soviets to dominate Afghanistan.
Secondly, the Afghan government and their Soviet allies did not control much of Afghanistan outside of the major cities. The militants fought on the principles of Maoist doctrine--the villages surrounded the cities, so they could always retreat and regroup, as long as they avoided being annihilated in any single engagement. Worst comes to worst, they can cross the border into Pakistan, as many groups do today.
Finally, modern Afghan history is essentially the tale of the "modernizing" central government being undermined by internal divisions and broad popular opposition to their reforms. This was true of Mohammed Zahir Shah, Afghanistan's last king; Mohammed Daoud Khan, who overthrew him and became Afghanistan's first president; all the way to the Communists and beyond. No amount of military pressure could convince the broad public, if we can speak of such a thing in Afghanistan, to accept the policies that the various central governments tried to implement. Even if the Soviets were able to prop up the Communist government indefinitely, their control would be limited.